Class SwitchNodeBasePlugin

Switch Node Plugin (Base)

This plugin allows you to configure object variations in a file and apply them in the scene. Each SwitchNode is a parent object with multiple direct children. Only one child is visible at a time. This works by toggling the visible property of the children of a parent object. The plugin interfaces with the picking plugin and also provides uiConfig to show and edit the variations. It also provides a function to create snapshot previews of individual variations. This creates a limited render of the object with the selected child visible. To get a proper render, its better to render it offline and set the image as a preview.

See SwitchNodePlugin in plugin-configurator for example on inheriting with a custom UI renderer.

Hierarchy (view full)

Constructors

Properties

_dirty: boolean = false
_picking: undefined | PickingPlugin
_uiNeedRefresh: boolean = false
_viewer?: ThreeViewer
_viewerListeners: PartialRecord<"update" | "dispose" | "preRender" | "postRender" | "preFrame" | "postFrame" | "*" | "addPlugin" | "removePlugin" | "renderEnabled" | "renderDisabled", ((e) => void)> = {}

Type declaration

applyOnLoad: boolean = true

Apply all variations(by selected index or first item) when a config is loaded

constructor: typeof AViewerPluginSync & typeof AViewerPlugin
enabled: boolean = true
uiConfig: UiObjectConfig<any, string, any> = ...
variations: ObjectSwitchNode[] = []
OldPluginType?: string
PluginType: "SwitchNodePlugin" = 'SwitchNodePlugin'

Accessors

Methods

  • Get the preview for a switch node variation Should be called from preFrame ideally. (or preRender but set viewerSetDirty = false)

    Parameters

    • variation: ObjectSwitchNode

      Switch node variation that contains the child.

    • child: Object3D<Event, string>

      Child Object to get the preview for

    • viewerSetDirty: boolean = true

      call viewer.setDirty() after setting the preview. So that the preview is cleared from the canvas.

    Returns string

Generated using TypeDoc