mesheditor 0.0.0-stage → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +853 -2
  3. package/dist-lib/esm/AIAgentService.d.ts +106 -0
  4. package/dist-lib/esm/AIAgentService.js +1471 -0
  5. package/dist-lib/esm/MeshEditorApp.d.ts +412 -0
  6. package/dist-lib/esm/MeshEditorApp.js +9092 -0
  7. package/dist-lib/esm/MeshEditorService.d.ts +459 -0
  8. package/dist-lib/esm/MeshEditorService.js +7083 -0
  9. package/dist-lib/esm/Neural3DGeneratorService.d.ts +88 -0
  10. package/dist-lib/esm/Neural3DGeneratorService.js +1397 -0
  11. package/dist-lib/esm/adapters/BrowserPlatformAdapter.d.ts +16 -0
  12. package/dist-lib/esm/adapters/BrowserPlatformAdapter.js +25 -0
  13. package/dist-lib/esm/adapters/ElectronPlatformAdapter.d.ts +32 -0
  14. package/dist-lib/esm/adapters/ElectronPlatformAdapter.js +336 -0
  15. package/dist-lib/esm/adapters/HostAppAdapter.d.ts +54 -0
  16. package/dist-lib/esm/adapters/HostAppAdapter.js +75 -0
  17. package/dist-lib/esm/adapters/PlatformAdapter.d.ts +98 -0
  18. package/dist-lib/esm/adapters/PlatformAdapter.js +1 -0
  19. package/dist-lib/esm/adapters/index.d.ts +13 -0
  20. package/dist-lib/esm/adapters/index.js +15 -0
  21. package/dist-lib/esm/assets/fonts/Droid_Sans_Bold.json +1 -0
  22. package/dist-lib/esm/assets/fonts/Droid_Sans_Regular.json +1 -0
  23. package/dist-lib/esm/assets/fonts/Kenney_Future_Regular.json +1 -0
  24. package/dist-lib/esm/baking/TextureBaker.d.ts +84 -0
  25. package/dist-lib/esm/baking/TextureBaker.js +709 -0
  26. package/dist-lib/esm/builtInSkills.d.ts +19 -0
  27. package/dist-lib/esm/builtInSkills.js +186 -0
  28. package/dist-lib/esm/compression/ModelCompressor.d.ts +87 -0
  29. package/dist-lib/esm/compression/ModelCompressor.js +553 -0
  30. package/dist-lib/esm/decals/DecalController.d.ts +147 -0
  31. package/dist-lib/esm/decals/DecalController.js +1031 -0
  32. package/dist-lib/esm/decals/decalAssetUrls.d.ts +1 -0
  33. package/dist-lib/esm/decals/decalAssetUrls.js +16 -0
  34. package/dist-lib/esm/geometry/architecture.d.ts +114 -0
  35. package/dist-lib/esm/geometry/architecture.js +832 -0
  36. package/dist-lib/esm/geometry/bevelModifier.d.ts +59 -0
  37. package/dist-lib/esm/geometry/bevelModifier.js +345 -0
  38. package/dist-lib/esm/geometry/facetSurfaceUtils.d.ts +127 -0
  39. package/dist-lib/esm/geometry/facetSurfaceUtils.js +676 -0
  40. package/dist-lib/esm/geometry/roundedBox.d.ts +15 -0
  41. package/dist-lib/esm/geometry/roundedBox.js +133 -0
  42. package/dist-lib/esm/index.d.ts +21 -0
  43. package/dist-lib/esm/index.js +50 -0
  44. package/dist-lib/esm/pathExtrusion/PathExtrusionController.d.ts +59 -0
  45. package/dist-lib/esm/pathExtrusion/PathExtrusionController.js +483 -0
  46. package/dist-lib/esm/pathExtrusion/PathExtrusionStudio.d.ts +76 -0
  47. package/dist-lib/esm/pathExtrusion/PathExtrusionStudio.js +1792 -0
  48. package/dist-lib/esm/pathExtrusion/PathFactory.d.ts +95 -0
  49. package/dist-lib/esm/pathExtrusion/PathFactory.js +627 -0
  50. package/dist-lib/esm/pathExtrusion/index.d.ts +4 -0
  51. package/dist-lib/esm/pathExtrusion/index.js +4 -0
  52. package/dist-lib/esm/pathExtrusion/types.d.ts +50 -0
  53. package/dist-lib/esm/pathExtrusion/types.js +1 -0
  54. package/dist-lib/esm/plugin.d.ts +250 -0
  55. package/dist-lib/esm/plugin.js +144 -0
  56. package/dist-lib/esm/rigging/WeightPaintController.d.ts +162 -0
  57. package/dist-lib/esm/rigging/WeightPaintController.js +1421 -0
  58. package/dist-lib/esm/sculpting/SculptController.d.ts +146 -0
  59. package/dist-lib/esm/sculpting/SculptController.js +2038 -0
  60. package/dist-lib/esm/sdf/index.d.ts +2 -0
  61. package/dist-lib/esm/sdf/index.js +2 -0
  62. package/dist-lib/esm/sdf/sdfPrimitives.d.ts +97 -0
  63. package/dist-lib/esm/sdf/sdfPrimitives.js +402 -0
  64. package/dist-lib/esm/sdf/surfaceNets.d.ts +29 -0
  65. package/dist-lib/esm/sdf/surfaceNets.js +399 -0
  66. package/dist-lib/esm/styles.d.ts +11 -0
  67. package/dist-lib/esm/styles.js +32 -0
  68. package/dist-lib/esm/template.d.ts +12 -0
  69. package/dist-lib/esm/template.js +19 -0
  70. package/dist-lib/esm/textMesh/TextMeshController.d.ts +61 -0
  71. package/dist-lib/esm/textMesh/TextMeshController.js +405 -0
  72. package/dist-lib/esm/textures/AITextureGenerator.d.ts +119 -0
  73. package/dist-lib/esm/textures/AITextureGenerator.js +945 -0
  74. package/dist-lib/esm/textures/ExternalImageGeneratorService.d.ts +62 -0
  75. package/dist-lib/esm/textures/ExternalImageGeneratorService.js +879 -0
  76. package/dist-lib/esm/tools/AbstractTool.d.ts +68 -0
  77. package/dist-lib/esm/tools/AbstractTool.js +128 -0
  78. package/dist-lib/esm/tools/ToolExecutionContext.d.ts +40 -0
  79. package/dist-lib/esm/tools/ToolExecutionContext.js +1 -0
  80. package/dist-lib/esm/tools/ToolInterface.d.ts +104 -0
  81. package/dist-lib/esm/tools/ToolInterface.js +1 -0
  82. package/dist-lib/esm/tools/ToolRegistry.d.ts +43 -0
  83. package/dist-lib/esm/tools/ToolRegistry.js +115 -0
  84. package/dist-lib/esm/tools/builtin/ApplyMaterialTool.d.ts +34 -0
  85. package/dist-lib/esm/tools/builtin/ApplyMaterialTool.js +48 -0
  86. package/dist-lib/esm/tools/builtin/AutoUVMappingTool.d.ts +34 -0
  87. package/dist-lib/esm/tools/builtin/AutoUVMappingTool.js +54 -0
  88. package/dist-lib/esm/tools/builtin/BakeTexturesTool.d.ts +42 -0
  89. package/dist-lib/esm/tools/builtin/BakeTexturesTool.js +81 -0
  90. package/dist-lib/esm/tools/builtin/BooleanOperationTool.d.ts +51 -0
  91. package/dist-lib/esm/tools/builtin/BooleanOperationTool.js +86 -0
  92. package/dist-lib/esm/tools/builtin/BuildVoxelMeshTool.d.ts +78 -0
  93. package/dist-lib/esm/tools/builtin/BuildVoxelMeshTool.js +170 -0
  94. package/dist-lib/esm/tools/builtin/CloneArrayTool.d.ts +75 -0
  95. package/dist-lib/esm/tools/builtin/CloneArrayTool.js +115 -0
  96. package/dist-lib/esm/tools/builtin/CreateArchTool.d.ts +118 -0
  97. package/dist-lib/esm/tools/builtin/CreateArchTool.js +89 -0
  98. package/dist-lib/esm/tools/builtin/CreateColumnTool.d.ts +114 -0
  99. package/dist-lib/esm/tools/builtin/CreateColumnTool.js +105 -0
  100. package/dist-lib/esm/tools/builtin/CreateLatheTool.d.ts +87 -0
  101. package/dist-lib/esm/tools/builtin/CreateLatheTool.js +60 -0
  102. package/dist-lib/esm/tools/builtin/CreateMaterialTool.d.ts +114 -0
  103. package/dist-lib/esm/tools/builtin/CreateMaterialTool.js +212 -0
  104. package/dist-lib/esm/tools/builtin/CreateMoldingTool.d.ts +120 -0
  105. package/dist-lib/esm/tools/builtin/CreateMoldingTool.js +95 -0
  106. package/dist-lib/esm/tools/builtin/CreatePrimitiveTool.d.ts +162 -0
  107. package/dist-lib/esm/tools/builtin/CreatePrimitiveTool.js +302 -0
  108. package/dist-lib/esm/tools/builtin/CreateRoofTool.d.ts +120 -0
  109. package/dist-lib/esm/tools/builtin/CreateRoofTool.js +108 -0
  110. package/dist-lib/esm/tools/builtin/CreateRoundedBoxTool.d.ts +101 -0
  111. package/dist-lib/esm/tools/builtin/CreateRoundedBoxTool.js +79 -0
  112. package/dist-lib/esm/tools/builtin/CreateSdfMeshTool.d.ts +224 -0
  113. package/dist-lib/esm/tools/builtin/CreateSdfMeshTool.js +238 -0
  114. package/dist-lib/esm/tools/builtin/CreateStairsTool.d.ts +135 -0
  115. package/dist-lib/esm/tools/builtin/CreateStairsTool.js +119 -0
  116. package/dist-lib/esm/tools/builtin/CreateTextMeshTool.d.ts +94 -0
  117. package/dist-lib/esm/tools/builtin/CreateTextMeshTool.js +131 -0
  118. package/dist-lib/esm/tools/builtin/CreateTubeTool.d.ts +87 -0
  119. package/dist-lib/esm/tools/builtin/CreateTubeTool.js +59 -0
  120. package/dist-lib/esm/tools/builtin/CreateWallTool.d.ts +145 -0
  121. package/dist-lib/esm/tools/builtin/CreateWallTool.js +124 -0
  122. package/dist-lib/esm/tools/builtin/DecalTool.d.ts +76 -0
  123. package/dist-lib/esm/tools/builtin/DecalTool.js +143 -0
  124. package/dist-lib/esm/tools/builtin/DeleteMeshTool.d.ts +20 -0
  125. package/dist-lib/esm/tools/builtin/DeleteMeshTool.js +42 -0
  126. package/dist-lib/esm/tools/builtin/ExecuteBabylonCodeTool.d.ts +21 -0
  127. package/dist-lib/esm/tools/builtin/ExecuteBabylonCodeTool.js +96 -0
  128. package/dist-lib/esm/tools/builtin/ExtrudePolygonTool.d.ts +114 -0
  129. package/dist-lib/esm/tools/builtin/ExtrudePolygonTool.js +77 -0
  130. package/dist-lib/esm/tools/builtin/ExtrudeShapeTool.d.ts +104 -0
  131. package/dist-lib/esm/tools/builtin/ExtrudeShapeTool.js +68 -0
  132. package/dist-lib/esm/tools/builtin/FacetArcTool.d.ts +36 -0
  133. package/dist-lib/esm/tools/builtin/FacetArcTool.js +57 -0
  134. package/dist-lib/esm/tools/builtin/FacetCutThroughTool.d.ts +30 -0
  135. package/dist-lib/esm/tools/builtin/FacetCutThroughTool.js +49 -0
  136. package/dist-lib/esm/tools/builtin/FacetExtrudeTool.d.ts +30 -0
  137. package/dist-lib/esm/tools/builtin/FacetExtrudeTool.js +49 -0
  138. package/dist-lib/esm/tools/builtin/FacetInsetTool.d.ts +34 -0
  139. package/dist-lib/esm/tools/builtin/FacetInsetTool.js +55 -0
  140. package/dist-lib/esm/tools/builtin/GenerateNeuralMeshTool.d.ts +131 -0
  141. package/dist-lib/esm/tools/builtin/GenerateNeuralMeshTool.js +455 -0
  142. package/dist-lib/esm/tools/builtin/GenerateTextureTool.d.ts +87 -0
  143. package/dist-lib/esm/tools/builtin/GenerateTextureTool.js +216 -0
  144. package/dist-lib/esm/tools/builtin/GetSceneInfoTool.d.ts +11 -0
  145. package/dist-lib/esm/tools/builtin/GetSceneInfoTool.js +12 -0
  146. package/dist-lib/esm/tools/builtin/MergeMeshesTool.d.ts +28 -0
  147. package/dist-lib/esm/tools/builtin/MergeMeshesTool.js +56 -0
  148. package/dist-lib/esm/tools/builtin/PlanModelTool.d.ts +87 -0
  149. package/dist-lib/esm/tools/builtin/PlanModelTool.js +155 -0
  150. package/dist-lib/esm/tools/builtin/RetopologizeMeshTool.d.ts +50 -0
  151. package/dist-lib/esm/tools/builtin/RetopologizeMeshTool.js +116 -0
  152. package/dist-lib/esm/tools/builtin/RigWeightTool.d.ts +55 -0
  153. package/dist-lib/esm/tools/builtin/RigWeightTool.js +139 -0
  154. package/dist-lib/esm/tools/builtin/SculptMeshTool.d.ts +138 -0
  155. package/dist-lib/esm/tools/builtin/SculptMeshTool.js +255 -0
  156. package/dist-lib/esm/tools/builtin/SeparateMeshTool.d.ts +21 -0
  157. package/dist-lib/esm/tools/builtin/SeparateMeshTool.js +31 -0
  158. package/dist-lib/esm/tools/builtin/SolidifyMeshTool.d.ts +30 -0
  159. package/dist-lib/esm/tools/builtin/SolidifyMeshTool.js +57 -0
  160. package/dist-lib/esm/tools/builtin/SpawnBaseMeshTool.d.ts +66 -0
  161. package/dist-lib/esm/tools/builtin/SpawnBaseMeshTool.js +105 -0
  162. package/dist-lib/esm/tools/builtin/SubDSmoothTool.d.ts +23 -0
  163. package/dist-lib/esm/tools/builtin/SubDSmoothTool.js +37 -0
  164. package/dist-lib/esm/tools/builtin/SubdivideMeshTool.d.ts +23 -0
  165. package/dist-lib/esm/tools/builtin/SubdivideMeshTool.js +39 -0
  166. package/dist-lib/esm/tools/builtin/TransformMeshTool.d.ts +78 -0
  167. package/dist-lib/esm/tools/builtin/TransformMeshTool.js +69 -0
  168. package/dist-lib/esm/tools/builtin/UVUnwrapTool.d.ts +48 -0
  169. package/dist-lib/esm/tools/builtin/UVUnwrapTool.js +107 -0
  170. package/dist-lib/esm/tools/builtin/VoxelPainterTool.d.ts +60 -0
  171. package/dist-lib/esm/tools/builtin/VoxelPainterTool.js +153 -0
  172. package/dist-lib/esm/tools/builtin/index.d.ts +44 -0
  173. package/dist-lib/esm/tools/builtin/index.js +44 -0
  174. package/dist-lib/esm/tools/editor/AIAgentEditorTool.d.ts +18 -0
  175. package/dist-lib/esm/tools/editor/AIAgentEditorTool.js +43 -0
  176. package/dist-lib/esm/tools/editor/AITextureEditorTool.d.ts +15 -0
  177. package/dist-lib/esm/tools/editor/AITextureEditorTool.js +28 -0
  178. package/dist-lib/esm/tools/editor/AbstractEditorTool.d.ts +29 -0
  179. package/dist-lib/esm/tools/editor/AbstractEditorTool.js +56 -0
  180. package/dist-lib/esm/tools/editor/AnimationPlayerEditorTool.d.ts +17 -0
  181. package/dist-lib/esm/tools/editor/AnimationPlayerEditorTool.js +29 -0
  182. package/dist-lib/esm/tools/editor/BakingEditorTool.d.ts +21 -0
  183. package/dist-lib/esm/tools/editor/BakingEditorTool.js +44 -0
  184. package/dist-lib/esm/tools/editor/CSGEditorTool.d.ts +20 -0
  185. package/dist-lib/esm/tools/editor/CSGEditorTool.js +42 -0
  186. package/dist-lib/esm/tools/editor/CompressModelEditorTool.d.ts +20 -0
  187. package/dist-lib/esm/tools/editor/CompressModelEditorTool.js +48 -0
  188. package/dist-lib/esm/tools/editor/CreatePrimitiveEditorTool.d.ts +17 -0
  189. package/dist-lib/esm/tools/editor/CreatePrimitiveEditorTool.js +36 -0
  190. package/dist-lib/esm/tools/editor/DecalEditorTool.d.ts +17 -0
  191. package/dist-lib/esm/tools/editor/DecalEditorTool.js +36 -0
  192. package/dist-lib/esm/tools/editor/FacetEditorTool.d.ts +23 -0
  193. package/dist-lib/esm/tools/editor/FacetEditorTool.js +80 -0
  194. package/dist-lib/esm/tools/editor/MaterialEditorTool.d.ts +18 -0
  195. package/dist-lib/esm/tools/editor/MaterialEditorTool.js +43 -0
  196. package/dist-lib/esm/tools/editor/MeshPropertiesEditorTool.d.ts +17 -0
  197. package/dist-lib/esm/tools/editor/MeshPropertiesEditorTool.js +37 -0
  198. package/dist-lib/esm/tools/editor/OutlinerEditorTool.d.ts +17 -0
  199. package/dist-lib/esm/tools/editor/OutlinerEditorTool.js +34 -0
  200. package/dist-lib/esm/tools/editor/PathExtrusionEditorTool.d.ts +26 -0
  201. package/dist-lib/esm/tools/editor/PathExtrusionEditorTool.js +72 -0
  202. package/dist-lib/esm/tools/editor/RiggingEditorTool.d.ts +27 -0
  203. package/dist-lib/esm/tools/editor/RiggingEditorTool.js +66 -0
  204. package/dist-lib/esm/tools/editor/SceneEnvironmentEditorTool.d.ts +17 -0
  205. package/dist-lib/esm/tools/editor/SceneEnvironmentEditorTool.js +35 -0
  206. package/dist-lib/esm/tools/editor/SculptEditorTool.d.ts +28 -0
  207. package/dist-lib/esm/tools/editor/SculptEditorTool.js +70 -0
  208. package/dist-lib/esm/tools/editor/TextMeshEditorTool.d.ts +16 -0
  209. package/dist-lib/esm/tools/editor/TextMeshEditorTool.js +30 -0
  210. package/dist-lib/esm/tools/editor/TextureOptimizerEditorTool.d.ts +17 -0
  211. package/dist-lib/esm/tools/editor/TextureOptimizerEditorTool.js +28 -0
  212. package/dist-lib/esm/tools/editor/UVUnwrapEditorTool.d.ts +27 -0
  213. package/dist-lib/esm/tools/editor/UVUnwrapEditorTool.js +70 -0
  214. package/dist-lib/esm/tools/editor/VoxelPainterEditorTool.d.ts +26 -0
  215. package/dist-lib/esm/tools/editor/VoxelPainterEditorTool.js +68 -0
  216. package/dist-lib/esm/tools/editor/aiQuickPrompts.d.ts +30 -0
  217. package/dist-lib/esm/tools/editor/aiQuickPrompts.js +228 -0
  218. package/dist-lib/esm/tools/editor/index.d.ts +32 -0
  219. package/dist-lib/esm/tools/editor/index.js +54 -0
  220. package/dist-lib/esm/tools/editor/toolViews.d.ts +10 -0
  221. package/dist-lib/esm/tools/editor/toolViews.js +53 -0
  222. package/dist-lib/esm/tools/editorTools.d.ts +5 -0
  223. package/dist-lib/esm/tools/editorTools.js +5 -0
  224. package/dist-lib/esm/tools/index.d.ts +8 -0
  225. package/dist-lib/esm/tools/index.js +8 -0
  226. package/dist-lib/esm/tools/textureUtils.d.ts +18 -0
  227. package/dist-lib/esm/tools/textureUtils.js +288 -0
  228. package/dist-lib/esm/types.d.ts +164 -0
  229. package/dist-lib/esm/types.js +1 -0
  230. package/dist-lib/esm/uv/UVUnwrapController.d.ts +108 -0
  231. package/dist-lib/esm/uv/UVUnwrapController.js +1022 -0
  232. package/dist-lib/esm/voxel/CustomVoxelMesher.d.ts +15 -0
  233. package/dist-lib/esm/voxel/CustomVoxelMesher.js +169 -0
  234. package/dist-lib/esm/voxel/TextureAtlasManager.d.ts +54 -0
  235. package/dist-lib/esm/voxel/TextureAtlasManager.js +630 -0
  236. package/dist-lib/esm/voxel/VoxelPainterController.d.ts +100 -0
  237. package/dist-lib/esm/voxel/VoxelPainterController.js +671 -0
  238. package/dist-lib/esm/voxel/index.d.ts +4 -0
  239. package/dist-lib/esm/voxel/index.js +4 -0
  240. package/dist-lib/esm/voxel/types.d.ts +78 -0
  241. package/dist-lib/esm/voxel/types.js +1 -0
  242. package/dist-lib/esm/web-component/MeshEditorElement.d.ts +103 -0
  243. package/dist-lib/esm/web-component/MeshEditorElement.js +246 -0
  244. package/dist-lib/esm/web-component/index.d.ts +1 -0
  245. package/dist-lib/esm/web-component/index.js +1 -0
  246. package/dist-lib/index.umd.js +3 -0
  247. package/dist-lib/mesheditor.css +2 -0
  248. package/dist-lib/mesheditor.css.map +1 -0
  249. package/dist-lib/standalone/mesheditor-element.bundle.js +3 -0
  250. package/package.json +114 -4
  251. package/skills/README.md +48 -0
  252. package/skills/figure-sculptor.md +297 -0
  253. package/skills/image-to-mesh.md +18 -0
  254. package/skills/mesh-updater.md +27 -0
  255. package/skills/neural-3d-generator.md +53 -0
  256. package/skills/procedural-modeler.md +267 -0
  257. package/skills/voxel-painter.md +21 -0
  258. package/src/mesheditor.css +6477 -0
