Editor Scripting API

    Provides access to the Lens Studio editor plugins, components, and interfaces

    import { Preset } from 'LensStudio:Preset';

    export class ObjectPrefabPreset extends Preset {
    static descriptor() {
    return {
    id: 'Com.Snap.ObjectPrefabPreset',
    interfaces: Preset.descriptor().interfaces,
    dependencies: [Editor.Model.IModel],
    name: 'Object Prefab',
    description: '',
    icon: Editor.Icon.fromFile(import.meta.resolve('../Resources/ObjectPrefab.svg')),
    section: 'General',
    entityType: 'ObjectPrefab'
    };
    }
    constructor(pluginSystem) {
    super(pluginSystem);
    }
    create(destination) {
    const model = this.pluginSystem.findInterface(Editor.Model.IModel);
    const assetManager = model.project.assetManager;

    const prefab = assetManager.createNativeAsset('ObjectPrefab', 'ObjectPrefab', destination);

    const object = prefab.addSceneObject(null);
    object.name = 'Object Prefab';

    return prefab;
    }
    }
    // Triggering another plugin from a plugin
    import { MyOtherPluginPreset } from './MyOtherPluginPreset.js';
    const myOtherPluginPreset = new MyOtherPluginPreset(this.pluginSystem);
    myOtherPluginResult = await myOtherPluginPreset.createAsync();

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    descriptors: IPluginDescriptor[]

    Methods

    • Parameters

      • type: string

      Returns boolean

    • Parameters

      Returns void

    • Parameters

      Returns void

    MMNEPVFCICPMFPCPTTAAATR