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; }} Copy
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 pluginimport { MyOtherPluginPreset } from './MyOtherPluginPreset.js';const myOtherPluginPreset = new MyOtherPluginPreset(this.pluginSystem);myOtherPluginResult = await myOtherPluginPreset.createAsync(); Copy
// Triggering another plugin from a pluginimport { MyOtherPluginPreset } from './MyOtherPluginPreset.js';const myOtherPluginPreset = new MyOtherPluginPreset(this.pluginSystem);myOtherPluginResult = await myOtherPluginPreset.createAsync();
Protected
Readonly
Get various interfaces to the Lens Studio editor, such as its Editor.Model and Editor.Model.AssetManager.
Provides access to the Lens Studio editor plugins, components, and interfaces
Example