Skip to main content

LensStudio:ProjectSettingsPlugin.ProjectSettingsPlugin

Class

Constructs a project settings plugin bound to the given plugin system and optional descriptor.

Index

Example

// ProjectSettingsPlugin (the same class exported at the module root) is the
// base class to extend for a custom Project Settings panel. The descriptor
// names the panel and assigns it a section + icon; createWidget builds the
// panel body; deinit() releases any retained widgets/connections.
import { ProjectSettingsPlugin, Descriptor } from 'LensStudio:ProjectSettingsPlugin';
import * as Ui from 'LensStudio:Ui';

export class ProjectSettingsPluginOverviewExampleSettings extends ProjectSettingsPlugin {
connections: any[];
root: Ui.Widget | null;
static descriptor(): Descriptor {
const d = new Descriptor();
d.id = 'com.docs.ProjectSettingsPluginOverviewExample';
d.name = 'Settings Class Example';
d.description = 'Demonstrates ProjectSettingsPlugin class lifecycle';
d.title = 'Class Example';
d.section = 'General Settings';
d.icon = Editor.Icon.fromFile(new Editor.Path(import.meta.resolve('icon.svg')));
d.dependencies = [Ui.IGui, Editor.Model.IModel];
return d;
}
constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
super(pluginSystem, descriptor);
this.connections = [];
this.root = null;
}
createWidget(parent: Ui.Widget): Ui.Widget {
this.root = new Ui.Widget(parent);
const layout = new Ui.BoxLayout();
layout.setDirection(Ui.Direction.TopToBottom);

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as unknown as Editor.Model.IModel;
const assetCount = model.project.assetManager.assets.length;

const info = new Ui.Label(this.root);
info.text = `Project has ${assetCount} asset(s)`;
info.wordWrap = true;
layout.addWidget(info);
layout.addStretch(1);

this.root.layout = layout;
return this.root;
}
deinit(): void {
this.connections.forEach((c: any) => c?.disconnect());
this.connections = [];
if (this.root) { this.root.deleteLater(); this.root = null; }
}
}

Extends

Constructors

Constructor

new ProjectSettingsPlugin(pluginSystem, descriptor?): ProjectSettingsPlugin

Initializes a ProjectSettingsPlugin with a plugin system and optional descriptor.

Parameters

ParameterType
pluginSystemPluginSystem
descriptor?Descriptor

Returns

ProjectSettingsPlugin

Overrides

Editor.IPlugin.constructor

Properties

id

readonly id: string

Unique string identifier of the plugin instance.

Inherited from

IPlugin.id


pluginSystem

readonly pluginSystem: PluginSystem

Reference to the plugin system instance.

Methods

createWidget()

createWidget(parent): Widget

Creates and returns a UI widget for the project settings panel. The returned widget must be a child of the provided parent widget. Called by the project settings dialog to render the plugin's UI.

Parameters

ParameterType
parentWidget

Returns

Widget


deinit()

deinit(): void

Call to shut down or unloadplugin. Used to clean up resources, listeners, or state.

Returns

void


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

IPlugin.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

IPlugin.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

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

IPlugin.isSame


setIssues()

setIssues(issues): void

Sets the current issue status (errors, warnings, or no issues) for this settings panel. Triggers the issuesChanged signal when statuses change, allowing the settings dialog to update visual indicators.

Parameters

ParameterType
issues(NoIssue | Warning | Error)[]

Returns

void