@nice2dev/ui-3d 1.3.14 → 1.3.16

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 (108) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/collaborative/collaborativeScene.js +160 -206
  3. package/dist/cjs/core/editorAsk.js +51 -41
  4. package/dist/cjs/core/i18n.js +13 -14
  5. package/dist/cjs/core/threeCompat.js +29 -42
  6. package/dist/cjs/dance/DanceBridge.js +148 -177
  7. package/dist/cjs/dance/DanceScoreEngine.js +209 -221
  8. package/dist/cjs/dance/PoseDetector.js +302 -275
  9. package/dist/cjs/index.js +110 -113
  10. package/dist/cjs/material/MaterialEditor.module.css.js +242 -5
  11. package/dist/cjs/material/NiceMaterialEditor.js +1213 -757
  12. package/dist/cjs/material/materialEditorTypes.js +35 -49
  13. package/dist/cjs/material/materialEditorUtils.js +684 -747
  14. package/dist/cjs/material/materialNodeDefinitions.js +1411 -1459
  15. package/dist/cjs/model/ModelEditor.js +90 -40
  16. package/dist/cjs/model/ModelEditor.module.css.js +257 -5
  17. package/dist/cjs/model/ModelEditorLeftPanel.js +126 -47
  18. package/dist/cjs/model/ModelEditorMenuBar.js +359 -32
  19. package/dist/cjs/model/ModelEditorRightPanel.js +647 -131
  20. package/dist/cjs/model/ModelEditorSubComponents.js +277 -112
  21. package/dist/cjs/model/ModelEditorTimeline.js +232 -34
  22. package/dist/cjs/model/ModelEditorToolbar.js +170 -14
  23. package/dist/cjs/model/ModelEditorViewport.js +231 -39
  24. package/dist/cjs/model/ModelViewer.js +388 -63
  25. package/dist/cjs/model/ModelViewer.module.css.js +77 -5
  26. package/dist/cjs/model/NiceArmatureEditor.js +473 -274
  27. package/dist/cjs/model/NiceMorphTargetEditor.js +333 -227
  28. package/dist/cjs/model/NiceOctree.js +372 -320
  29. package/dist/cjs/model/NicePhysicsSimulation.js +528 -298
  30. package/dist/cjs/model/NiceProceduralGeometry.js +673 -300
  31. package/dist/cjs/model/NiceTerrainEditor.js +595 -385
  32. package/dist/cjs/model/NiceWeightPainter.js +384 -261
  33. package/dist/cjs/model/NiceXRPreview.js +385 -308
  34. package/dist/cjs/model/cadModeUtils.js +103 -106
  35. package/dist/cjs/model/editorShortcuts.js +171 -194
  36. package/dist/cjs/model/modelEditorTypes.js +100 -118
  37. package/dist/cjs/model/modelEditorUtils.js +1061 -1146
  38. package/dist/cjs/model/simsModeUtils.js +1023 -1053
  39. package/dist/cjs/model/useModelEditor.js +1977 -1933
  40. package/dist/cjs/model/useModelViewer.js +633 -665
  41. package/dist/cjs/nice2dev-ui-3d.css +1 -1
  42. package/dist/cjs/particle/NiceParticleEditor.js +1186 -571
  43. package/dist/cjs/particle/ParticleEditor.module.css.js +122 -5
  44. package/dist/cjs/particle/particleEditorTypes.js +62 -70
  45. package/dist/cjs/particle/particleEditorUtils.js +998 -1013
  46. package/dist/cjs/rendering/NiceCascadedShadows.js +381 -259
  47. package/dist/cjs/rendering/NiceRenderExport.js +424 -337
  48. package/dist/cjs/rendering/NiceSSAO.js +454 -337
  49. package/dist/cjs/rendering/NiceSSR.js +387 -261
  50. package/dist/cjs/rendering/NiceWebGPURenderer.js +359 -230
  51. package/dist/cjs/uv/NiceUVEditor.js +787 -550
  52. package/dist/cjs/uv/UVEditor.module.css.js +53 -5
  53. package/dist/cjs/uv/uvEditorTypes.js +59 -76
  54. package/dist/cjs/uv/uvEditorUtils.js +501 -575
  55. package/dist/esm/collaborative/collaborativeScene.js +163 -205
  56. package/dist/esm/core/editorAsk.js +53 -40
  57. package/dist/esm/core/i18n.js +15 -13
  58. package/dist/esm/core/threeCompat.js +18 -26
  59. package/dist/esm/dance/DanceBridge.js +151 -176
  60. package/dist/esm/dance/DanceScoreEngine.js +211 -220
  61. package/dist/esm/dance/PoseDetector.js +304 -274
  62. package/dist/esm/index.js +258 -36
  63. package/dist/esm/material/MaterialEditor.module.css.js +242 -3
  64. package/dist/esm/material/NiceMaterialEditor.js +1215 -756
  65. package/dist/esm/material/materialEditorTypes.js +45 -48
  66. package/dist/esm/material/materialEditorUtils.js +713 -746
  67. package/dist/esm/material/materialNodeDefinitions.js +1415 -1458
  68. package/dist/esm/model/ModelEditor.js +91 -39
  69. package/dist/esm/model/ModelEditor.module.css.js +257 -3
  70. package/dist/esm/model/ModelEditorLeftPanel.js +126 -45
  71. package/dist/esm/model/ModelEditorMenuBar.js +359 -30
  72. package/dist/esm/model/ModelEditorRightPanel.js +634 -114
  73. package/dist/esm/model/ModelEditorSubComponents.js +265 -94
  74. package/dist/esm/model/ModelEditorTimeline.js +232 -32
  75. package/dist/esm/model/ModelEditorToolbar.js +170 -12
  76. package/dist/esm/model/ModelEditorViewport.js +231 -37
  77. package/dist/esm/model/ModelViewer.js +389 -62
  78. package/dist/esm/model/ModelViewer.module.css.js +77 -3
  79. package/dist/esm/model/NiceArmatureEditor.js +462 -258
  80. package/dist/esm/model/NiceMorphTargetEditor.js +322 -211
  81. package/dist/esm/model/NiceOctree.js +361 -304
  82. package/dist/esm/model/NicePhysicsSimulation.js +517 -282
  83. package/dist/esm/model/NiceProceduralGeometry.js +667 -284
  84. package/dist/esm/model/NiceTerrainEditor.js +584 -369
  85. package/dist/esm/model/NiceWeightPainter.js +373 -245
  86. package/dist/esm/model/NiceXRPreview.js +374 -292
  87. package/dist/esm/model/cadModeUtils.js +95 -88
  88. package/dist/esm/model/editorShortcuts.js +172 -193
  89. package/dist/esm/model/modelEditorTypes.js +90 -100
  90. package/dist/esm/model/modelEditorUtils.js +1056 -1128
  91. package/dist/esm/model/simsModeUtils.js +1021 -1035
  92. package/dist/esm/model/useModelEditor.js +1946 -1920
  93. package/dist/esm/model/useModelViewer.js +619 -647
  94. package/dist/esm/nice2dev-ui-3d.css +1 -1
  95. package/dist/esm/particle/NiceParticleEditor.js +1188 -570
  96. package/dist/esm/particle/ParticleEditor.module.css.js +122 -3
  97. package/dist/esm/particle/particleEditorTypes.js +69 -69
  98. package/dist/esm/particle/particleEditorUtils.js +1027 -1012
  99. package/dist/esm/rendering/NiceCascadedShadows.js +370 -243
  100. package/dist/esm/rendering/NiceRenderExport.js +413 -321
  101. package/dist/esm/rendering/NiceSSAO.js +450 -328
  102. package/dist/esm/rendering/NiceSSR.js +383 -252
  103. package/dist/esm/rendering/NiceWebGPURenderer.js +326 -214
  104. package/dist/esm/uv/NiceUVEditor.js +788 -549
  105. package/dist/esm/uv/UVEditor.module.css.js +53 -3
  106. package/dist/esm/uv/uvEditorTypes.js +68 -75
  107. package/dist/esm/uv/uvEditorUtils.js +515 -557
  108. package/package.json +7 -12
