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.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();
interface PluginSystem {
    findInterface(object: any): IInterface;
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
}

Hierarchy (view full)

Methods