Preparing search index...

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

    // 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; }
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    canEdit: (arg1: Entity) => any

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

    defaultDockState: DockState

    Initial dock state of the panel when first opened.

    defaultSize: Size

    Default size of the panel when first created.

    dependencies: InterfaceId[]

    Array of interface IDs that this plugin requires to function.

    description: string

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

    id: string

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

    interfaces: InterfaceId[]

    Array of interface IDs that this plugin provides or implements.

    isUnique: boolean

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

    menuActionHierarchy: string[]

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

    minimumSize: Size

    Minimum allowed size of the panel.

    name: string

    Display name of the plugin.

    toolbarConfig?: ToolbarConfig

    Optional toolbar configuration to display in the panel.

    Methods

    • Returns true if the object is of the specified type.

      Parameters

      • type: string

      Returns boolean