@@ -0,0 +1,250 @@
1
+ import { Scene } from '@babylonjs/core';
2
+ import type { MeshEditorApp } from './MeshEditorApp';
3
+ import type { MeshEditorService } from './MeshEditorService';
4
+ /**
5
+ * Definition for a dropdown menu item registered by a plugin.
6
+ * Used for extending the File, Actions, or Tools dropdown menus.
7
+ */
8
+ export interface MenuItemDefinition {
9
+ /**
10
+ * Unique identifier for the menu item DOM element.
11
+ * Example: 'menuFileCustomImport'
12
+ */
13
+ id: string;
14
+ /**
15
+ * Human-readable label displayed inside the dropdown item.
16
+ * Example: 'Asset Library...'
17
+ */
18
+ label: string;
19
+ /**
20
+ * Optional Lucide icon name (without prefix).
21
+ * Example: 'folder', 'save', 'library', 'sparkles', 'wrench'
22
+ */
23
+ icon?: string;
24
+ /**
25
+ * Optional keyboard shortcut badge displayed on the right edge of the item.
26
+ * Example: '⌘S', '⌥A', '⇧⌘G'
27
+ */
28
+ shortcut?: string;
29
+ /**
30
+ * If true, styles the item with a danger/red accent on hover.
31
+ * Suitable for destructive actions like delete or reset.
32
+ */
33
+ danger?: boolean;
34
+ /**
35
+ * Display ordering priority (lower numbers appear first).
36
+ * Defaults to appending at the end of the plugin section.
37
+ */
38
+ order?: number;
39
+ /**
40
+ * Callback invoked when the user clicks this menu item.
41
+ * Can be synchronous or asynchronous.
42
+ */
43
+ onClick: () => void | Promise<void>;
44
+ }
45
+ /**
46
+ * Definition for a top toolbar button registered by a plugin.
47
+ */
48
+ export interface ToolbarButtonDefinition {
49
+ /**
50
+ * Unique identifier for the toolbar button DOM element.
51
+ * Example: 'btnQuickAssetLibrary'
52
+ */
53
+ id: string;
54
+ /**
55
+ * Text label displayed alongside or inside the button.
56
+ */
57
+ label: string;
58
+ /**
59
+ * Optional Lucide icon name (without prefix).
60
+ * Example: 'library', 'download', 'upload'
61
+ */
62
+ icon?: string;
63
+ /**
64
+ * Optional tooltip text displayed on hover.
65
+ */
66
+ title?: string;
67
+ /**
68
+ * Optional additional CSS classes to style the button.
69
+ * Example: 'btn-primary', 'btn-export'
70
+ */
71
+ className?: string;
72
+ /**
73
+ * Callback invoked when the user clicks the toolbar button.
74
+ * Can be synchronous or asynchronous.
75
+ */
76
+ onClick: () => void | Promise<void>;
77
+ }
78
+ /**
79
+ * The execution context provided to a plugin during its `initialize()` lifecycle.
80
+ * Exposes editor APIs, menu hooks, scene interactions, and notification helpers
81
+ * without creating tight couplings to project-specific paths.
82
+ */
83
+ export interface MeshEditorPluginContext {
84
+ /**
85
+ * Reference to the UI application coordinator instance.
86
+ */
87
+ readonly app: MeshEditorApp;
88
+ /**
89
+ * Reference to the core 3D engine and editing service instance.
90
+ */
91
+ readonly service: MeshEditorService;
92
+ /**
93
+ * Registers an item into the File dropdown menu under the plugin section.
94
+ *
95
+ * @param item - The menu item definition with id, label, icon, shortcut, and onClick.
96
+ */
97
+ registerFileMenuItem(item: MenuItemDefinition): void;
98
+ /**
99
+ * Registers an item into the Actions dropdown menu under the plugin section.
100
+ *
101
+ * @param item - The menu item definition with id, label, icon, shortcut, and onClick.
102
+ */
103
+ registerActionMenuItem(item: MenuItemDefinition): void;
104
+ /**
105
+ * Registers an item into the Tools dropdown menu under the plugin section.
106
+ *
107
+ * @param item - The menu item definition with id, label, icon, shortcut, and onClick.
108
+ */
109
+ registerToolMenuItem(item: MenuItemDefinition): void;
110
+ /**
111
+ * Registers an item into the View dropdown menu under the plugin section.
112
+ *
113
+ * @param item - The menu item definition with id, label, icon, shortcut, and onClick.
114
+ */
115
+ registerViewMenuItem(item: MenuItemDefinition): void;
116
+ /**
117
+ * Registers a direct quick-access button into the top toolbar.
118
+ *
119
+ * @param button - The toolbar button definition with id, label, icon, and onClick.
120
+ */
121
+ registerToolbarButton(button: ToolbarButtonDefinition): void;
122
+ /**
123
+ * Displays an animated toast notification banner at the bottom-right of the viewport.
124
+ *
125
+ * @param message - The text message to display.
126
+ * @param type - Notification severity style: 'info' | 'success' | 'warning' | 'error'.
127
+ */
128
+ showToast(message: string, type?: 'info' | 'success' | 'warning' | 'error'): void;
129
+ /**
130
+ * Sets the status indicator message in the bottom status bar.
131
+ *
132
+ * @param message - Status text to display.
133
+ * @param isBusy - If true, pulses the status indicator dot to indicate background work.
134
+ */
135
+ setStatus(message: string, isBusy?: boolean): void;
136
+ /**
137
+ * Clears the current scene and loads a fresh 3D model into the editor.
138
+ * Supports URLs, File objects, Blobs, and ArrayBuffers (.glb, .gltf, .obj, .stl).
139
+ *
140
+ * @param source - File, Blob, ArrayBuffer, or URL string of the 3D model.
141
+ * @param name - Optional filename to assign to the loaded model.
142
+ */
143
+ openModel(source: File | Blob | ArrayBuffer | string, name?: string): Promise<void>;
144
+ /**
145
+ * Imports and appends a 3D model into the active scene without clearing existing meshes.
146
+ *
147
+ * @param source - File, Blob, ArrayBuffer, or URL string of the 3D model.
148
+ * @param name - Optional filename to assign to the imported model.
149
+ */
150
+ importModel(source: File | Blob | ArrayBuffer | string, name?: string): Promise<void>;
151
+ /**
152
+ * Exports the entire scene (or current model) to a binary glTF (.glb) Blob.
153
+ *
154
+ * @param filename - Optional export filename (e.g. 'custom_model.glb').
155
+ * @returns A Promise resolving to the binary GLB Blob.
156
+ */
157
+ exportGLB(filename?: string): Promise<Blob>;
158
+ /**
159
+ * Gets the active filename of the currently opened model.
160
+ *
161
+ * @returns Current filename string (e.g. 'hero.glb').
162
+ */
163
+ getCurrentFilename(): string;
164
+ /**
165
+ * Sets or updates the active model filename in the editor.
166
+ *
167
+ * @param name - New filename string.
168
+ */
169
+ setCurrentFilename(name: string): void;
170
+ /**
171
+ * Returns the underlying BabylonJS Scene instance for advanced custom rendering.
172
+ *
173
+ * @returns The active BabylonJS Scene.
174
+ */
175
+ getScene(): Scene;
176
+ }
177
+ /**
178
+ * Interface that all MeshEditor plugins must implement.
179
+ *
180
+ * Plugins are modular extensions that can inject custom menus, modals,
181
+ * project-specific asset integrations, or custom tools into the editor.
182
+ */
183
+ export interface MeshEditorPlugin {
184
+ /**
185
+ * Unique identifier for the plugin (namespaced reverse-domain style recommended).
186
+ * Example: 'myorg-model-importer', 'myorg-sketchfab-importer'
187
+ */
188
+ readonly id: string;
189
+ /**
190
+ * Human-readable display name for the plugin.
191
+ * Example: 'Game Asset Library'
192
+ */
193
+ readonly name: string;
194
+ /**
195
+ * Optional semantic version string.
196
+ * Example: '1.0.0'
197
+ */
198
+ readonly version?: string;
199
+ /**
200
+ * Optional brief description of what the plugin does.
201
+ */
202
+ readonly description?: string;
203
+ /**
204
+ * Lifecycle method called once when the plugin is registered with `MeshEditorApp.use()`.
205
+ *
206
+ * @param context - The plugin execution context exposing UI and service hooks.
207
+ */
208
+ initialize(context: MeshEditorPluginContext): void | Promise<void>;
209
+ /**
210
+ * Optional teardown lifecycle method called when the plugin is unregistered or the editor is destroyed.
211
+ * Clean up event listeners, modals, or injected DOM elements here.
212
+ */
213
+ dispose?(): void;
214
+ }
215
+ /**
216
+ * Manages plugin lifecycle, registration, extension registry, and execution contexts.
217
+ */
218
+ export declare class PluginManager {
219
+ private plugins;
220
+ private app;
221
+ private service;
222
+ constructor(app: MeshEditorApp, service: MeshEditorService);
223
+ /**
224
+ * Registers and initializes a plugin with the editor.
225
+ *
226
+ * @param plugin - The plugin instance to register.
227
+ */
228
+ register(plugin: MeshEditorPlugin): Promise<void>;
229
+ /**
230
+ * Unregisters and disposes a plugin by its unique ID.
231
+ *
232
+ * @param pluginId - The unique ID of the plugin to remove.
233
+ */
234
+ unregister(pluginId: string): void;
235
+ /**
236
+ * Retrieves a registered plugin by its ID.
237
+ *
238
+ * @param pluginId - The plugin ID to look up.
239
+ * @returns The plugin instance or undefined if not registered.
240
+ */
241
+ getPlugin(pluginId: string): MeshEditorPlugin | undefined;
242
+ /**
243
+ * Returns an array of all currently registered plugins.
244
+ */
245
+ getAllPlugins(): MeshEditorPlugin[];
246
+ /**
247
+ * Creates the specialized plugin context for a given plugin instance.
248
+ */
249
+ private createContext;
250
+ }
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Manages plugin lifecycle, registration, extension registry, and execution contexts.
3
+ */
4
+ export class PluginManager {
5
+ plugins = new Map();
6
+ app;
7
+ service;
8
+ constructor(app, service) {
9
+ this.app = app;
10
+ this.service = service;
11
+ }
12
+ /**
13
+ * Registers and initializes a plugin with the editor.
14
+ *
15
+ * @param plugin - The plugin instance to register.
16
+ */
17
+ async register(plugin) {
18
+ if (this.plugins.has(plugin.id)) {
19
+ console.warn(`[PluginManager] Plugin with id "${plugin.id}" is already registered. Skipping.`);
20
+ return;
21
+ }
22
+ const context = this.createContext(plugin);
23
+ try {
24
+ await plugin.initialize(context);
25
+ this.plugins.set(plugin.id, plugin);
26
+ console.log(`[PluginManager] Plugin "${plugin.name}" (${plugin.id}) registered successfully.`);
27
+ }
28
+ catch (err) {
29
+ console.error(`[PluginManager] Failed to initialize plugin "${plugin.name}" (${plugin.id}):`, err);
30
+ throw err;
31
+ }
32
+ }
33
+ /**
34
+ * Unregisters and disposes a plugin by its unique ID.
35
+ *
36
+ * @param pluginId - The unique ID of the plugin to remove.
37
+ */
38
+ unregister(pluginId) {
39
+ const plugin = this.plugins.get(pluginId);
40
+ if (!plugin)
41
+ return;
42
+ if (plugin.dispose) {
43
+ try {
44
+ plugin.dispose();
45
+ }
46
+ catch (err) {
47
+ console.error(`[PluginManager] Error disposing plugin "${plugin.name}":`, err);
48
+ }
49
+ }
50
+ this.plugins.delete(pluginId);
51
+ console.log(`[PluginManager] Plugin "${plugin.name}" (${pluginId}) unregistered.`);
52
+ }
53
+ /**
54
+ * Retrieves a registered plugin by its ID.
55
+ *
56
+ * @param pluginId - The plugin ID to look up.
57
+ * @returns The plugin instance or undefined if not registered.
58
+ */
59
+ getPlugin(pluginId) {
60
+ return this.plugins.get(pluginId);
61
+ }
62
+ /**
63
+ * Returns an array of all currently registered plugins.
64
+ */
65
+ getAllPlugins() {
66
+ return Array.from(this.plugins.values());
67
+ }
68
+ /**
69
+ * Creates the specialized plugin context for a given plugin instance.
70
+ */
71
+ createContext(plugin) {
72
+ return {
73
+ app: this.app,
74
+ service: this.service,
75
+ registerFileMenuItem: (item) => {
76
+ this.app.registerFileMenuItem(item);
77
+ },
78
+ registerActionMenuItem: (item) => {
79
+ this.app.registerActionMenuItem(item);
80
+ },
81
+ registerToolMenuItem: (item) => {
82
+ this.app.registerToolMenuItem(item);
83
+ },
84
+ registerViewMenuItem: (item) => {
85
+ this.app.registerViewMenuItem(item);
86
+ },
87
+ registerToolbarButton: (button) => {
88
+ this.app.registerToolbarButton(button);
89
+ },
90
+ showToast: (message, type) => {
91
+ this.app.showToast(message, type);
92
+ },
93
+ setStatus: (message, isBusy) => {
94
+ this.app.setStatus(message, isBusy);
95
+ },
96
+ openModel: async (source, name) => {
97
+ if (typeof source === 'string') {
98
+ await this.service.loadFromUrl(source, name);
99
+ }
100
+ else if (source instanceof File) {
101
+ await this.service.loadFile(source);
102
+ }
103
+ else if (source instanceof Blob) {
104
+ const file = new File([source], name || 'model.glb');
105
+ await this.service.loadFile(file);
106
+ }
107
+ else if (source instanceof ArrayBuffer) {
108
+ const blob = new Blob([source]);
109
+ const file = new File([blob], name || 'model.glb');
110
+ await this.service.loadFile(file);
111
+ }
112
+ },
113
+ importModel: async (source, name) => {
114
+ if (typeof source === 'string') {
115
+ await this.service.importFromUrl(source, name);
116
+ }
117
+ else if (source instanceof File) {
118
+ await this.service.importFile(source);
119
+ }
120
+ else if (source instanceof Blob) {
121
+ const file = new File([source], name || 'model.glb');
122
+ await this.service.importFile(file);
123
+ }
124
+ else if (source instanceof ArrayBuffer) {
125
+ const blob = new Blob([source]);
126
+ const file = new File([blob], name || 'model.glb');
127
+ await this.service.importFile(file);
128
+ }
129
+ },
130
+ exportGLB: async (filename) => {
131
+ return await this.service.exportToGLBBlob(filename);
132
+ },
133
+ getCurrentFilename: () => {
134
+ return this.service.currentFilename;
135
+ },
136
+ setCurrentFilename: (name) => {
137
+ this.service.currentFilename = name;
138
+ },
139
+ getScene: () => {
140
+ return this.service.getScene();
141
+ },
142
+ };
143
+ }
144
+ }
@@ -0,0 +1,162 @@
1
+ import { FloatArray, LinesMesh, Mesh, Nullable, Scene, Skeleton, StandardMaterial, Vector3 } from '@babylonjs/core';
2
+ import { MeshEditorService } from '../MeshEditorService';
3
+ export type WeightBrushMode = 'add' | 'subtract' | 'smooth' | 'replace';
4
+ export type AutoRigPreset = 'humanoid' | 'chibi' | 'quadruped' | 'spine_chain';
5
+ export interface BoneNodeSpec {
6
+ name: string;
7
+ parentIndex: number;
8
+ headWorldPos: Vector3;
9
+ tailWorldPos: Vector3;
10
+ }
11
+ export interface WeightStats {
12
+ meshName: string;
13
+ hasSkeleton: boolean;
14
+ boneCount: number;
15
+ activeBoneName: string;
16
+ activeBoneIndex: number;
17
+ influencedVertexCount: number;
18
+ averageActiveWeight: number;
19
+ }
20
+ /**
21
+ * Controller for Skeleton Auto-Rigging, Envelope Skinning, Interactive 3D Weight Painting,
22
+ * Weight Heatmap Visualization, and Real-Time Bone Pose Testing.
23
+ */
24
+ export declare class WeightPaintController {
25
+ service: MeshEditorService;
26
+ scene: Scene;
27
+ isActive: boolean;
28
+ brushMode: WeightBrushMode;
29
+ radius: number;
30
+ strength: number;
31
+ targetWeight: number;
32
+ symmetryX: boolean;
33
+ showHeatmap: boolean;
34
+ showBoneOverlay: boolean;
35
+ activeBoneIndex: number;
36
+ private isPainting;
37
+ private activeMesh;
38
+ private strokePreStates;
39
+ private cursorRing;
40
+ boneOverlayMesh: Nullable<LinesMesh>;
41
+ activeBoneMarker: Nullable<Mesh>;
42
+ private originalColorsMap;
43
+ private originalVertexColorFlag;
44
+ private originalMaterialMap;
45
+ private heatmapMaterial;
46
+ onStateChanged?: (isActive: boolean) => void;
47
+ onWeightsModified?: (mesh: Mesh, stats: WeightStats) => void;
48
+ constructor(service: MeshEditorService);
49
+ private initCursor;
50
+ setRadius(newRadius: number): void;
51
+ setStrength(newStrength: number): void;
52
+ setBrushMode(mode: WeightBrushMode): void;
53
+ setActiveBoneIndex(index: number): void;
54
+ setActive(active: boolean): void;
55
+ getActiveTargetMesh(): Nullable<Mesh>;
56
+ /**
57
+ * Returns all meshes in the scene that share the same skeleton or character group as `primaryMesh`.
58
+ * Essential for multi-part models (e.g. Mario cap, head, body, hands, boots) so heatmaps,
59
+ * bone influence stats, and weight painting operate simultaneously across the entire character!
60
+ */
61
+ getTargetMeshes(primaryMesh?: Nullable<Mesh>): Mesh[];
62
+ /**
63
+ * Generates a complete hierarchical game-ready Skeleton fitted to `mesh`'s bounding box
64
+ * and binds smooth capsule envelope weights (4 bone influences per vertex).
65
+ */
66
+ createAutoRig(mesh: Mesh, preset?: AutoRigPreset): Skeleton;
67
+ /**
68
+ * Computes automatic smooth envelope skin weights (4 influences per vertex, normalized to 1.0)
69
+ * across all target meshes sharing `mesh`'s character skeleton.
70
+ */
71
+ autoBindSkinWeights(mesh: Mesh, skeleton?: Nullable<Skeleton>): void;
72
+ /**
73
+ * Binds skin weights to an individual mesh based on distance from world-space vertices
74
+ * to bone capsule segments.
75
+ */
76
+ bindSingleMeshSkinWeights(mesh: Mesh, skeleton?: Nullable<Skeleton>): void;
77
+ getBoneSegments(mesh: Mesh, skeleton?: Nullable<Skeleton>): BoneNodeSpec[];
78
+ private distancePointToSegment;
79
+ /**
80
+ * Returns the effective weight [0, 1] of `boneIndex` at vertex `vertexIndex`.
81
+ */
82
+ getVertexBoneWeight(indicesData: FloatArray, weightsData: FloatArray, vertexIndex: number, boneIndex: number): number;
83
+ /**
84
+ * Sets the weight of `boneIndex` on vertex `vertexIndex` to `newWeight` and automatically
85
+ * normalizes all 4 bone weights on that vertex so their sum equals 1.0.
86
+ */
87
+ setVertexBoneWeightNormalized(indicesData: Float32Array | number[], weightsData: Float32Array | number[], vertexIndex: number, boneIndex: number, newWeight: number): void;
88
+ /**
89
+ * Applies a 3D Weight Paint brush stroke (Add, Subtract, Smooth, or Replace) at `worldHitPoint`.
90
+ * Automatically targets all parts of the character sharing the skeleton so painting seamlessly
91
+ * deforms vertices across mesh seams without borders.
92
+ */
93
+ applyWeightBrushStroke(mesh: Mesh, worldHitPoint: Vector3, boneIndex?: number): number;
94
+ private paintSingleMesh;
95
+ getOrCreateHeatmapMaterial(targetScene?: Scene): StandardMaterial;
96
+ /**
97
+ * Updates the real-time Vertex Color Weight Heatmap (Blue 0.0 -> Cyan -> Green -> Yellow -> Red 1.0)
98
+ * on all target meshes for `activeBoneIndex`.
99
+ */
100
+ updateWeightHeatmap(mesh?: Mesh, boneIndex?: number): void;
101
+ private updateSingleMeshHeatmap;
102
+ restoreOriginalVertexColors(mesh?: Mesh): void;
103
+ private restoreSingleMeshVertexColors;
104
+ private weightToHeatmapRGB;
105
+ /**
106
+ * Rotates the active bone (and its descendant bone chain) by `(pitchDeg, yawDeg, rollDeg)` and
107
+ * deforms all target character meshes using Linear Blend Skinning (LBS) so the artist can test joint deformation!
108
+ */
109
+ poseActiveBone(mesh: Mesh, pitchDeg: number, yawDeg?: number, rollDeg?: number): void;
110
+ private poseSingleMeshActiveBone;
111
+ /**
112
+ * Restores all target character meshes back to clean Bind Pose (T-Pose / rest pose).
113
+ */
114
+ resetBindPose(mesh: Mesh): void;
115
+ private resetSingleMeshBindPose;
116
+ /**
117
+ * Dynamically adjusts the heights of the arms/shoulders and hips/legs across the skeleton
118
+ * and automatically re-binds envelope skin weights so the rig matches any stylized character!
119
+ */
120
+ adjustBoneHeights(mesh: Mesh, armRatio: number, hipRatio: number): void;
121
+ /**
122
+ * Nudges the active joint/bone position by a world delta vector and recalculates weights.
123
+ */
124
+ nudgeActiveBone(mesh: Mesh, delta: Vector3): void;
125
+ /**
126
+ * Synchronizes bone local matrices and linked TransformNodes with updated specs.
127
+ */
128
+ syncBonesWithSpecs(mesh: Mesh, customSpecs?: BoneNodeSpec[]): void;
129
+ /**
130
+ * Ensures every bone in skeleton has a linked TransformNode so GLTF2Export writes out skins & joints.
131
+ */
132
+ ensureSkeletonLinkedTransformNodes(skeleton: Skeleton, mesh: Mesh): void;
133
+ /**
134
+ * Prepares all meshes in the scene for clean GLTF/GLB/OBJ export by restoring
135
+ * original materials, removing temporary weight heatmap vertex colors,
136
+ * resetting pose tests, and ensuring all bones have linked transform nodes.
137
+ */
138
+ prepareMeshesForExport(): void;
139
+ /**
140
+ * Sets MatricesIndicesKind as an UNSIGNED_BYTE (or UNSIGNED_SHORT) vertex buffer.
141
+ * Standard glTF requires integer types (UNSIGNED_BYTE / UNSIGNED_SHORT) for JOINTS_0.
142
+ * If stored as floats in Babylon, the glTF serializer converts the buffer to bytes but
143
+ * incorrectly computes submesh accessor byteOffsets using the float byteStride (16),
144
+ * causing bufferView overflow and corrupt GLB files!
145
+ */
146
+ setMeshMatrixIndices(mesh: Mesh, indices: ArrayLike<number>): void;
147
+ /**
148
+ * Re-activates the weight heatmap and bone overlay after an export completes.
149
+ */
150
+ restoreMeshesAfterExport(): void;
151
+ /**
152
+ * Renders a 3D bone wireframe overlay and active joint sphere in the viewport.
153
+ */
154
+ refreshBoneOverlay(mesh: Mesh): void;
155
+ clearBoneOverlay(): void;
156
+ analyzeWeights(primaryMesh?: Nullable<Mesh>): WeightStats;
157
+ private initPointerHandling;
158
+ private handlePointerDown;
159
+ private handlePointerMove;
160
+ private endPaintStroke;
161
+ dispose(): void;
162
+ }