Preparing search index...

    Module LensStudio:Preset

    Module providing the base Preset class and Descriptor for creating editor presets that add objects, assets, or components to a Lens Studio scene.

    // The LensStudio:Preset module lets plugins register object/asset presets
    // that appear in Lens Studio's Add menu.
    //
    // Descriptor fields:
    // entityType: string — 'SceneObject', 'Asset', or 'Component'
    // section: string — category in the preset menu
    // icon: Editor.Icon — icon for the menu entry
    // pathsToImport: Editor.Path[] — asset paths bundled with the preset
    //
    // Preset class:
    // create(destination) — synchronous creation
    // createAsync(destination) — async creation
    // pluginSystem (readonly)

    export class PresetModuleExamplePreset extends Preset {
    connections: any[];
    static descriptor() {
    const d = new Descriptor();
    d.id = 'com.docs.PresetModuleExample';
    d.name = 'Empty Object Preset';
    d.description = 'Creates an empty scene object';
    d.entityType = 'SceneObject';
    d.section = 'Examples';
    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 obj = scene.addSceneObject(destination as Editor.Model.SceneObject);
    obj.name = 'Example Preset Object';
    return obj;
    }
    }

    Classes

    Descriptor
    Preset