Skip to main content

LensStudio:PanelPlugin.PanelPlugin

Class

Base class for plugins that create persistent UI panels; extend this and implement createWidget() to build panel UI.

Index

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

ParameterType
pluginSystemPluginSystem
descriptor?Descriptor

Returns

PanelPlugin

Overrides

IPanelPlugin.constructor

Properties

id

readonly id: string

Unique string identifier of the plugin instance.

Inherited from

IPanelPlugin.id


pluginSystem

readonly pluginSystem: PluginSystem

The plugin system instance used to resolve interface dependencies.


title

readonly title: string

Read-only string displayed as the panel's title.

Inherited from

IPanelPlugin.title


widget

readonly widget: Widget

Read-only UI widget rendered inside the panel.

Inherited from

IPanelPlugin.widget

Methods

createWidget()

createWidget(parent): Widget

Creates and returns the root widget for the panel, parented to the given widget.

Parameters

ParameterType
parentWidget

Returns

Widget


deinit()

deinit(): void

Tears down the plugin and releases any resources it holds.

Returns

void


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

IPanelPlugin.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

IPanelPlugin.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

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

IPanelPlugin.isSame