@nice2dev/ui-3d 1.3.15 → 1.3.17
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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/collaborative/collaborativeScene.js +160 -206
- package/dist/cjs/core/editorAsk.js +51 -41
- package/dist/cjs/core/i18n.js +13 -14
- package/dist/cjs/core/threeCompat.js +29 -42
- package/dist/cjs/dance/DanceBridge.js +148 -177
- package/dist/cjs/dance/DanceScoreEngine.js +209 -221
- package/dist/cjs/dance/PoseDetector.js +302 -275
- package/dist/cjs/index.js +110 -113
- package/dist/cjs/material/MaterialEditor.module.css.js +242 -5
- package/dist/cjs/material/NiceMaterialEditor.js +1213 -757
- package/dist/cjs/material/materialEditorTypes.js +35 -49
- package/dist/cjs/material/materialEditorUtils.js +684 -747
- package/dist/cjs/material/materialNodeDefinitions.js +1411 -1459
- package/dist/cjs/model/ModelEditor.js +90 -40
- package/dist/cjs/model/ModelEditor.module.css.js +257 -5
- package/dist/cjs/model/ModelEditorLeftPanel.js +126 -47
- package/dist/cjs/model/ModelEditorMenuBar.js +359 -32
- package/dist/cjs/model/ModelEditorRightPanel.js +647 -131
- package/dist/cjs/model/ModelEditorSubComponents.js +277 -112
- package/dist/cjs/model/ModelEditorTimeline.js +232 -34
- package/dist/cjs/model/ModelEditorToolbar.js +170 -14
- package/dist/cjs/model/ModelEditorViewport.js +231 -39
- package/dist/cjs/model/ModelViewer.js +388 -63
- package/dist/cjs/model/ModelViewer.module.css.js +77 -5
- package/dist/cjs/model/NiceArmatureEditor.js +473 -274
- package/dist/cjs/model/NiceMorphTargetEditor.js +333 -227
- package/dist/cjs/model/NiceOctree.js +372 -320
- package/dist/cjs/model/NicePhysicsSimulation.js +528 -298
- package/dist/cjs/model/NiceProceduralGeometry.js +673 -300
- package/dist/cjs/model/NiceTerrainEditor.js +595 -385
- package/dist/cjs/model/NiceWeightPainter.js +384 -261
- package/dist/cjs/model/NiceXRPreview.js +385 -308
- package/dist/cjs/model/cadModeUtils.js +103 -106
- package/dist/cjs/model/editorShortcuts.js +171 -194
- package/dist/cjs/model/modelEditorTypes.js +100 -118
- package/dist/cjs/model/modelEditorUtils.js +1061 -1146
- package/dist/cjs/model/simsModeUtils.js +1023 -1053
- package/dist/cjs/model/useModelEditor.js +1977 -1933
- package/dist/cjs/model/useModelViewer.js +633 -665
- package/dist/cjs/nice2dev-ui-3d.css +1 -1
- package/dist/cjs/particle/NiceParticleEditor.js +1186 -571
- package/dist/cjs/particle/ParticleEditor.module.css.js +122 -5
- package/dist/cjs/particle/particleEditorTypes.js +62 -70
- package/dist/cjs/particle/particleEditorUtils.js +998 -1013
- package/dist/cjs/rendering/NiceCascadedShadows.js +381 -259
- package/dist/cjs/rendering/NiceRenderExport.js +424 -337
- package/dist/cjs/rendering/NiceSSAO.js +454 -337
- package/dist/cjs/rendering/NiceSSR.js +387 -261
- package/dist/cjs/rendering/NiceWebGPURenderer.js +359 -230
- package/dist/cjs/uv/NiceUVEditor.js +787 -550
- package/dist/cjs/uv/UVEditor.module.css.js +53 -5
- package/dist/cjs/uv/uvEditorTypes.js +59 -76
- package/dist/cjs/uv/uvEditorUtils.js +501 -575
- package/dist/esm/collaborative/collaborativeScene.js +163 -205
- package/dist/esm/core/editorAsk.js +53 -40
- package/dist/esm/core/i18n.js +15 -13
- package/dist/esm/core/threeCompat.js +18 -26
- package/dist/esm/dance/DanceBridge.js +151 -176
- package/dist/esm/dance/DanceScoreEngine.js +211 -220
- package/dist/esm/dance/PoseDetector.js +304 -274
- package/dist/esm/index.js +258 -36
- package/dist/esm/material/MaterialEditor.module.css.js +242 -3
- package/dist/esm/material/NiceMaterialEditor.js +1215 -756
- package/dist/esm/material/materialEditorTypes.js +45 -48
- package/dist/esm/material/materialEditorUtils.js +713 -746
- package/dist/esm/material/materialNodeDefinitions.js +1415 -1458
- package/dist/esm/model/ModelEditor.js +91 -39
- package/dist/esm/model/ModelEditor.module.css.js +257 -3
- package/dist/esm/model/ModelEditorLeftPanel.js +126 -45
- package/dist/esm/model/ModelEditorMenuBar.js +359 -30
- package/dist/esm/model/ModelEditorRightPanel.js +634 -114
- package/dist/esm/model/ModelEditorSubComponents.js +265 -94
- package/dist/esm/model/ModelEditorTimeline.js +232 -32
- package/dist/esm/model/ModelEditorToolbar.js +170 -12
- package/dist/esm/model/ModelEditorViewport.js +231 -37
- package/dist/esm/model/ModelViewer.js +389 -62
- package/dist/esm/model/ModelViewer.module.css.js +77 -3
- package/dist/esm/model/NiceArmatureEditor.js +462 -258
- package/dist/esm/model/NiceMorphTargetEditor.js +322 -211
- package/dist/esm/model/NiceOctree.js +361 -304
- package/dist/esm/model/NicePhysicsSimulation.js +517 -282
- package/dist/esm/model/NiceProceduralGeometry.js +667 -284
- package/dist/esm/model/NiceTerrainEditor.js +584 -369
- package/dist/esm/model/NiceWeightPainter.js +373 -245
- package/dist/esm/model/NiceXRPreview.js +374 -292
- package/dist/esm/model/cadModeUtils.js +95 -88
- package/dist/esm/model/editorShortcuts.js +172 -193
- package/dist/esm/model/modelEditorTypes.js +90 -100
- package/dist/esm/model/modelEditorUtils.js +1056 -1128
- package/dist/esm/model/simsModeUtils.js +1021 -1035
- package/dist/esm/model/useModelEditor.js +1946 -1920
- package/dist/esm/model/useModelViewer.js +619 -647
- package/dist/esm/nice2dev-ui-3d.css +1 -1
- package/dist/esm/particle/NiceParticleEditor.js +1188 -570
- package/dist/esm/particle/ParticleEditor.module.css.js +122 -3
- package/dist/esm/particle/particleEditorTypes.js +69 -69
- package/dist/esm/particle/particleEditorUtils.js +1027 -1012
- package/dist/esm/rendering/NiceCascadedShadows.js +370 -243
- package/dist/esm/rendering/NiceRenderExport.js +413 -321
- package/dist/esm/rendering/NiceSSAO.js +450 -328
- package/dist/esm/rendering/NiceSSR.js +383 -252
- package/dist/esm/rendering/NiceWebGPURenderer.js +326 -214
- package/dist/esm/uv/NiceUVEditor.js +788 -549
- package/dist/esm/uv/UVEditor.module.css.js +53 -3
- package/dist/esm/uv/uvEditorTypes.js +68 -75
- package/dist/esm/uv/uvEditorUtils.js +515 -557
- package/package.json +7 -12
|
@@ -1,40 +1,92 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from
|
|
2
|
-
import { NiceAppShell } from
|
|
3
|
-
import { EditorAskDialog } from
|
|
4
|
-
import { useNiceTranslation } from
|
|
5
|
-
import styles from
|
|
6
|
-
import ModelEditorLeftPanel from
|
|
7
|
-
import ModelEditorMenuBar from
|
|
8
|
-
import ModelEditorRightPanel from
|
|
9
|
-
import ModelEditorTimeline from
|
|
10
|
-
import ModelEditorToolbar from
|
|
11
|
-
import { SUPPORTED_EXTENSIONS } from
|
|
12
|
-
import ModelEditorViewport from
|
|
13
|
-
import { useModelEditor } from
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { NiceAppShell } from "@nice2dev/ui";
|
|
3
|
+
import { EditorAskDialog } from "../core/editorAsk.js";
|
|
4
|
+
import { useNiceTranslation } from "../core/i18n.js";
|
|
5
|
+
import styles from "./ModelEditor.module.css.js";
|
|
6
|
+
import ModelEditorLeftPanel from "./ModelEditorLeftPanel.js";
|
|
7
|
+
import ModelEditorMenuBar from "./ModelEditorMenuBar.js";
|
|
8
|
+
import ModelEditorRightPanel from "./ModelEditorRightPanel.js";
|
|
9
|
+
import ModelEditorTimeline from "./ModelEditorTimeline.js";
|
|
10
|
+
import ModelEditorToolbar from "./ModelEditorToolbar.js";
|
|
11
|
+
import { SUPPORTED_EXTENSIONS } from "./modelEditorTypes.js";
|
|
12
|
+
import ModelEditorViewport from "./ModelEditorViewport.js";
|
|
13
|
+
import { useModelEditor } from "./useModelEditor.js";
|
|
14
|
+
const ACCEPT = /* @__PURE__ */ SUPPORTED_EXTENSIONS.map((e) => `.${e}`).join(",");
|
|
15
|
+
const NiceModelEditor = ({
|
|
16
|
+
className,
|
|
17
|
+
onSaveToLibrary,
|
|
18
|
+
onAIPoseVideo
|
|
19
|
+
}) => {
|
|
20
|
+
const { t } = useNiceTranslation();
|
|
21
|
+
const api = useModelEditor({ onSaveToLibrary, onAIPoseVideo });
|
|
22
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23
|
+
/* @__PURE__ */ jsx(
|
|
24
|
+
"input",
|
|
25
|
+
{
|
|
26
|
+
ref: api.fileInputRef,
|
|
27
|
+
type: "file",
|
|
28
|
+
accept: ACCEPT,
|
|
29
|
+
style: { display: "none" },
|
|
30
|
+
onChange: (e) => {
|
|
31
|
+
const f = e.target.files?.[0];
|
|
32
|
+
if (f) {
|
|
33
|
+
api.loadFile(f);
|
|
34
|
+
}
|
|
35
|
+
e.target.value = "";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
"input",
|
|
41
|
+
{
|
|
42
|
+
ref: api.mergeInputRef,
|
|
43
|
+
type: "file",
|
|
44
|
+
accept: ".fbx",
|
|
45
|
+
style: { display: "none" },
|
|
46
|
+
onChange: (e) => {
|
|
47
|
+
const f = e.target.files?.[0];
|
|
48
|
+
if (f) {
|
|
49
|
+
api.mergeAnimationFBX(f);
|
|
50
|
+
}
|
|
51
|
+
e.target.value = "";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
"input",
|
|
57
|
+
{
|
|
58
|
+
ref: api.videoInputRef,
|
|
59
|
+
type: "file",
|
|
60
|
+
accept: "video/*",
|
|
61
|
+
style: { display: "none" },
|
|
62
|
+
onChange: api.handleAIVideo
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ jsx(EditorAskDialog, { ask: api.pendingAsk }),
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
NiceAppShell,
|
|
68
|
+
{
|
|
69
|
+
className: `${styles.root} ${className ?? ""}`,
|
|
70
|
+
flush: true,
|
|
71
|
+
menubar: /* @__PURE__ */ jsx(ModelEditorMenuBar, { api, hasOnSaveToLibrary: !!onSaveToLibrary }),
|
|
72
|
+
sidebar: /* @__PURE__ */ jsxs("div", { style: { display: "flex", minHeight: 0 }, children: [
|
|
73
|
+
/* @__PURE__ */ jsx(ModelEditorLeftPanel, { api }),
|
|
74
|
+
/* @__PURE__ */ jsx(ModelEditorToolbar, { api })
|
|
75
|
+
] }),
|
|
76
|
+
rightSidebar: /* @__PURE__ */ jsx(ModelEditorRightPanel, { api }),
|
|
77
|
+
bottomPanel: /* @__PURE__ */ jsx(ModelEditorTimeline, { api }),
|
|
78
|
+
statusBar: /* @__PURE__ */ jsxs("div", { className: styles.statusBar, children: [
|
|
79
|
+
/* @__PURE__ */ jsx("span", { children: api.statusText }),
|
|
80
|
+
/* @__PURE__ */ jsx("span", { style: { marginLeft: "auto" }, children: t(
|
|
81
|
+
"modelEditor.trianglesMeshesBonesAnimS",
|
|
82
|
+
"{polyCount} triangles · {meshCount} meshes · {boneCount} bones · {animations} anim(s)"
|
|
83
|
+
).replace("{polyCount}", String(api.polyCount.toLocaleString())).replace("{meshCount}", String(api.meshCount)).replace("{boneCount}", String(api.boneCount)).replace("{animations}", String(api.animations.length)) })
|
|
84
|
+
] }),
|
|
85
|
+
children: /* @__PURE__ */ jsx(ModelEditorViewport, { api })
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] });
|
|
89
|
+
};
|
|
90
|
+
export {
|
|
91
|
+
NiceModelEditor
|
|
38
92
|
};
|
|
39
|
-
|
|
40
|
-
export { NiceModelEditor };
|
|
@@ -1,3 +1,257 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const root = "_root_lw12r_5";
|
|
2
|
+
const menuBar = "_menuBar_lw12r_35";
|
|
3
|
+
const menuBtn = "_menuBtn_lw12r_55";
|
|
4
|
+
const menuSep = "_menuSep_lw12r_91";
|
|
5
|
+
const menuLabel = "_menuLabel_lw12r_103";
|
|
6
|
+
const menuRight = "_menuRight_lw12r_115";
|
|
7
|
+
const leftPanel = "_leftPanel_lw12r_141";
|
|
8
|
+
const toolbar = "_toolbar_lw12r_163";
|
|
9
|
+
const toolBtn = "_toolBtn_lw12r_183";
|
|
10
|
+
const toolSep = "_toolSep_lw12r_229";
|
|
11
|
+
const viewportContainer = "_viewportContainer_lw12r_243";
|
|
12
|
+
const viewportOverlay = "_viewportOverlay_lw12r_277";
|
|
13
|
+
const viewportBadge = "_viewportBadge_lw12r_293";
|
|
14
|
+
const viewportDropZone = "_viewportDropZone_lw12r_309";
|
|
15
|
+
const rightPanel = "_rightPanel_lw12r_349";
|
|
16
|
+
const panelSection = "_panelSection_lw12r_371";
|
|
17
|
+
const panelTitle = "_panelTitle_lw12r_379";
|
|
18
|
+
const panelContent = "_panelContent_lw12r_425";
|
|
19
|
+
const treeItem = "_treeItem_lw12r_441";
|
|
20
|
+
const treeItemActive = "_treeItemActive_lw12r_471";
|
|
21
|
+
const treeIcon = "_treeIcon_lw12r_479";
|
|
22
|
+
const treeToggle = "_treeToggle_lw12r_503";
|
|
23
|
+
const treeVisibility = "_treeVisibility_lw12r_519";
|
|
24
|
+
const propRow = "_propRow_lw12r_543";
|
|
25
|
+
const propLabel = "_propLabel_lw12r_555";
|
|
26
|
+
const propInput = "_propInput_lw12r_567";
|
|
27
|
+
const propVec3 = "_propVec3_lw12r_595";
|
|
28
|
+
const propVec3X = "_propVec3X_lw12r_635";
|
|
29
|
+
const propVec3Y = "_propVec3Y_lw12r_641";
|
|
30
|
+
const propVec3Z = "_propVec3Z_lw12r_647";
|
|
31
|
+
const propSelect = "_propSelect_lw12r_699";
|
|
32
|
+
const bottomPanel = "_bottomPanel_lw12r_727";
|
|
33
|
+
const bottomPanelCollapsed = "_bottomPanelCollapsed_lw12r_745";
|
|
34
|
+
const bottomPanelHeader = "_bottomPanelHeader_lw12r_751";
|
|
35
|
+
const bottomPanelTitle = "_bottomPanelTitle_lw12r_769";
|
|
36
|
+
const bottomToggle = "_bottomToggle_lw12r_783";
|
|
37
|
+
const transportBar = "_transportBar_lw12r_799";
|
|
38
|
+
const transportBtn = "_transportBtn_lw12r_809";
|
|
39
|
+
const transportTime = "_transportTime_lw12r_841";
|
|
40
|
+
const animListArea = "_animListArea_lw12r_857";
|
|
41
|
+
const animList = "_animList_lw12r_857";
|
|
42
|
+
const animItem = "_animItem_lw12r_881";
|
|
43
|
+
const animItemActive = "_animItemActive_lw12r_905";
|
|
44
|
+
const animDuration = "_animDuration_lw12r_913";
|
|
45
|
+
const timelineArea = "_timelineArea_lw12r_927";
|
|
46
|
+
const timelineRuler = "_timelineRuler_lw12r_939";
|
|
47
|
+
const rulerTick = "_rulerTick_lw12r_951";
|
|
48
|
+
const rulerLabel = "_rulerLabel_lw12r_965";
|
|
49
|
+
const playhead = "_playhead_lw12r_979";
|
|
50
|
+
const playheadHandle = "_playheadHandle_lw12r_995";
|
|
51
|
+
const timelineTracks = "_timelineTracks_lw12r_1013";
|
|
52
|
+
const statusBar = "_statusBar_lw12r_1057";
|
|
53
|
+
const materialCard = "_materialCard_lw12r_1089";
|
|
54
|
+
const materialCardActive = "_materialCardActive_lw12r_1103";
|
|
55
|
+
const materialHeader = "_materialHeader_lw12r_1109";
|
|
56
|
+
const materialName = "_materialName_lw12r_1145";
|
|
57
|
+
const textureSlot = "_textureSlot_lw12r_1165";
|
|
58
|
+
const textureThumb = "_textureThumb_lw12r_1177";
|
|
59
|
+
const textureInfo = "_textureInfo_lw12r_1205";
|
|
60
|
+
const textureName = "_textureName_lw12r_1213";
|
|
61
|
+
const btnSecondary = "_btnSecondary_lw12r_1295";
|
|
62
|
+
const aiPanel = "_aiPanel_lw12r_1357";
|
|
63
|
+
const aiHeader = "_aiHeader_lw12r_1371";
|
|
64
|
+
const aiBtnRow = "_aiBtnRow_lw12r_1419";
|
|
65
|
+
const aiBtn = "_aiBtn_lw12r_1419";
|
|
66
|
+
const aiStatus = "_aiStatus_lw12r_1457";
|
|
67
|
+
const dragOver = "_dragOver_lw12r_1475";
|
|
68
|
+
const contextMenu = "_contextMenu_lw12r_1491";
|
|
69
|
+
const contextItem = "_contextItem_lw12r_1511";
|
|
70
|
+
const contextSep = "_contextSep_lw12r_1535";
|
|
71
|
+
const contextKey = "_contextKey_lw12r_1545";
|
|
72
|
+
const modeSelect = "_modeSelect_lw12r_1645";
|
|
73
|
+
const menuDropdownWrap = "_menuDropdownWrap_lw12r_1687";
|
|
74
|
+
const dropdownMenu = "_dropdownMenu_lw12r_1693";
|
|
75
|
+
const dropdownTitle = "_dropdownTitle_lw12r_1721";
|
|
76
|
+
const dropdownItem = "_dropdownItem_lw12r_1737";
|
|
77
|
+
const dropdownSep = "_dropdownSep_lw12r_1765";
|
|
78
|
+
const viewportShadingBar = "_viewportShadingBar_lw12r_1803";
|
|
79
|
+
const shadingBtn = "_shadingBtn_lw12r_1827";
|
|
80
|
+
const shadingBtnActive = "_shadingBtnActive_lw12r_1857";
|
|
81
|
+
const viewportGizmoInfo = "_viewportGizmoInfo_lw12r_1875";
|
|
82
|
+
const propTabs = "_propTabs_lw12r_1895";
|
|
83
|
+
const propTabBtn = "_propTabBtn_lw12r_1907";
|
|
84
|
+
const outlinerSearch = "_outlinerSearch_lw12r_1955";
|
|
85
|
+
const styles = {
|
|
86
|
+
root,
|
|
87
|
+
menuBar,
|
|
88
|
+
menuBtn,
|
|
89
|
+
menuSep,
|
|
90
|
+
menuLabel,
|
|
91
|
+
menuRight,
|
|
92
|
+
leftPanel,
|
|
93
|
+
toolbar,
|
|
94
|
+
toolBtn,
|
|
95
|
+
toolSep,
|
|
96
|
+
viewportContainer,
|
|
97
|
+
viewportOverlay,
|
|
98
|
+
viewportBadge,
|
|
99
|
+
viewportDropZone,
|
|
100
|
+
rightPanel,
|
|
101
|
+
panelSection,
|
|
102
|
+
panelTitle,
|
|
103
|
+
panelContent,
|
|
104
|
+
treeItem,
|
|
105
|
+
treeItemActive,
|
|
106
|
+
treeIcon,
|
|
107
|
+
treeToggle,
|
|
108
|
+
treeVisibility,
|
|
109
|
+
propRow,
|
|
110
|
+
propLabel,
|
|
111
|
+
propInput,
|
|
112
|
+
propVec3,
|
|
113
|
+
propVec3X,
|
|
114
|
+
propVec3Y,
|
|
115
|
+
propVec3Z,
|
|
116
|
+
propSelect,
|
|
117
|
+
bottomPanel,
|
|
118
|
+
bottomPanelCollapsed,
|
|
119
|
+
bottomPanelHeader,
|
|
120
|
+
bottomPanelTitle,
|
|
121
|
+
bottomToggle,
|
|
122
|
+
transportBar,
|
|
123
|
+
transportBtn,
|
|
124
|
+
transportTime,
|
|
125
|
+
animListArea,
|
|
126
|
+
animList,
|
|
127
|
+
animItem,
|
|
128
|
+
animItemActive,
|
|
129
|
+
animDuration,
|
|
130
|
+
timelineArea,
|
|
131
|
+
timelineRuler,
|
|
132
|
+
rulerTick,
|
|
133
|
+
rulerLabel,
|
|
134
|
+
playhead,
|
|
135
|
+
playheadHandle,
|
|
136
|
+
timelineTracks,
|
|
137
|
+
statusBar,
|
|
138
|
+
materialCard,
|
|
139
|
+
materialCardActive,
|
|
140
|
+
materialHeader,
|
|
141
|
+
materialName,
|
|
142
|
+
textureSlot,
|
|
143
|
+
textureThumb,
|
|
144
|
+
textureInfo,
|
|
145
|
+
textureName,
|
|
146
|
+
btnSecondary,
|
|
147
|
+
aiPanel,
|
|
148
|
+
aiHeader,
|
|
149
|
+
aiBtnRow,
|
|
150
|
+
aiBtn,
|
|
151
|
+
aiStatus,
|
|
152
|
+
dragOver,
|
|
153
|
+
contextMenu,
|
|
154
|
+
contextItem,
|
|
155
|
+
contextSep,
|
|
156
|
+
contextKey,
|
|
157
|
+
modeSelect,
|
|
158
|
+
menuDropdownWrap,
|
|
159
|
+
dropdownMenu,
|
|
160
|
+
dropdownTitle,
|
|
161
|
+
dropdownItem,
|
|
162
|
+
dropdownSep,
|
|
163
|
+
viewportShadingBar,
|
|
164
|
+
shadingBtn,
|
|
165
|
+
shadingBtnActive,
|
|
166
|
+
viewportGizmoInfo,
|
|
167
|
+
propTabs,
|
|
168
|
+
propTabBtn,
|
|
169
|
+
outlinerSearch
|
|
170
|
+
};
|
|
171
|
+
export {
|
|
172
|
+
aiBtn,
|
|
173
|
+
aiBtnRow,
|
|
174
|
+
aiHeader,
|
|
175
|
+
aiPanel,
|
|
176
|
+
aiStatus,
|
|
177
|
+
animDuration,
|
|
178
|
+
animItem,
|
|
179
|
+
animItemActive,
|
|
180
|
+
animList,
|
|
181
|
+
animListArea,
|
|
182
|
+
bottomPanel,
|
|
183
|
+
bottomPanelCollapsed,
|
|
184
|
+
bottomPanelHeader,
|
|
185
|
+
bottomPanelTitle,
|
|
186
|
+
bottomToggle,
|
|
187
|
+
btnSecondary,
|
|
188
|
+
contextItem,
|
|
189
|
+
contextKey,
|
|
190
|
+
contextMenu,
|
|
191
|
+
contextSep,
|
|
192
|
+
styles as default,
|
|
193
|
+
dragOver,
|
|
194
|
+
dropdownItem,
|
|
195
|
+
dropdownMenu,
|
|
196
|
+
dropdownSep,
|
|
197
|
+
dropdownTitle,
|
|
198
|
+
leftPanel,
|
|
199
|
+
materialCard,
|
|
200
|
+
materialCardActive,
|
|
201
|
+
materialHeader,
|
|
202
|
+
materialName,
|
|
203
|
+
menuBar,
|
|
204
|
+
menuBtn,
|
|
205
|
+
menuDropdownWrap,
|
|
206
|
+
menuLabel,
|
|
207
|
+
menuRight,
|
|
208
|
+
menuSep,
|
|
209
|
+
modeSelect,
|
|
210
|
+
outlinerSearch,
|
|
211
|
+
panelContent,
|
|
212
|
+
panelSection,
|
|
213
|
+
panelTitle,
|
|
214
|
+
playhead,
|
|
215
|
+
playheadHandle,
|
|
216
|
+
propInput,
|
|
217
|
+
propLabel,
|
|
218
|
+
propRow,
|
|
219
|
+
propSelect,
|
|
220
|
+
propTabBtn,
|
|
221
|
+
propTabs,
|
|
222
|
+
propVec3,
|
|
223
|
+
propVec3X,
|
|
224
|
+
propVec3Y,
|
|
225
|
+
propVec3Z,
|
|
226
|
+
rightPanel,
|
|
227
|
+
root,
|
|
228
|
+
rulerLabel,
|
|
229
|
+
rulerTick,
|
|
230
|
+
shadingBtn,
|
|
231
|
+
shadingBtnActive,
|
|
232
|
+
statusBar,
|
|
233
|
+
textureInfo,
|
|
234
|
+
textureName,
|
|
235
|
+
textureSlot,
|
|
236
|
+
textureThumb,
|
|
237
|
+
timelineArea,
|
|
238
|
+
timelineRuler,
|
|
239
|
+
timelineTracks,
|
|
240
|
+
toolBtn,
|
|
241
|
+
toolSep,
|
|
242
|
+
toolbar,
|
|
243
|
+
transportBar,
|
|
244
|
+
transportBtn,
|
|
245
|
+
transportTime,
|
|
246
|
+
treeIcon,
|
|
247
|
+
treeItem,
|
|
248
|
+
treeItemActive,
|
|
249
|
+
treeToggle,
|
|
250
|
+
treeVisibility,
|
|
251
|
+
viewportBadge,
|
|
252
|
+
viewportContainer,
|
|
253
|
+
viewportDropZone,
|
|
254
|
+
viewportGizmoInfo,
|
|
255
|
+
viewportOverlay,
|
|
256
|
+
viewportShadingBar
|
|
257
|
+
};
|
|
@@ -1,50 +1,131 @@
|
|
|
1
|
-
import { jsx, jsxs } from
|
|
2
|
-
import { NiceIcon, NiceButton, NiceTextInput, clickOnActivationKey } from
|
|
3
|
-
import React from
|
|
4
|
-
import { useNiceTranslation } from
|
|
5
|
-
import styles from
|
|
6
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { NiceIcon, NiceButton, NiceTextInput, clickOnActivationKey } from "@nice2dev/ui";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { useNiceTranslation } from "../core/i18n.js";
|
|
5
|
+
import styles from "./ModelEditor.module.css.js";
|
|
7
6
|
const ModelEditorLeftPanel = /* @__PURE__ */ Object.assign(
|
|
8
|
-
/* @__PURE__ */ React.memo(({ api }) => {
|
|
7
|
+
/* @__PURE__ */ React.memo(({ api }) => {
|
|
9
8
|
const { t } = useNiceTranslation();
|
|
10
|
-
const {
|
|
9
|
+
const {
|
|
10
|
+
sceneTree,
|
|
11
|
+
selectedId,
|
|
12
|
+
outlinerSearch,
|
|
13
|
+
setOutlinerSearch,
|
|
14
|
+
selectObject,
|
|
15
|
+
rebuildTree,
|
|
16
|
+
toggleNodeExpanded,
|
|
17
|
+
toggleNodeVisibility
|
|
18
|
+
} = api;
|
|
11
19
|
const renderTreeNode = (node, depth) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
20
|
+
if (outlinerSearch) {
|
|
21
|
+
const q = outlinerSearch.toLowerCase();
|
|
22
|
+
const match = node.name.toLowerCase().includes(q);
|
|
23
|
+
const childMatch = node.children.some(function cm(c) {
|
|
24
|
+
return c.name.toLowerCase().includes(q) || c.children.some(cm);
|
|
25
|
+
});
|
|
26
|
+
if (!match && !childMatch) {
|
|
27
|
+
return null;
|
|
22
28
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
}
|
|
30
|
+
const hasChildren = node.children.length > 0;
|
|
31
|
+
const icon = node.type === "mesh" ? "box" : node.type === "bone" ? "target" : node.type === "light" ? "lightbulb" : node.type === "camera" ? "camera" : node.type === "helper" ? "hexagon" : "folder";
|
|
32
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
33
|
+
/* @__PURE__ */ jsxs(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
role: "button",
|
|
37
|
+
tabIndex: 0,
|
|
38
|
+
onKeyDown: clickOnActivationKey,
|
|
39
|
+
className: `${styles.treeItem} ${selectedId === node.id ? styles.treeItemActive : ""}`,
|
|
40
|
+
style: { paddingLeft: depth * 16 + 4 },
|
|
41
|
+
onClick: () => selectObject(node),
|
|
42
|
+
children: [
|
|
43
|
+
hasChildren ? /* @__PURE__ */ jsx(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
role: "button",
|
|
47
|
+
tabIndex: 0,
|
|
48
|
+
"aria-label": t(
|
|
49
|
+
node.expanded ? "controls.collapse" : "controls.expand",
|
|
50
|
+
node.expanded ? "Collapse" : "Expand"
|
|
51
|
+
),
|
|
52
|
+
onKeyDown: clickOnActivationKey,
|
|
53
|
+
className: styles.treeToggle,
|
|
54
|
+
onClick: (e) => {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
toggleNodeExpanded(node);
|
|
57
|
+
},
|
|
58
|
+
children: /* @__PURE__ */ jsx(NiceIcon, { name: node.expanded ? "chevron-down" : "chevron-right", size: 14 })
|
|
59
|
+
}
|
|
60
|
+
) : /* @__PURE__ */ jsx("span", { className: styles.treeToggle }),
|
|
61
|
+
/* @__PURE__ */ jsx("span", { className: styles.treeIcon, children: /* @__PURE__ */ jsx(NiceIcon, { name: icon, size: 14 }) }),
|
|
62
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: node.name }),
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
"span",
|
|
65
|
+
{
|
|
66
|
+
role: "button",
|
|
67
|
+
tabIndex: 0,
|
|
68
|
+
"aria-label": t(node.visible ? "hide" : "show", node.visible ? "Hide" : "Show"),
|
|
69
|
+
onKeyDown: clickOnActivationKey,
|
|
70
|
+
className: styles.treeVisibility,
|
|
71
|
+
onClick: (e) => {
|
|
72
|
+
e.stopPropagation();
|
|
73
|
+
toggleNodeVisibility(node);
|
|
74
|
+
},
|
|
75
|
+
children: /* @__PURE__ */ jsx(NiceIcon, { name: node.visible ? "eye" : "eye-off", size: 14 })
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
node.expanded && node.children.map((c) => renderTreeNode(c, depth + 1))
|
|
82
|
+
] }, node.id);
|
|
42
83
|
};
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
84
|
+
return /* @__PURE__ */ jsx("div", { className: styles.leftPanel, children: /* @__PURE__ */ jsxs("div", { className: styles.panelSection, children: [
|
|
85
|
+
/* @__PURE__ */ jsxs("div", { className: styles.panelTitle, children: [
|
|
86
|
+
/* @__PURE__ */ jsx(NiceIcon, { name: "clipboard", size: 14 }),
|
|
87
|
+
" ",
|
|
88
|
+
t("modelEditorLeftPanel.outliner", "Outliner"),
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
NiceButton,
|
|
91
|
+
{
|
|
92
|
+
variant: "ghost",
|
|
93
|
+
size: "sm",
|
|
94
|
+
onClick: rebuildTree,
|
|
95
|
+
title: t("modelEditorLeftPanel.refresh", "Refresh"),
|
|
96
|
+
"aria-label": t("modelEditorLeftPanel.refreshOutliner", "Refresh outliner"),
|
|
97
|
+
children: /* @__PURE__ */ jsx(NiceIcon, { name: "refresh", size: 14 })
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] }),
|
|
101
|
+
/* @__PURE__ */ jsx("div", { className: styles.outlinerSearch, children: /* @__PURE__ */ jsx(
|
|
102
|
+
NiceTextInput,
|
|
103
|
+
{
|
|
104
|
+
className: styles.propInput,
|
|
105
|
+
placeholder: t("modelEditorLeftPanel.filter", "Filter..."),
|
|
106
|
+
value: outlinerSearch,
|
|
107
|
+
onChange: (val) => setOutlinerSearch(val),
|
|
108
|
+
style: { width: "100%", marginBottom: 4 }
|
|
109
|
+
}
|
|
110
|
+
) }),
|
|
111
|
+
/* @__PURE__ */ jsxs("div", { className: styles.panelContent, style: { overflowY: "auto", flex: 1 }, children: [
|
|
112
|
+
sceneTree.length === 0 && /* @__PURE__ */ jsx(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
style: {
|
|
116
|
+
color: "var(--nice-text-secondary, #666)",
|
|
117
|
+
fontSize: 10,
|
|
118
|
+
padding: "8px 0"
|
|
119
|
+
},
|
|
120
|
+
children: t("modelEditorLeftPanel.dropA3dFileTo", "Drop a 3D file to begin")
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
sceneTree.map((n) => renderTreeNode(n, 0))
|
|
124
|
+
] })
|
|
125
|
+
] }) });
|
|
126
|
+
}),
|
|
127
|
+
{ displayName: "ModelEditorLeftPanel" }
|
|
128
|
+
);
|
|
129
|
+
export {
|
|
130
|
+
ModelEditorLeftPanel as default
|
|
131
|
+
};
|