@threepipe/plugin-tweakpane
Tweakpane UI plugin for ThreePipe
Example — Source Code — API Reference
npm install @threepipe/plugin-tweakpaneTweakpaneUiPlugin adds support for using uiconfig-tweakpane to create a configuration UI in applications using the Tweakpane library.
The plugin takes the uiconfig that's defined in the viewer and all the objects to automatically render a UI in the browser.
import {IObject3D, ThreeViewer, TonemapPlugin} from 'threepipe'
import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane'
const viewer = new ThreeViewer({...})
// Add the plugin
const plugin = viewer.addPluginSync(new TweakpaneUiPlugin(true)) // true to show expanded the UI by default
// Add the UI for the viewer
plugin.appendChild(viewer.uiConfig)
// Add UI for some plugins
plugin.setupPlugins(TonemapPlugin, DropzonePlugin)Color mode
colorMode sets the theme of the panel: clean and clean-dark (the default, from the system setting), light, dark, black, white and blue. It is in the plugin UI (Color Mode), and the fourth argument of the constructor sets it for the app.
The dialogs of viewer.dialog (alert, confirm, prompt, choose) have the colours of the colour mode too: the plugin sets the --dialog-* CSS variables of ts-browser-helpers on the body, from the --tp-* variables of the mode. To give the dialogs other colours, set --dialog-* on the body (or with a more specific rule), not on :root.
The colour mode is kept in localStorage (tpTheme), with the default at the time it was written (tpThemeDefault). A kept colour mode that was the default then follows the default of now, so a new default (or a change of the system setting) reaches everyone who did not pick another colour mode. A colour mode that the person picked stays. The colour mode is written only when it changes, so opening the page does not mark a pick as a default while the system setting matches it. A value of an earlier version, kept without the default, counts as a default when it is one of the earlier defaults (blue, dark, light).
