Threepipe Configurator Plugins
    Preparing search index...

    Class MaterialConfiguratorPlugin

    Material Configurator Plugin (Basic UI) This plugin allows you to create variations of materials mapped to material names or uuids in the scene. These variations can be applied to the materials in the scene. (This copies the properties to the same material instances instead of assigning new materials) The plugin interfaces with the picking plugin and also provides uiConfig to show and edit the variations. This functionality is inherited from MaterialConfiguratorBasePlugin

    Additionally, this plugin adds a Grid UI using GridItemListPlugin in the DOM over the viewer canvas to show various material variations and allow the user to apply them. The UI can also be used in the editor to edit the variations and apply them.

    Hierarchy

    • MaterialConfiguratorBasePlugin
      • MaterialConfiguratorPlugin
    Index

    Constructors

    Properties

    _dirty: boolean = false
    _previewGenerator: undefined | MaterialPreviewGenerator
    _uicShowAllVariations: boolean = false
    _viewer?: ThreeViewer
    _viewerListeners: PartialRecord<IViewerEventTypes, (e: IViewerEvent) => void> = {}
    animateApply: boolean = true

    Animate the material change when applying a variation.

    animateApplyDuration: number = 500

    Duration of the animation when applying a variation in ms

    applyOnLoad: boolean = true

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

    applyOnLoadForce: boolean = false
    constructor: typeof AViewerPluginSync & typeof AViewerPlugin
    dependencies: typeof GridItemListPlugin[] = ...
    enabled: boolean = true
    enableEditContextMenus: boolean = false
    uiConfig: UiObjectConfig = ...
    variations: MaterialVariations[] = []
    OldPluginType?: string
    PluginType: string = 'MaterialConfiguratorPlugin'

    Accessors

    Methods

    • Parameters

      • e: IViewerEvent

      Returns IViewerEvent

    • Parameters

      • Optionalprefix: string

      Returns string

    • Parameters

      • Optionalmaterial: IMaterial<IMaterialEventMap>
      • OptionalvariationKey: string
      • cloneMaterial: boolean = true

      Returns void

    • Apply a material variation based on index or uuid.

      Parameters

      • variations: MaterialVariations
      • matUuidOrIndex: string | number
      • OptionalsetSelectedIndex: boolean

        default true, to be used with animation

      • Optionaltime: AnimateTime & { from?: string | number }

        optional data to animate(lerp) from current value to the target material.

      Returns boolean

    • Parameters

      • variations: MaterialVariations
      • matUuidOrIndex: string | number
      • duration: number = 500

      Returns Promise<void>

    • Parameters

      • Optionalv: MaterialVariations

      Returns undefined | { children: {}[]; label: string; type: string; uuid: string }

    • Parameters

      • key: any
      • setDirty: boolean = true

      Returns void

    • Parameters

      • key: any
      • setDirty: boolean = true

      Returns void

    • Returns ISerializedConfig | Record<string, never>

    • Parameters

      • matUuidOrIndex: string | number
      • variations: MaterialVariations

      Returns undefined | IMaterial<IMaterialEventMap>

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

      Parameters

      • material: IMaterial

        Material or index of the material in the variation.

      • preview: string

        Type of preview. Could be generate:sphere, generate:cube, color, map, emissive, etc.

      • viewerSetDirty: boolean = true

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

      Returns string

    • Parameters

      • state: any

      Returns Promise<void>

    • Reapply all selected variations again. Useful when a model or config is loaded or changed and the variations are not applied in the model. It is automatically called when the config is loaded if applyOnLoad is true.

      Returns void

    • Parameters

      • ...args: any[]

      Returns any

    • Parameters

      • Optionalmeta: SerializationMetaType

      Returns ISerializedConfig

    • Parameters

      • variation: MaterialVariations

      Returns {
          "Clear Materials": () => Promise<void>;
          "Remove Section": () => Promise<void>;
          "Rename mapping": () => Promise<void>;
          "Rename title": () => Promise<void>;
      }