Skip to main content

LensStudio:EditorPlugin.Descriptor

Class

Descriptor for an editor plugin, extending EditorDescriptor with a canEdit predicate to determine which entities the plugin handles.

Index

Example

// EditorPlugin Descriptor extends EditorDescriptor (from PanelPlugin) with:
//
// canEdit: (entity: Editor.Model.Entity) => boolean
// Callback that determines whether this plugin can edit a given entity.
// The Inspector uses this to select which EditorPlugin to activate.
//
// Inherited from PanelDescriptor: defaultDockState, defaultSize, isUnique, menuActionHierarchy
// Inherited from BaseDescriptor: id, name, description, dependencies

export class EditorPluginDescriptorExampleEditor extends EditorPlugin {
connections: any[];
root: Widget | null;
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.EditorPluginDescriptorExample';
d.name = 'Descriptor Example Editor';
d.description = 'Shows EditorPlugin Descriptor with canEdit callback';
// canEdit receives a single entity and returns whether this plugin handles it
d.canEdit = (entity: Editor.Model.Entity) => {
if (Editor.isNull(entity)) return false;
return entity.isOfType('SceneObject');
};
return d;
}
constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
super(pluginSystem, descriptor);
this.connections = [];
this.root = null;
}
createWidget(parent: Widget): Widget {
this.root = new Widget(parent);
const layout = new BoxLayout();
layout.setDirection(Direction.TopToBottom);
this.root.layout = layout;

const label = new Label(this.root);
label.text = 'canEdit matched this entity';
layout.addWidget(label);

return this.root;
}
edit(entities: Editor.Model.Entity[]): boolean {
return true;
}
deinit(): void {
this.connections.forEach((c: any) => c?.disconnect());
this.connections = [];
if (this.root) { this.root.deleteLater(); this.root = null; }
}
}

Extends

Constructors

Constructor

new Descriptor(): Descriptor

Constructs a new Descriptor instance for registering an editor plugin.

Returns

Descriptor

Overrides

EditorDescriptor.constructor

Properties

canEdit

canEdit: (arg1) => any

Function that determines whether the plugin can edit a given asset.

Parameters

ParameterType
arg1Entity

Returns

any


defaultDockState

defaultDockState: DockState

Initial dock state of the panel when first opened.

Inherited from

PanelDescriptor.defaultDockState


defaultSize

defaultSize: Size

Default size of the panel when first created.

Inherited from

PanelDescriptor.defaultSize


dependencies

dependencies: InterfaceId[]

Array of interface IDs that this plugin requires to function.

Inherited from

EditorDescriptor.dependencies


description

description: string

Human-readable description of the plugin shown in the plugin manager.

Inherited from

EditorDescriptor.description


id

id: string

Unique identifier for the plugin, typically in reverse domain notation.

Inherited from

EditorDescriptor.id


intendedPlatforms

intendedPlatforms: TargetPlatform[]

Array of target platforms (Snapchat, Spectacles) where this plugin is intended to run.

Inherited from

EditorDescriptor.intendedPlatforms


interfaces

interfaces: InterfaceId[]

Array of interface IDs that this plugin provides or implements.

Inherited from

EditorDescriptor.interfaces


isUnique

isUnique: boolean

Whether only one instance of this panel can exist at a time.

Inherited from

EditorDescriptor.isUnique


menuActionHierarchy: string[]

Menu path segments used to place this panel in the application menu.

Inherited from

EditorDescriptor.menuActionHierarchy


minimumSize

minimumSize: Size

Minimum allowed size of the panel.

Inherited from

PanelDescriptor.minimumSize


name

name: string

Display name of the plugin.

Inherited from

EditorDescriptor.name


toolbarConfig?

optional toolbarConfig?: ToolbarConfig

Optional toolbar configuration to display in the panel.

Inherited from

PanelDescriptor.toolbarConfig

Methods

getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

EditorDescriptor.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

EditorDescriptor.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

EditorDescriptor.isOfType


isSame()

isSame(other): boolean

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

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

EditorDescriptor.isSame