Skip to main content

Editor.Model.ObjectContext

Class

Context scoped to a set of scene objects, providing access to the current object selection.

Index

Example

// Register a context action that inspects the ObjectContext selection.
const registry = this.pluginSystem.findInterface(
Editor.IContextActionRegistry.interfaceId
) as Editor.IContextActionRegistry;
if (Editor.isNull(registry)) {
console.log('IContextActionRegistry not available');
return;
}

const guard = registry.registerAction((ctx: Editor.IContext) => {
const objCtx = ctx as Editor.Model.ObjectContext;
for (const obj of objCtx.selection) {
console.log('Selected SceneObject:', obj.name);
}
return undefined as unknown as Editor;
});
this.guards.push(guard);
console.log('Object context action registered');

Extends

Properties

selection

readonly selection: SceneObject[]

Read-only array of currently selected SceneObjects in this context.

Methods

getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

IContext.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

IContext.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

IContext.isOfType


isSame()

isSame(other): boolean

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

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

IContext.isSame