Protected
_Protected
Optional
_Protected
_Static
Optional
Readonly
OldStatic
Readonly
PluginProtected
_Protected
_Optional
prefix: stringOptional
meta: SerializationMetaTypeLoads and adds a plugin to the viewer. The plugin can be specified as a path string or as a module object (imported or promise). If a path string is provided, it should point to a module that exports a default class extending AViewerPlugin. If a module object is provided, it should either have a default export or a named export that is a class extending AViewerPlugin. The module can also have a __tpPluginPath property to identify its path.
Usage examples:
// Load plugin from a path
await DynamicImportPlugin.loadPlugin('./path/to/MyPlugin.js');
// Load plugin from an imported module
import MyPluginModule from './path/to/MyPlugin.js';
await DynamicImportPlugin.loadPlugin(MyPluginModule);
// Load plugin with dynamic import
await DynamicImportPlugin.loadPlugin(import('./path/to/MyPlugin.js'));
The instance of the loaded plugin.
Optional
setOptional
meta: SerializationMetaTypeUnloads and removes a plugin from the viewer by its path. The path should match the one used when loading the plugin.
A promise that resolves when the plugin is removed.
A plugin that allows dynamic loading and unloading of other plugins at runtime, with support for hot module replacement (HMR) during development. This plugin provides a simple UI to load and unload plugins by specifying their module paths. It supports both direct path strings and module objects (imported or promises). The loaded plugins are tracked and can be managed through the provided UI.
For HMR with vite, see sampleThreepipeViteHmrPlugin Note: This plugin is primarily intended for development and testing purposes.