Preparing search index...

    Constructs a new entity generator plugin with an optional descriptor.

    // The EntityGenerator class (from LensStudio:EntityGenerator) is the base class
    // for plugins that add new entity creation options to the editor.
    //
    // Members:
    // generate(): Promise<Entity> — override to create and return a new entity
    // pluginSystem (readonly) — access to the plugin system

    export class EntityGeneratorEntityGeneratorExampleGenerator extends EntityGenerator {
    connections: any[];
    static descriptor() {
    const d = new Descriptor();
    d.id = 'com.docs.EntityGeneratorEntityGeneratorExample';
    d.name = 'Named Object Generator';
    d.description = 'Demonstrates EntityGenerator with generate() override';
    d.entityType = 'SceneObject';
    d.displayOrder = 10;
    d.dependencies = [Editor.Model.IModel];
    return d;
    }
    constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
    super(pluginSystem, descriptor);
    this.connections = [];
    }
    async generate(): Promise<Editor.Model.Entity> {
    const model = this.pluginSystem.findInterface(Editor.Model.IModel) as unknown as Editor.Model.IModel;
    const scene = model.project.scene;
    const obj = scene.addSceneObject(null as unknown as Editor.Model.SceneObject);
    obj.name = `Generated_${Date.now()}`;
    console.log(`Created scene object: ${obj.name}`);
    return obj;
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    id: string
    pluginSystem: PluginSystem

    The PluginSystem instance associated with this plugin.

    Methods

    • Generates a new Entity and returns it as a Promise.

      Returns Promise<Entity>

    • Returns the name of this object's type.

      Returns string

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

      Parameters

      • type: string

      Returns boolean

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

      Parameters

      Returns boolean