Context object holding the current asset selection, providing access to selected assets and their paths.
Example
// AssetContext is the IContext subclass handed to right-click callbacks // triggered from the asset browser. Its `selection` is an array of // AssetContext.Item — each Item exposes `asset` and `path`. constregistry = this.pluginSystem.findInterface( Editor.IContextActionRegistry.interfaceId ) asEditor.IContextActionRegistry;
constguard = registry.registerAction((ctx: Editor.IContext) => { if (!ctx.isOfType('Editor.Model.AssetContext')) { returnundefinedasunknownasEditor; } constassetCtx = ctxasEditor.Model.AssetContext; for (constitemofassetCtx.selection) { console.log(`Selected asset: ${item.asset.name} at ${item.path.toString()}`); } returnundefinedasunknownasEditor; }); this.guards.push(guard);
Context object holding the current asset selection, providing access to selected assets and their paths.
Example