Preparing search index...

    Editor context passed to context action callbacks when a right-click menu is triggered.

        // IContext is the abstract base passed to every context-menu action callback.
    // Concrete subclasses: AssetContext (right-click in asset browser)
    // and ObjectContext (right-click a scene object). Use isOfType()
    // to branch on the actual context at call time.
    const registry = this.pluginSystem.findInterface(
    Editor.IContextActionRegistry.interfaceId
    ) as Editor.IContextActionRegistry;

    const guard = registry.registerAction((ctx: Editor.IContext) => {
    if (ctx.isOfType('Editor.Model.AssetContext')) {
    const assetCtx = ctx as Editor.Model.AssetContext;
    console.log(`AssetContext: ${assetCtx.selection.length} asset(s) selected`);
    } else if (ctx.isOfType('Editor.Model.ObjectContext')) {
    const objCtx = ctx as Editor.Model.ObjectContext;
    console.log(`ObjectContext: ${objCtx.selection.length} object(s) selected`);
    }
    return undefined as unknown as Editor;
    });
    this.guards.push(guard);

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

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

      Parameters

      • type: string

      Returns boolean