Threepipe Tweakpane Editor Plugin
    Preparing search index...

    Class InspectorPlugin

    Inspector Plugin

    The settings of the selection of the PickingPlugin, like the inspector of Unity or the properties panel of Blender: a head with the name of the selection, tabs for its parts (Object, Material, Geometry; Texture for a selected texture), and the uiConfig of the open tab. A pick of another object keeps the open tab when the new selection has it.

    • The Object tab has a card for each material of the selected mesh, with a small preview and the name: a click opens the Material tab on that material.
    • The Material tab has a large live preview of the material (with the MaterialPreviewPlugin): a sphere, a cube or the selected mesh alone (previewShape). A drag on it turns it, the wheel zooms, a double-click resets the view. A mesh with more than one material has a list of its materials.
    • The settings render in a second Tweakpane renderer, inside element, with the theme of the page. While the inspector is in the page and enabled, the plugin turns off the selection UI of the PickingPlugin (PickingPlugin.selectionUi), since a uiConfig renders in one UI at a time; out of the page (the classic layout of the editor) the PickingPlugin shows the selection again, from the next change of the selection.
    • A search field above the settings shows only the settings whose name has the text, and the folders whose title has it (with all their settings); the folders open while it has text. Escape in it, or its × button, clears it.
    • A right-click on a setting (a long press on a touch screen) offers Reset to default, when its value is not the default of its class (the value of a new object of the same class), with undo; not on a disabled or read-only setting.
    • Escape (the PickingPlugin) clears the selection.

    Where the panel goes: in the container given to the constructor, else the app puts element in the page. In the editor frame it is a panel in one of the three places, and the person can move it with the menu of its entry:

    const inspector = viewer.addPluginSync(InspectorPlugin)
    const editor = viewer.getPlugin(TweakpaneEditorPlugin)!

    // right: in the right sidebar, the top of the panel above the mode settings, with its entry in the mode bar
    editor.addPanel('inspector', inspector.element, {...InspectorPlugin.AreaEntry, area: 'right'})

    // swap: also in the right sidebar; while something is selected it takes the whole panel (the mode settings hide)
    inspector.addEventListener('selectionChange', e => {
    const frame = editor.frame
    if (!frame || frame.panelArea('inspector') !== 'right') return // the person moved it
    frame.setPanelHidden('inspector', !e.hasSelection)
    frame.setModeSettingsHidden(e.hasSelection)
    })

    // or under the layers panel, in the left sidebar (a stack, in the order the panels are added)
    editor.addPanel('layers', layers.element, {...LayersPanelPlugin.AreaEntry, area: 'left'})
    editor.addPanel('inspector', inspector.element, {...InspectorPlugin.AreaEntry, area: 'left'})

    On the enabledChange event, the app takes the inspector out of its place or puts it back (editor.removePanel, editor.addPanel).

    Hierarchy

    Index
    _dirty: boolean = false
    _viewer?: ThreeViewer
    _viewerListeners: PartialRecord<IViewerEventTypes, (e: IViewerEvent) => void> = {}
    constructor: typeof AViewerPluginSync & typeof AViewerPlugin
    container?: HTMLElement
    dependencies: (typeof PickingPlugin | typeof MaterialPreviewPlugin)[] = ...
    element: HTMLDivElement
    enabled: boolean = true

    Off: the panel is hidden, and the enabledChange event tells the app (which can take it out of its place)

    isViewerPluginSync: true = ...
    preview: boolean = true

    The Material tab shows a large live preview of the material. Off: only its head, which a click opens again.

    previewShape: MaterialPreviewShape = 'sphere'

    The shape of the material preview: a sphere, a cube, or the selected mesh alone (mesh)

    toJSON: any = undefined
    uiConfig?: UiObjectConfig<any, string, any> = undefined
    AreaEntry: EditorFrameAreaOptions = ...

    The entry of the panel in the mode bar of the editor frame, for TweakpaneEditorPlugin.addPanel

    CardPreviewSize: number = 64

    The size in px of the previews in the material cards of the Object tab (twice the size on screen, for a sharp 2x screen)

    InjectStyles: boolean = true

    Add the CSS of the panel to the page when the first panel is made. Off: the app brings its own styles.

    LongPressTime: number = 500

    The time in ms of a touch on a setting that opens its menu (Reset to default)

    OldPluginType?: string
    PluginType: "InspectorPlugin" = 'InspectorPlugin'
    PreviewSize: number = 256

    The size in px of the large preview of the material

    • Parameters

      • e: IViewerEvent

      Returns IViewerEvent

    • Parameters

      • Optionalprefix: string

      Returns string

    • Parameters

      • key: any
      • setDirty: boolean = true

      Returns void

    • Parameters

      • key: any
      • setDirty: boolean = true

      Returns void

    • Returns ISerializedConfig | Record<string, never>

    • Parameters

      • state: any

      Returns Promise<void>