Class: MaterialConfiguratorBasePlugin
Plugins.MaterialConfiguratorBasePlugin
Hierarchy
AViewerPlugin<"">↳
MaterialConfiguratorBasePlugin
Properties
PluginType
▪ Static PluginType: string = 'MaterialConfiguratorPlugin'
enabled
• enabled: boolean = true
Overrides
applyOnLoad
• applyOnLoad: boolean = true
Apply all variations(by selected index or first item) when a config is loaded
dependencies
• dependencies: typeof AssetManagerPlugin[]
variations
• variations: MaterialVariations[] = []
uiConfig
• uiConfig: UiObjectConfig<any, string>
_dirty
• Protected _dirty: boolean = false
Inherited from
_viewer
• Protected Optional _viewer: ViewerApp
Inherited from
_previewGenerator
• Protected _previewGenerator: undefined | MaterialPreviewGenerator
Accessors
dirty
• get dirty(): boolean
Returns
boolean
Inherited from
AViewerPlugin.dirty
• set dirty(value): void
Parameters
| Name | Type |
|---|---|
value | boolean |
Returns
void
Inherited from
AViewerPlugin.dirty
viewer
• get viewer(): undefined | ViewerApp
Returns
undefined | ViewerApp
Inherited from
AViewerPlugin.viewer
Methods
onDispose
▸ onDispose(viewer): Promise<void>
Parameters
| Name | Type |
|---|---|
viewer | ViewerApp |
Returns
Promise<void>
Inherited from
toJSON
▸ toJSON(meta?): any
Parameters
| Name | Type |
|---|---|
meta? | any |
Returns
any
Inherited from
exportState
▸ exportState(): any
Returns
any
Inherited from
importState
▸ importState(state): Promise<void>
Parameters
| Name | Type |
|---|---|
state | any |
Returns
Promise<void>
Inherited from
storeState
▸ storeState(prefix?, storage?, data?): void
Parameters
| Name | Type |
|---|---|
prefix? | string |
storage? | Storage |
data? | any |
Returns
void
Inherited from
loadState
▸ loadState(prefix?, storage?): Promise<void>
Parameters
| Name | Type |
|---|---|
prefix? | string |
storage? | Storage |
Returns
Promise<void>
Inherited from
onAdded
▸ onAdded(viewer): Promise<void>
Parameters
| Name | Type |
|---|---|
viewer | ViewerApp |
Returns
Promise<void>
Overrides
reapplyAll
▸ reapplyAll(): void
Reapply all selected variations again. Useful when the scene is loaded or changed and the variations are not applied.
Returns
void
fromJSON
▸ fromJSON(data, meta?): null | MaterialConfiguratorBasePlugin | Promise<null | MaterialConfiguratorBasePlugin>
Parameters
| Name | Type |
|---|---|
data | any |
meta? | any |
Returns
null | MaterialConfiguratorBasePlugin | Promise<null | MaterialConfiguratorBasePlugin>
Overrides
onRemove
▸ onRemove(viewer): Promise<void>
Parameters
| Name | Type |
|---|---|
viewer | ViewerApp |
Returns
Promise<void>
Overrides
findVariation
▸ findVariation(uuid?): undefined | MaterialVariations
Parameters
| Name | Type |
|---|---|
uuid? | string |
Returns
undefined | MaterialVariations
getSelectedVariation
▸ getSelectedVariation(): undefined | MaterialVariations
Returns
undefined | MaterialVariations
applyVariation
▸ applyVariation(variations, matUuidOrIndex): boolean
Apply a material variation based on index or uuid.
Parameters
| Name | Type |
|---|---|
variations | MaterialVariations |
matUuidOrIndex | string | number |
Returns
boolean
getPreview
▸ getPreview(material, preview, viewerSetDirty?): string
Get the preview for a material variation Should be called from preFrame ideally. (or preRender but set viewerSetDirty = false)
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
material | IMaterial<any, IMaterialEventMap> | undefined | Material or index of the material in the variation. |
preview | string | undefined | 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
refreshUi
▸ refreshUi(): void
Refreshes the UI in the next frame
Returns
void
removeVariationForMaterial
▸ removeVariationForMaterial(material): void
Parameters
| Name | Type |
|---|---|
material | IMaterial<any, IMaterialEventMap> |
Returns
void
removeVariation
▸ removeVariation(variation): void
Parameters
| Name | Type |
|---|---|
variation | MaterialVariations |
Returns
void
addVariation
▸ addVariation(material?, variationKey?, cloneMaterial?): void
Parameters
| Name | Type | Default value |
|---|---|---|
material? | IMaterial<any, IMaterialEventMap> | undefined |
variationKey? | string | undefined |
cloneMaterial | boolean | true |
Returns
void
createVariation
▸ createVariation(material, variationKey?): MaterialVariations
Parameters
| Name | Type |
|---|---|
material | IMaterial<any, IMaterialEventMap> |
variationKey? | string |
Returns
_storeKey
▸ Protected _storeKey(prefix?): string
Parameters
| Name | Type |
|---|---|
prefix? | string |
Returns
string
Inherited from
_refreshUi
▸ Protected _refreshUi(): Promise<boolean>
Returns
Promise<boolean>
Constructors
constructor
• new MaterialConfiguratorBasePlugin()