Module providing a live lens preview widget for use inside panel plugins.
Example
// LensBasedEditorView embeds a running Lens inside a plugin panel — use it // for visual editors, material previews, animation tools, or any UI that // benefits from a live lens preview. Communicate with the lens runtime via // postMessage / onMessage; observe lens lifecycle via onStateChanged. import*asUifrom'LensStudio:Ui'; import { PanelPlugin, Descriptor } from'LensStudio:PanelPlugin'; import*asLensBasedEditorViewfrom'LensStudio:LensBasedEditorView';
// Create the lens view with InitOptions and add it to the panel. constinitOptions = newLensBasedEditorView.InitOptions(); this.lensView = LensBasedEditorView.create(initOptions, this.root); this.lensView.setSizePolicy( Ui.SizePolicy.Policy.Expanding, Ui.SizePolicy.Policy.Expanding, ); layout.addWidget(this.lensView);
// Input source for the lens (image or video). constimageInput = newLensBasedEditorView.ImageInput(); imageInput.file = newEditor.Path( import.meta.resolve('./Resources/preview_background.png'), ); imageInput.fps = 30; imageInput.paused = false;
// Load options point at a packaged editor lens (.zip) and pair it // with the input. Set useOverlayOutput so the lens renders into the // overlay layer of the host widget. constloadOptions = newLensBasedEditorView.LoadOptions(); loadOptions.lens = newEditor.Path(import.meta.resolve('./EditorLens.zip')); loadOptions.input = imageInput; loadOptions.useOverlayOutput = true;
Module providing a live lens preview widget for use inside panel plugins.
Example