@@ -1,134 +1,116 @@
1
- 'use strict';
2
-
3
- var THREE = require('three');
4
-
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const THREE = require("three");
5
4
  function _interopNamespaceDefault(e) {
6
- var n = Object.create(null);
7
- if (e) {
8
- Object.keys(e).forEach(function (k) {
9
- if (k !== 'default') {
10
- var d = Object.getOwnPropertyDescriptor(e, k);
11
- Object.defineProperty(n, k, d.get ? d : {
12
- enumerable: true,
13
- get: function () { return e[k]; }
14
- });
15
- }
16
- });
17
- }
18
- n.default = e;
19
- return Object.freeze(n);
5
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
6
+ if (e) {
7
+ for (const k in e) {
8
+ if (k !== "default") {
9
+ const d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: () => e[k]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ n.default = e;
18
+ return Object.freeze(n);
20
19
  }
21
-
22
- var THREE__namespace = /*#__PURE__*/_interopNamespaceDefault(THREE);
23
-
24
- /**
25
- * Shared types, constants, and helpers for the ModelEditor.
26
- */
27
- /* ═══════════════════════════════════════════
28
- Constants & helpers
29
- ═══════════════════════════════════════════ */
20
+ const THREE__namespace = /* @__PURE__ */ _interopNamespaceDefault(THREE);
30
21
  const DEG = 180 / Math.PI;
31
22
  const fmtTime = (s) => {
32
- const m = Math.floor(s / 60);
33
- const sec = (s % 60).toFixed(2);
34
- return `${m}:${sec.padStart(5, '0')}`;
23
+ const m = Math.floor(s / 60);
24
+ const sec = (s % 60).toFixed(2);
25
+ return `${m}:${sec.padStart(5, "0")}`;
35
26
  };
36
27
  const SUPPORTED_EXTENSIONS = [
37
- '.fbx',
38
- '.glb',
39
- '.gltf',
40
- '.obj',
41
- '.mtl',
42
- '.dae',
43
- '.stl',
44
- '.ply',
45
- '.3ds',
46
- '.3mf',
47
- '.amf',
48
- '.pcd',
49
- '.vtk',
50
- '.vtp',
51
- '.wrl',
52
- '.vrml',
53
- '.gcode',
54
- '.svg',
55
- '.usdz',
56
- // CAD formats
57
- '.dxf',
58
- '.dwg',
59
- '.ifc',
60
- '.step',
61
- '.stp',
62
- '.iges',
63
- '.igs',
64
- '.sat',
65
- '.brep',
66
- '.3dm',
28
+ ".fbx",
29
+ ".glb",
30
+ ".gltf",
31
+ ".obj",
32
+ ".mtl",
33
+ ".dae",
34
+ ".stl",
35
+ ".ply",
36
+ ".3ds",
37
+ ".3mf",
38
+ ".amf",
39
+ ".pcd",
40
+ ".vtk",
41
+ ".vtp",
42
+ ".wrl",
43
+ ".vrml",
44
+ ".gcode",
45
+ ".svg",
46
+ ".usdz",
47
+ // CAD formats
48
+ ".dxf",
49
+ ".dwg",
50
+ ".ifc",
51
+ ".step",
52
+ ".stp",
53
+ ".iges",
54
+ ".igs",
55
+ ".sat",
56
+ ".brep",
57
+ ".3dm"
67
58
  ];
68
- /* ═══════════════════════════════════════════
69
- AI helpers — convert pose3D to AnimationClip
70
- ═══════════════════════════════════════════ */
71
- /** Standard bone names mapping from pose keypoints */
72
59
  const POSE_TO_BONE = {
73
- nose: 'Head',
74
- left_eye: 'Head',
75
- right_eye: 'Head',
76
- left_ear: 'Head',
77
- right_ear: 'Head',
78
- left_shoulder: 'LeftArm',
79
- right_shoulder: 'RightArm',
80
- left_elbow: 'LeftForeArm',
81
- right_elbow: 'RightForeArm',
82
- left_wrist: 'LeftHand',
83
- right_wrist: 'RightHand',
84
- left_hip: 'LeftUpLeg',
85
- right_hip: 'RightUpLeg',
86
- left_knee: 'LeftLeg',
87
- right_knee: 'RightLeg',
88
- left_ankle: 'LeftFoot',
89
- right_ankle: 'RightFoot',
60
+ nose: "Head",
61
+ left_eye: "Head",
62
+ right_eye: "Head",
63
+ left_ear: "Head",
64
+ right_ear: "Head",
65
+ left_shoulder: "LeftArm",
66
+ right_shoulder: "RightArm",
67
+ left_elbow: "LeftForeArm",
68
+ right_elbow: "RightForeArm",
69
+ left_wrist: "LeftHand",
70
+ right_wrist: "RightHand",
71
+ left_hip: "LeftUpLeg",
72
+ right_hip: "RightUpLeg",
73
+ left_knee: "LeftLeg",
74
+ right_knee: "RightLeg",
75
+ left_ankle: "LeftFoot",
76
+ right_ankle: "RightFoot"
90
77
  };
91
78
  function pose3dToClip(result) {
92
- var _a, _b, _c;
93
- if (!result.frames || result.frames.length === 0) {
94
- return null;
95
- }
96
- const fps = result.fps || 30;
97
- const tracks = [];
98
- // Group keypoints by bone across all frames
99
- const boneData = new Map();
100
- for (const frame of result.frames) {
101
- const t = (_a = frame.timestamp_sec) !== null && _a !== void 0 ? _a : frame.frame_index / fps;
102
- // Take first person
103
- const person = (_b = frame.persons) === null || _b === void 0 ? void 0 : _b[0];
104
- if (!person) {
105
- continue;
106
- }
107
- for (const kp of person.keypoints) {
108
- const boneName = POSE_TO_BONE[kp.name];
109
- if (!boneName) {
110
- continue;
111
- }
112
- let data = boneData.get(boneName);
113
- if (!data) {
114
- data = { times: [], positions: [] };
115
- boneData.set(boneName, data);
116
- }
117
- data.times.push(t);
118
- // Scale pose coordinates to reasonable 3D space
119
- data.positions.push(kp.x * 0.01, kp.y * 0.01, kp.z * 0.01);
120
- }
121
- }
122
- for (const [boneName, data] of boneData) {
123
- tracks.push(new THREE__namespace.VectorKeyframeTrack(`${boneName}.position`, data.times, data.positions));
79
+ if (!result.frames || result.frames.length === 0) {
80
+ return null;
81
+ }
82
+ const fps = result.fps || 30;
83
+ const tracks = [];
84
+ const boneData = /* @__PURE__ */ new Map();
85
+ for (const frame of result.frames) {
86
+ const t = frame.timestamp_sec ?? frame.frame_index / fps;
87
+ const person = frame.persons?.[0];
88
+ if (!person) {
89
+ continue;
124
90
  }
125
- if (tracks.length === 0) {
126
- return null;
91
+ for (const kp of person.keypoints) {
92
+ const boneName = POSE_TO_BONE[kp.name];
93
+ if (!boneName) {
94
+ continue;
95
+ }
96
+ let data = boneData.get(boneName);
97
+ if (!data) {
98
+ data = { times: [], positions: [] };
99
+ boneData.set(boneName, data);
100
+ }
101
+ data.times.push(t);
102
+ data.positions.push(kp.x * 0.01, kp.y * 0.01, kp.z * 0.01);
127
103
  }
128
- const duration = (_c = result.frames[result.frames.length - 1].timestamp_sec) !== null && _c !== void 0 ? _c : result.frame_count / fps;
129
- return new THREE__namespace.AnimationClip('AI_Pose', duration, tracks);
104
+ }
105
+ for (const [boneName, data] of boneData) {
106
+ tracks.push(new THREE__namespace.VectorKeyframeTrack(`${boneName}.position`, data.times, data.positions));
107
+ }
108
+ if (tracks.length === 0) {
109
+ return null;
110
+ }
111
+ const duration = result.frames[result.frames.length - 1].timestamp_sec ?? result.frame_count / fps;
112
+ return new THREE__namespace.AnimationClip("AI_Pose", duration, tracks);
130
113
  }
131
-
132
114
  exports.DEG = DEG;
133
115
  exports.POSE_TO_BONE = POSE_TO_BONE;
134
116
  exports.SUPPORTED_EXTENSIONS = SUPPORTED_EXTENSIONS;