LensStudio:GuiService.GuiService
ClassPlugin class managing GUI service registration and initialization within the editor plugin system.
Index
Properties
Methods
Example
// GuiService is the base class for GUI-aware editor plugins.
// It extends Editor.IPlugin with start()/stop() lifecycle methods.
//
// Members:
// start(): void — initialize GUI components
// stop(): void — tear down GUI components
// pluginSystem (readonly) — access to the plugin system
export class GuiServiceClassExampleService extends GuiService {
connections: any[];
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.GuiServiceClassExample';
d.name = 'GuiService Class Example';
d.description = 'Demonstrates GuiService class with start/stop lifecycle';
d.dependencies = [Editor.Model.IModel];
return d;
}
constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
super(pluginSystem, descriptor);
this.connections = [];
}
start(): void {
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as unknown as Editor.Model.IModel;
const scene = model.project.scene;
console.log('GuiService started');
console.log(`Scene has ${scene.rootSceneObjects.length} root object(s)`);
}
stop(): void {
this.connections.forEach((c: any) => c?.disconnect());
this.connections = [];
}
}
Extends
Constructors
Constructor
new GuiService(
pluginSystem,descriptor?):GuiService
Constructs a GuiService plugin instance with the given plugin system and optional descriptor.
Parameters
| Parameter | Type |
|---|---|
pluginSystem | PluginSystem |
descriptor? | Descriptor |
Returns
GuiService
Overrides
Editor.IPlugin.constructor
Properties
id
readonlyid:string
Unique string identifier of the plugin instance.
Inherited from
pluginSystem
readonlypluginSystem:PluginSystem
The plugin system instance this service is registered with.
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
start()
start():
void
Starts the GUI service and initializes its GUI components.
Returns
void
stop()
stop():
void
Stops the GUI service and tears down its GUI components.
Returns
void