LensStudio:PanelPlugin.PanelPlugin
ClassBase class for plugins that create persistent UI panels; extend this and implement createWidget() to build panel UI.
Index
Properties
Methods
Example
// PanelPlugin lifecycle:
// 1. createWidget(parent) — framework calls this to build the UI
// 2. User interacts with the panel
// 3. deinit() — framework calls this on shutdown
const root = new Widget(parent);
const layout = new BoxLayout();
layout.setDirection(Direction.TopToBottom);
layout.spacing = 8;
root.layout = layout;
const title = new Label(root);
title.text = 'PanelPlugin Lifecycle';
title.fontRole = FontRole.TitleBold;
layout.addWidget(title);
const status = new Label(root);
status.text = 'createWidget() was called by the framework.';
layout.addWidget(status);
const toggle = new CheckBox(root);
toggle.text = 'Enable feature';
toggle.checked = false;
layout.addWidget(toggle);
this.connections.push(
toggle.onToggle.connect((on: boolean) => {
status.text = `Feature: ${on ? 'enabled' : 'disabled'}`;
})
);
const btn = new PushButton(root);
btn.text = 'Access pluginSystem';
layout.addWidget(btn);
this.connections.push(
btn.onClick.connect(() => {
const descriptors = this.pluginSystem.descriptors;
status.text = `pluginSystem has ${descriptors.length} registered plugins.`;
})
);
Extends
Constructors
Constructor
new PanelPlugin(
pluginSystem,descriptor?):PanelPlugin
Constructs a new PanelPlugin instance that registers a persistent UI panel within Lens Studio.
Parameters
| Parameter | Type |
|---|---|
pluginSystem | PluginSystem |
descriptor? | Descriptor |
Returns
PanelPlugin
Overrides
IPanelPlugin.constructor
Properties
id
readonlyid:string
Unique string identifier of the plugin instance.
Inherited from
pluginSystem
readonlypluginSystem:PluginSystem
The plugin system instance used to resolve interface dependencies.
title
readonlytitle:string
Read-only string displayed as the panel's title.
Inherited from
widget
readonlywidget:Widget
Read-only UI widget rendered inside the panel.
Inherited from
Methods
createWidget()
createWidget(
parent):Widget
Creates and returns the root widget for the panel, parented to the given widget.
Parameters
| Parameter | Type |
|---|---|
parent | Widget |
Returns
deinit()
deinit():
void
Tears down the plugin and releases any resources it holds.
Returns
void
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