Class GLTFKHRMaterialVariantsPlugin

GLTF khr_material_variants plugin

This plugin allows to import and export gltf files with KHR_materials_variants extension. The material data is stored in the object userData. The plugin also provides a UI to select the variant.

Hierarchy (View Summary)

Constructors

Properties

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

If true, the first variant will be applied to the objects when object is added and nothing is selected.

constructor: typeof AViewerPluginSync & typeof AViewerPlugin
enabled: boolean = true
selectedVariant: string = ''

The selected variant. Changing this will automatically apply the variant to the objects.

uiConfig: UiObjectConfig = ...
variants: Record<string, IObject3D[]> = {}
OldPluginType?: string
PluginType: "GLTFKHRMaterialVariantsPlugin" = 'GLTFKHRMaterialVariantsPlugin'

Accessors

Methods

  • Apply the variant to objects. It will also change the selectedVariant if root is not provided.

    Parameters

    • name: string
    • force: boolean = false
    • Optionalroot: IObject3D[]
    • doTraverse: boolean = true

    Returns void