Preparing search index...

    Base preset class to extend when defining a plugin that creates scene objects, assets, or components; requires a static descriptor() and an async createAsync() method.

    // Preset is the base class for plugins that add object/asset presets
    // to Lens Studio menus.
    //
    // Key members:
    // create(destination: SceneObject | Path, importSettings?): Entity
    // Synchronous — add scene objects or configure assets under destination.
    // createAsync(destination: SceneObject | Path, importSettings?): Promise<Entity>
    // Async — use when the preset needs to load resources before finishing.
    // pluginSystem (readonly) — resolves interface dependencies.

    export class PresetClassExamplePreset extends Preset {
    connections: any[];
    static descriptor() {
    const d = new Descriptor();
    d.id = 'com.docs.PresetClassExample';
    d.name = 'Light Rig Preset';
    d.description = 'Creates a scene object configured as a light rig';
    d.entityType = 'SceneObject';
    d.section = 'Lighting';
    d.dependencies = [Editor.Model.IModel];
    return d;
    }
    constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
    super(pluginSystem, descriptor);
    this.connections = [];
    }
    async createAsync(destination: Editor.Model.SceneObject | Editor.Path): Promise<Editor.Model.Entity> {
    const model = this.pluginSystem.findInterface(Editor.Model.IModel) as unknown as Editor.Model.IModel;
    const scene = model.project.scene;
    const rig = scene.addSceneObject(destination as Editor.Model.SceneObject);
    rig.name = 'Light Rig';
    return rig;
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    id: string
    pluginSystem: PluginSystem

    The plugin system instance used to resolve interface dependencies.

    Methods

    • Synchronously creates and places a pre-configured entity at the given destination scene object or path.

      Parameters

      Returns Entity

    • Asynchronously creates and places a pre-configured entity at the given destination scene object or path.

      Parameters

      Returns Promise<Entity>

    • Returns the name of this object's type.

      Returns string

    • Returns true if the object is of the specified type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object refers to the same instance as the given object.

      Parameters

      Returns boolean