threepipe
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

plugin-configurator.md 3.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ---
  2. prev:
  3. text: '@threepipe/plugin-tweakpane-editor'
  4. link: './plugin-tweakpane-editor'
  5. next:
  6. text: '@threepipe/plugin-geometry-generator'
  7. link: './plugin-geometry-generator'
  8. ---
  9. # @threepipe/plugin-configurator
  10. Configurator Plugin implementations with basic UI for Threepipe.
  11. Includes Material Configurator and Switch Node Configurator Plugins.
  12. [![NPM Package](https://img.shields.io/npm/v/@threepipe/plugin-configurator.svg)](https://www.npmjs.com/package/@threepipe/plugin-configurator)
  13. ```bash
  14. npm install @threepipe/plugin-configurator
  15. ```
  16. ## MaterialConfiguratorPlugin
  17. [//]: # (todo: image)
  18. [Example](https://threepipe.org/examples/#material-configurator-plugin/) —
  19. [Source Code](https://github.com/repalash/threepipe/blob/master/plugins/configurator/src/MaterialConfiguratorPlugin.ts) —
  20. [API Reference](https://threepipe.org/plugins/configurator/docs/classes/MaterialConfiguratorPlugin.html)
  21. MaterialConfiguratorPlugin adds a UI to configure and switch between different material variations.
  22. The variations of materials are mapped to material names or uuids in the scene.
  23. These variations can be applied to the materials in the scene. (This copies the properties to the same material instances instead of assigning new materials)
  24. The plugin interfaces with the picking plugin and also provides uiConfig to show and edit the variations.
  25. This functionality is inherited from [MaterialConfiguratorBasePlugin](https://threepipe.org/docs/classes/MaterialConfiguratorBasePlugin.html).
  26. Additionally, this plugin adds a simple Grid UI in the DOM over the viewer canvas to show various material variations and allow the user to apply them.
  27. The UI can also be used in the editor to edit the variations and apply them.
  28. To use, simply add the plugin in the viewer and configure using the created UI and UI Config. Note that `PickingPlugin` is required to be added before this to allow configurator.
  29. To create a custom configurator UI, use the `MaterialConfiguratorBasePlugin` directly and call the function `applyVariation`, `getPreview` and `addVariation` to apply and add variations respectively.
  30. [//]: # (TODO Add Example for custom UI)
  31. ### SwitchNodePlugin
  32. [//]: # (todo: image)
  33. [Example](https://threepipe.org/examples/#switch-node-plugin/) —
  34. [Source Code](https://github.com/repalash/threepipe/blob/master/plugins/configurator/src/SwitchNodePlugin.ts) —
  35. [API Reference](https://threepipe.org/plugins/configurator/docs/classes/SwitchNodePlugin.html)
  36. SwitchNodePlugin adds a UI to configure and switch between different different object variations within a switch node object.
  37. This plugin allows you to configure object variations with object names in a file and apply them in the scene.
  38. Each SwitchNode is a parent object with multiple direct children. Only one child is visible at a time.
  39. This works by toggling the `visible` property of the children of a parent object.
  40. The plugin interfaces with the picking plugin and also provides uiConfig to show and edit the variations.
  41. It also provides a function to create snapshot previews of individual variations. This creates a limited render of the object with the selected child visible.
  42. To get a proper render, its better to render it offline and set the image as a preview.
  43. This functionality is inherited from [SwitchNodeBasePlugin](https://threepipe.org/docs/classes/SwitchNodeBasePlugin.html).
  44. Additionally, this plugin adds a simple Grid UI in the DOM over the viewer canvas to show various material variations and allow the user to apply them.
  45. The UI can also be used in the editor to edit the variations and apply them.
  46. To use, simply add the plugin in the viewer and configure using the created UI and UI Config. Note that `PickingPlugin` is required to be added before this to allow configurator.
  47. To create a custom configurator UI, use the `SwitchNodeBasePlugin` directly and call the function `selectNode`, `getPreview` and `addNode` to apply and add variations respectively.
  48. [//]: # (TODO Add Example for custom UI)