LensStudio:EditorPlugin.Descriptor
ClassDescriptor for an editor plugin, extending EditorDescriptor with a canEdit predicate to determine which entities the plugin handles.
Index
Properties
Methods
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
| Parameter | Type |
|---|---|
arg1 | Entity |
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
dependencies
dependencies:
InterfaceId[]
Array of interface IDs that this plugin requires to function.
Inherited from
description
description:
string
Human-readable description of the plugin shown in the plugin manager.
Inherited from
id
id:
string
Unique identifier for the plugin, typically in reverse domain notation.
Inherited from
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
isUnique
isUnique:
boolean
Whether only one instance of this panel can exist at a time.
Inherited from
menuActionHierarchy
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
name
name:
string
Display name of the plugin.
Inherited from
toolbarConfig?
optionaltoolbarConfig?:ToolbarConfig
Optional toolbar configuration to display in the panel.
Inherited from
Methods
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean