Skip to main content

MaterialPropertyOverrides

Class

Overrides the passes of one material on a single visual.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Since Lens Scripting v304

Overrides the passes of one material on a single visual. Index it with a pass number to get that pass's PassPropertyOverrides. Used with MaterialMeshVisual.

Assigning an object to a pass (overrides[0] = { baseColor: vec4.one() }) sets the keys of the object and removes all other keys of that pass. Assigning null, or any value that is not an object, removes that pass's overrides, and so does delete overrides[0] (Lens Scripting version 386).

See PropertyOverrides for the Lens Scripting version each form needs.

Index

Example

//@input Component.MaterialMeshVisual visual
const material = script.visual.propertyOverrides[0];
material[0].baseColor = new vec4(1, 0, 0, 1);
material[0] = null; // removes pass 0's overrides
material[1] = { baseColor: new vec4(0, 1, 0, 1) };
delete material[1]; // removes pass 1's overrides

Extends

Indexable

[index: string]: any

Methods

getTypeName()

static getTypeName(): TypeName<MaterialPropertyOverrides>

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<MaterialPropertyOverrides>

Since

Lens Scripting Version 304

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame