Preparing search index...

    Base class for dialog plugins; extend to implement custom dialogs with a createWidget method.

    // DialogPlugin is the base class for all dialog-based plugins.
    // It extends Editor.IPlugin with show() and deinit() lifecycle methods.
    //
    // Lifecycle:
    // 1. User triggers menu action (from menuActionHierarchy)
    // 2. show(parent) is called — build and return the Dialog
    // 3. User interacts with the dialog
    // 4. Dialog closes — deinit() is called for cleanup

    export class DialogPluginDialogPluginExampleDialog extends DialogPlugin {
    connections: any[];
    static descriptor() {
    const d = new Descriptor();
    d.id = 'com.docs.DialogPluginDialogPluginExample';
    d.name = 'DialogPlugin Class Example';
    d.description = 'Demonstrates the DialogPlugin class lifecycle';
    d.dependencies = [Editor.Model.IModel];
    d.menuActionHierarchy = ['Window', 'Examples', 'DialogPlugin Class'];
    return d;
    }
    constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
    super(pluginSystem, descriptor);
    this.connections = [];
    }
    show(parent: Widget): Dialog {
    const dialog = new Dialog(parent);
    const layout = new BoxLayout();
    layout.setDirection(Direction.TopToBottom);
    layout.spacing = 8;
    dialog.layout = layout;

    const info = new Label(dialog);
    info.wordWrap = true;
    layout.addWidget(info);

    const model = this.pluginSystem.findInterface(Editor.Model.IModel) as unknown as Editor.Model.IModel;
    const count = model.project.scene.rootSceneObjects.length;
    info.text = `Project has ${count} root scene object(s).`;

    const closeBtn = new PushButton(dialog);
    closeBtn.text = 'Done';
    this.connections.push(closeBtn.onClick.connect(() => dialog.accept()));
    layout.addWidget(closeBtn);

    return dialog;
    }
    deinit(): void {
    this.connections.forEach((c: any) => c?.disconnect());
    this.connections = [];
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    id: string
    pluginSystem: PluginSystem

    The PluginSystem instance that owns and manages this plugin.

    Methods

    • Tears down the plugin and releases its resources.

      Returns void

    • Returns the name of this object's type.

      Returns string

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

      Parameters

      • type: string

      Returns boolean

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

      Parameters

      Returns boolean

    • Creates and displays the dialog as a child of the given parent widget, returning the resulting Dialog instance.

      Parameters

      Returns Dialog