Skip to main content

Editor.Model.IEntityPrototypeRegistry

Class

Registry for entity prototypes, providing methods to create, query, and register entity types within the Editor model.

Index

Example

// Resolve IEntityPrototypeRegistry to query registered entity types and captions.
const registry = this.pluginSystem.findInterface(
Editor.Model.IEntityPrototypeRegistry.interfaceId
) as Editor.Model.IEntityPrototypeRegistry;
if (Editor.isNull(registry)) {
console.log('IEntityPrototypeRegistry not available');
return;
}

const types = registry.getEntityTypes('Component', () => true);
console.log('Registered component types:', types.length);
for (const t of types) {
const caption = registry.getCaptionForType(t);
console.log(' Type:', t, 'Caption:', caption);
}

Extends

Properties

interfaceId

static interfaceId: InterfaceId

Unique identifier string for the IEntityPrototypeRegistry interface.

Methods

createEntity()

createEntity(entityType, context, callback): void

Creates a new entity of the specified type within the given context, invoking a callback with the created entity.

Parameters

ParameterType
entityTypestring
contextEntity | Path
callback(arg1) => void

Returns

void


getCaptionForType()

getCaptionForType(type): string

Returns the display caption string for the given entity type identifier.

Parameters

ParameterType
typestring

Returns

string


getEntityTypes()

getEntityTypes(baseType, acceptsType): string[]

Returns an array of entity type strings matching the given base type and acceptance predicate.

Parameters

ParameterType
baseTypestring
acceptsType(arg1) => any

Returns

string[]


getIconForType()

getIconForType(type): Icon

Returns the icon associated with the given entity type identifier.

Parameters

ParameterType
typestring

Returns

Icon


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

IPluginComponent.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

IPluginComponent.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

IPluginComponent.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

IPluginComponent.isSame


registerEntityPrototype()

registerEntityPrototype(prototypeData): IGuard

Registers a new entity prototype from the provided prototype data and returns a guard managing the registration lifetime.

Parameters

ParameterType
prototypeDataEntityPrototypeData

Returns

IGuard