Editor.Model.AssetContext
ClassContext object holding the current asset selection, providing access to selected assets and their paths.
Index
Properties
Methods
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`.
const registry = this.pluginSystem.findInterface(
Editor.IContextActionRegistry.interfaceId
) as Editor.IContextActionRegistry;
const guard = registry.registerAction((ctx: Editor.IContext) => {
if (!ctx.isOfType('Editor.Model.AssetContext')) {
return undefined as unknown as Editor;
}
const assetCtx = ctx as Editor.Model.AssetContext;
for (const item of assetCtx.selection) {
console.log(`Selected asset: ${item.asset.name} at ${item.path.toString()}`);
}
return undefined as unknown as Editor;
});
this.guards.push(guard);
Extends
Properties
isDetailedView
readonlyisDetailedView:boolean
Whether the asset panel is currently rendering the detailed (list) view rather than the icon view.
selection
readonlyselection:Item[]
Read-only array of currently selected asset items in the asset panel.
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
Inherited from
Nested types
Classes
| Class | Description |
|---|---|
| Item | Represents a single selected asset entry, pairing an asset reference with its file path. |