@tomorrowevening/hermes 0.1.39 → 0.1.41
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/dist/{ThreeEditor-CTkjs-SY.js → ThreeEditor-jkqfXLb4.js} +16 -16
- package/dist/core/Application.js +77 -0
- package/dist/core/remote/BaseRemote.js +33 -0
- package/dist/core/remote/RemoteTheatre.js +253 -0
- package/dist/core/remote/RemoteThree.js +451 -0
- package/dist/core/types.js +7 -0
- package/dist/editor/Editor.js +12 -0
- package/dist/editor/HermesApp.js +24 -0
- package/dist/editor/ThreeEditor.js +25 -0
- package/dist/editor/components/Draggable.js +40 -0
- package/dist/editor/components/DraggableItem.js +25 -0
- package/dist/editor/components/Dropdown.js +32 -0
- package/dist/editor/components/DropdownItem.js +50 -0
- package/dist/editor/components/NavButton.js +7 -0
- package/dist/editor/components/content.js +4 -0
- package/dist/editor/components/icons/CloseIcon.js +9 -0
- package/dist/editor/components/icons/DragIcon.js +12 -0
- package/dist/editor/multiView/CameraWindow.js +64 -0
- package/dist/editor/multiView/DepthNodeMaterial.js +12 -0
- package/dist/editor/multiView/InfiniteGridHelper.js +31 -0
- package/dist/editor/multiView/InfiniteGridHelperGPU.js +31 -0
- package/dist/editor/multiView/InfiniteGridMaterial.js +137 -0
- package/dist/editor/multiView/InfiniteGridNodeMaterial.js +63 -0
- package/dist/editor/multiView/MultiView.js +890 -0
- package/dist/editor/multiView/Toggle.js +25 -0
- package/dist/editor/multiView/UVMaterial.js +60 -0
- package/dist/editor/multiView/UVNodeMaterial.js +10 -0
- package/dist/editor/sidePanel/Accordion.js +56 -0
- package/dist/editor/sidePanel/ChildObject.js +78 -0
- package/dist/editor/sidePanel/ContainerObject.js +11 -0
- package/dist/editor/sidePanel/DebugData.js +133 -0
- package/dist/editor/sidePanel/SidePanel.js +91 -0
- package/dist/editor/sidePanel/inspector/InspectGrid3.js +82 -0
- package/dist/editor/sidePanel/inspector/InspectGrid4.js +58 -0
- package/dist/editor/sidePanel/inspector/InspectImage.js +100 -0
- package/dist/editor/sidePanel/inspector/InspectNumber.js +76 -0
- package/dist/editor/sidePanel/inspector/InspectVector2.js +154 -0
- package/dist/editor/sidePanel/inspector/Inspector.js +95 -0
- package/dist/editor/sidePanel/inspector/InspectorField.js +128 -0
- package/dist/editor/sidePanel/inspector/InspectorGroup.js +110 -0
- package/dist/editor/sidePanel/inspector/utils/DragNumber.js +27 -0
- package/dist/editor/sidePanel/inspector/utils/InspectAnimation.js +99 -0
- package/dist/editor/sidePanel/inspector/utils/InspectCamera.js +91 -0
- package/dist/editor/sidePanel/inspector/utils/InspectLight.js +85 -0
- package/dist/editor/sidePanel/inspector/utils/InspectMaterial.js +861 -0
- package/dist/editor/sidePanel/inspector/utils/InspectTransform.js +93 -0
- package/dist/editor/sidePanel/utils.js +259 -0
- package/dist/editor/tools/Transform.js +77 -0
- package/dist/editor/tools/splineEditor/Spline.js +348 -0
- package/dist/editor/tools/splineEditor/index.js +193 -0
- package/dist/editor/utils.js +27 -0
- package/dist/hermes.cjs.js +8 -30
- package/dist/{index-BpKOzCuX.js → index-DZmiM5y-.js} +617 -617
- package/dist/index.html +1 -1
- package/dist/index.js +125 -0
- package/dist/utils/ImageSequenceCapturer.js +148 -0
- package/dist/utils/detectSettings.js +46 -0
- package/dist/utils/math.js +68 -0
- package/dist/utils/post.js +206 -0
- package/dist/utils/theatre.js +316 -0
- package/dist/utils/three.js +199 -0
- package/dist/webworkers/EventHandling.js +115 -0
- package/dist/webworkers/ProxyManager.js +76 -0
- package/package.json +13 -7
- package/types/core/remote/RemoteThree.d.ts +10 -1
- package/dist/.vite/manifest.json +0 -12
- package/dist/hermes.es.js +0 -8077
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d } from "react";
|
|
3
|
+
function u(e) {
|
|
4
|
+
const [t, o] = d(e.selected), c = "toggle" + (t ? " selected" : "");
|
|
5
|
+
return /* @__PURE__ */ i(
|
|
6
|
+
"button",
|
|
7
|
+
{
|
|
8
|
+
className: c,
|
|
9
|
+
onClick: () => {
|
|
10
|
+
const n = !t;
|
|
11
|
+
o(n), e.onClick(n);
|
|
12
|
+
},
|
|
13
|
+
style: {
|
|
14
|
+
backgroundImage: `url(${e.icon})`,
|
|
15
|
+
backgroundPositionX: "center",
|
|
16
|
+
backgroundPositionY: e.top !== void 0 ? `${e.top}px` : "center",
|
|
17
|
+
backgroundSize: `${e.width !== void 0 ? `${e.width}px` : "26px"} ${e.height}px`
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
e.name
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
u as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ShaderMaterial as e } from "three";
|
|
2
|
+
const r = `#include <common>
|
|
3
|
+
#include <batching_pars_vertex>
|
|
4
|
+
#include <uv_pars_vertex>
|
|
5
|
+
#include <color_pars_vertex>
|
|
6
|
+
#include <morphtarget_pars_vertex>
|
|
7
|
+
#include <skinning_pars_vertex>
|
|
8
|
+
#include <logdepthbuf_pars_vertex>
|
|
9
|
+
#include <clipping_planes_pars_vertex>
|
|
10
|
+
|
|
11
|
+
void main() {
|
|
12
|
+
#include <uv_vertex>
|
|
13
|
+
#include <color_vertex>
|
|
14
|
+
#include <morphcolor_vertex>
|
|
15
|
+
#include <batching_vertex>
|
|
16
|
+
|
|
17
|
+
#if defined ( USE_SKINNING )
|
|
18
|
+
#include <beginnormal_vertex>
|
|
19
|
+
#include <morphnormal_vertex>
|
|
20
|
+
#include <skinbase_vertex>
|
|
21
|
+
#include <skinnormal_vertex>
|
|
22
|
+
#include <defaultnormal_vertex>
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
#include <begin_vertex>
|
|
26
|
+
#include <morphtarget_vertex>
|
|
27
|
+
#include <skinning_vertex>
|
|
28
|
+
#include <project_vertex>
|
|
29
|
+
#include <logdepthbuf_vertex>
|
|
30
|
+
#include <clipping_planes_vertex>
|
|
31
|
+
#include <worldpos_vertex>
|
|
32
|
+
}`, n = `
|
|
33
|
+
uniform float opacity;
|
|
34
|
+
#include <common>
|
|
35
|
+
#include <uv_pars_fragment>
|
|
36
|
+
#include <clipping_planes_pars_fragment>
|
|
37
|
+
|
|
38
|
+
void main() {
|
|
39
|
+
#include <clipping_planes_fragment>
|
|
40
|
+
if (opacity < 0.015) discard;
|
|
41
|
+
gl_FragColor = vec4(vec3(vUv, 0.0), opacity);
|
|
42
|
+
}`;
|
|
43
|
+
class l extends e {
|
|
44
|
+
constructor() {
|
|
45
|
+
super({
|
|
46
|
+
defines: {
|
|
47
|
+
USE_UV: ""
|
|
48
|
+
},
|
|
49
|
+
uniforms: {
|
|
50
|
+
opacity: { value: 1 }
|
|
51
|
+
},
|
|
52
|
+
vertexShader: r,
|
|
53
|
+
fragmentShader: n,
|
|
54
|
+
transparent: !0
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
l as default
|
|
60
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsxs as c, jsx as i, Fragment as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as s } from "react";
|
|
3
|
+
import { capitalize as u } from "../utils.js";
|
|
4
|
+
import { ToolEvents as b } from "../../core/remote/RemoteThree.js";
|
|
5
|
+
function C(e) {
|
|
6
|
+
const [n, a] = s(e.open !== void 0 ? e.open : !1), [d, v] = s(e.visible !== void 0 ? e.visible : !1), h = !n || e.children === void 0, m = () => {
|
|
7
|
+
e.three.dispatchEvent({ type: b.REMOVE_SCENE, value: e.scene });
|
|
8
|
+
};
|
|
9
|
+
return /* @__PURE__ */ c("div", { className: `accordion ${h ? "hide" : ""}`, children: [
|
|
10
|
+
/* @__PURE__ */ c(
|
|
11
|
+
"button",
|
|
12
|
+
{
|
|
13
|
+
className: "toggle",
|
|
14
|
+
onClick: () => {
|
|
15
|
+
const l = !n;
|
|
16
|
+
e.onToggle !== void 0 && e.onToggle(l), a(l);
|
|
17
|
+
},
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ i(
|
|
20
|
+
"p",
|
|
21
|
+
{
|
|
22
|
+
className: `status ${n ? "open" : ""}`,
|
|
23
|
+
children: "Toggle"
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ i("p", { className: "label", children: u(e.label) })
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
e.onRefresh ? /* @__PURE__ */ c(r, { children: [
|
|
31
|
+
/* @__PURE__ */ i(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
className: "visibility",
|
|
35
|
+
style: {
|
|
36
|
+
opacity: d ? 1 : 0.25
|
|
37
|
+
},
|
|
38
|
+
onClick: () => {
|
|
39
|
+
const t = e.three.getScene(e.scene.uuid);
|
|
40
|
+
if (t) {
|
|
41
|
+
const o = !t.visible;
|
|
42
|
+
t.visible = o, v(o);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ i("button", { className: "refresh", onClick: e.onRefresh }),
|
|
48
|
+
/* @__PURE__ */ i("button", { className: "remove", onClick: m })
|
|
49
|
+
] }) : null,
|
|
50
|
+
e.button,
|
|
51
|
+
/* @__PURE__ */ i("div", { className: n ? "open" : "", children: /* @__PURE__ */ i("div", { children: e.children }) })
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
C as default
|
|
56
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as f, useState as m, useEffect as r } from "react";
|
|
3
|
+
import { setItemProps as g, determineIcon as b } from "./utils.js";
|
|
4
|
+
function v(e) {
|
|
5
|
+
if (e.child === void 0)
|
|
6
|
+
return console.log("Hermes - No child attached"), null;
|
|
7
|
+
const d = f(null), [n, u] = m(!1), h = e.child.children.length > 0, o = [];
|
|
8
|
+
return e.child.children.length > 0 && e.child.children.map((l, i) => {
|
|
9
|
+
o.push(/* @__PURE__ */ t(v, { child: l, three: e.three }, i));
|
|
10
|
+
}), r(() => {
|
|
11
|
+
if (e.child) {
|
|
12
|
+
const l = e.child.uuid.split(".")[0], i = e.three.getScene(l);
|
|
13
|
+
if (i !== null)
|
|
14
|
+
try {
|
|
15
|
+
const c = i.getObjectByProperty("uuid", e.child.uuid);
|
|
16
|
+
c !== void 0 ? d.current.style.opacity = c.visible ? "1" : "0.25" : console.log(`Hermes - Can't find child: ${e.child.uuid}`);
|
|
17
|
+
} catch (c) {
|
|
18
|
+
console.log("Error looking for child:", c), console.log(e.child), console.log(e.three.scenes), console.log(i);
|
|
19
|
+
}
|
|
20
|
+
else
|
|
21
|
+
console.log(`Hermes (ChildObject) - Can't find Scene: ${l} with child UUID: ${e.child.uuid}`, e.three.scenes, e.three.scene, i);
|
|
22
|
+
}
|
|
23
|
+
}, [n]), /* @__PURE__ */ a("div", { className: "childObject", children: [
|
|
24
|
+
/* @__PURE__ */ a("div", { className: "child", children: [
|
|
25
|
+
h ? /* @__PURE__ */ t(
|
|
26
|
+
"button",
|
|
27
|
+
{
|
|
28
|
+
className: "status",
|
|
29
|
+
style: {
|
|
30
|
+
backgroundPositionX: n ? "-14px" : "2px"
|
|
31
|
+
},
|
|
32
|
+
onClick: () => {
|
|
33
|
+
u(!n);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
) : null,
|
|
37
|
+
/* @__PURE__ */ t(
|
|
38
|
+
"button",
|
|
39
|
+
{
|
|
40
|
+
className: "name",
|
|
41
|
+
style: {
|
|
42
|
+
left: h ? "20px" : "5px"
|
|
43
|
+
},
|
|
44
|
+
onClick: () => {
|
|
45
|
+
e.child !== void 0 ? (e.three.getObject(e.child.uuid), !n && h && u(!0)) : console.log("Hermes - No child attached...");
|
|
46
|
+
},
|
|
47
|
+
children: e.child.name.length > 0 ? `${e.child.name} (${e.child.type})` : `${e.child.type}::${e.child.uuid}`
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ t(
|
|
51
|
+
"button",
|
|
52
|
+
{
|
|
53
|
+
className: "visibility",
|
|
54
|
+
ref: d,
|
|
55
|
+
onClick: () => {
|
|
56
|
+
if (e.child) {
|
|
57
|
+
const l = e.three.getScene(e.child.uuid);
|
|
58
|
+
if (l !== null) {
|
|
59
|
+
const i = l.getObjectByProperty("uuid", e.child.uuid);
|
|
60
|
+
if (i !== void 0) {
|
|
61
|
+
const c = "visible", s = !i.visible;
|
|
62
|
+
d.current.style.opacity = s ? "1" : "0.25", e.three.updateObject(e.child.uuid, c, s), g(i, c, s);
|
|
63
|
+
} else
|
|
64
|
+
console.log(`Hermes - Couldn't find object: ${e.child.uuid}`, l);
|
|
65
|
+
} else
|
|
66
|
+
console.log(`Hermes - Couldn't find object in scene: ${e.child.uuid}, ${e.child.name}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ t("div", { className: `icon ${b(e.child)}` })
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ t("div", { className: n ? "open" : "", children: /* @__PURE__ */ t("div", { className: "container", children: o }) })
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
v as default
|
|
78
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import s from "./ChildObject.js";
|
|
3
|
+
function r(e) {
|
|
4
|
+
const c = [];
|
|
5
|
+
return e.child?.children.map((n, i) => {
|
|
6
|
+
c.push(/* @__PURE__ */ t(s, { child: n, scene: e.scene, three: e.three }, i));
|
|
7
|
+
}), /* @__PURE__ */ t("div", { className: `scene ${e.class !== void 0 ? e.class : ""}`, children: c });
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
r as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { Component as a, createRef as f } from "react";
|
|
3
|
+
import { ToolEvents as l } from "../../core/remote/RemoteThree.js";
|
|
4
|
+
import u from "./inspector/InspectorGroup.js";
|
|
5
|
+
class t extends a {
|
|
6
|
+
static instance;
|
|
7
|
+
static groups = [];
|
|
8
|
+
static groupsRefs = [];
|
|
9
|
+
static groupTitles = [];
|
|
10
|
+
static three;
|
|
11
|
+
constructor(s) {
|
|
12
|
+
super(s), this.state = { lastUpdate: Date.now() }, t.instance = this, t.three = s.three, s.three.addEventListener(l.ADD_GROUP, this.addGroup), s.three.addEventListener(l.REMOVE_GROUP, this.removeGroup);
|
|
13
|
+
}
|
|
14
|
+
componentWillUnmount() {
|
|
15
|
+
this.props.three.removeEventListener(l.ADD_GROUP, this.addGroup), this.props.three.removeEventListener(l.REMOVE_GROUP, this.removeGroup);
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return /* @__PURE__ */ d("div", { className: "customGroups", children: t.groups }, this.state.lastUpdate);
|
|
19
|
+
}
|
|
20
|
+
// Events
|
|
21
|
+
addGroup = (s) => {
|
|
22
|
+
const i = JSON.parse(s.value), p = [];
|
|
23
|
+
i.items.forEach((o) => {
|
|
24
|
+
p.push({
|
|
25
|
+
type: o.type,
|
|
26
|
+
prop: o.prop,
|
|
27
|
+
title: o.title !== void 0 ? o.title : o.prop,
|
|
28
|
+
value: o.value,
|
|
29
|
+
min: o.min,
|
|
30
|
+
max: o.max,
|
|
31
|
+
step: o.step,
|
|
32
|
+
options: o.options,
|
|
33
|
+
disabled: o.disabled,
|
|
34
|
+
onChange: (h, e) => {
|
|
35
|
+
this.props.three.updateGroup(i.title, h, e);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}), t.groups.push(
|
|
39
|
+
/* @__PURE__ */ d(
|
|
40
|
+
u,
|
|
41
|
+
{
|
|
42
|
+
three: this.props.three,
|
|
43
|
+
title: i.title,
|
|
44
|
+
items: p
|
|
45
|
+
},
|
|
46
|
+
i.title
|
|
47
|
+
)
|
|
48
|
+
), t.groupTitles.push(i.title), this.setState({ lastUpdate: Date.now() });
|
|
49
|
+
};
|
|
50
|
+
removeGroup = (s) => {
|
|
51
|
+
const i = s.value, p = t.groupTitles.length;
|
|
52
|
+
for (let o = 0; o < p; o++)
|
|
53
|
+
if (i === t.groupTitles[o]) {
|
|
54
|
+
t.groups.splice(o, 1), t.groupTitles.splice(o, 1), this.setState({ lastUpdate: Date.now() });
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
// Static
|
|
59
|
+
static addEditorGroup(s) {
|
|
60
|
+
const i = t.groupTitles.length;
|
|
61
|
+
for (let e = 0; e < i; e++)
|
|
62
|
+
if (t.groupTitles[e] === s.title)
|
|
63
|
+
return t.groupsRefs[e];
|
|
64
|
+
const p = [];
|
|
65
|
+
s.items.forEach((e) => {
|
|
66
|
+
p.push({
|
|
67
|
+
type: e.type,
|
|
68
|
+
prop: e.prop,
|
|
69
|
+
title: e.title !== void 0 ? e.title : e.prop,
|
|
70
|
+
value: e.value,
|
|
71
|
+
min: e.min,
|
|
72
|
+
max: e.max,
|
|
73
|
+
step: e.step,
|
|
74
|
+
options: e.options,
|
|
75
|
+
disabled: e.disabled,
|
|
76
|
+
onChange: (n, r) => {
|
|
77
|
+
s.onUpdate(n, r);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}), s.subgroups && s.subgroups.length > 0 && s.subgroups.forEach((e) => {
|
|
81
|
+
const n = [];
|
|
82
|
+
e.items.forEach((r) => {
|
|
83
|
+
n.push({
|
|
84
|
+
type: r.type,
|
|
85
|
+
prop: r.prop,
|
|
86
|
+
title: r.title !== void 0 ? r.title : r.prop,
|
|
87
|
+
value: r.value,
|
|
88
|
+
min: r.min,
|
|
89
|
+
max: r.max,
|
|
90
|
+
step: r.step,
|
|
91
|
+
options: r.options,
|
|
92
|
+
disabled: r.disabled,
|
|
93
|
+
onChange: (c, v) => {
|
|
94
|
+
e.onUpdate(c, v);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}), p.push({
|
|
98
|
+
three: t.three,
|
|
99
|
+
title: e.title,
|
|
100
|
+
expanded: e.expanded,
|
|
101
|
+
items: n
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
const o = f(), h = /* @__PURE__ */ d(
|
|
105
|
+
u,
|
|
106
|
+
{
|
|
107
|
+
three: t.three,
|
|
108
|
+
ref: o,
|
|
109
|
+
title: s.title,
|
|
110
|
+
expanded: s.expanded,
|
|
111
|
+
items: p
|
|
112
|
+
},
|
|
113
|
+
s.title
|
|
114
|
+
);
|
|
115
|
+
return t.groups.push(h), t.groupsRefs.push(o), t.groupTitles.push(s.title), setTimeout(() => {
|
|
116
|
+
t.instance?.setState({ lastUpdate: Date.now() });
|
|
117
|
+
}, 0), o;
|
|
118
|
+
}
|
|
119
|
+
static removeEditorGroup(s) {
|
|
120
|
+
const i = t.groupTitles.length;
|
|
121
|
+
for (let p = 0; p < i; p++)
|
|
122
|
+
if (s === t.groupTitles[p]) {
|
|
123
|
+
t.groups.splice(p, 1), t.groupTitles.splice(p, 1), t.instance?.setState({ lastUpdate: Date.now() });
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
static removeAllGroups() {
|
|
128
|
+
t.groups = [], t.groupTitles = [], t.groupsRefs = [], t.instance?.setState({ lastUpdate: Date.now() });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
export {
|
|
132
|
+
t as default
|
|
133
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsxs as C, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useEffect as D } from "react";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import E from "./Accordion.js";
|
|
5
|
+
import m from "./ContainerObject.js";
|
|
6
|
+
import b from "./DebugData.js";
|
|
7
|
+
import L from "./inspector/Inspector.js";
|
|
8
|
+
import { ToolEvents as c } from "../../core/remote/RemoteThree.js";
|
|
9
|
+
function T(n) {
|
|
10
|
+
const [r] = l([]), [h] = l([]), [R, a] = l(0), d = (o) => {
|
|
11
|
+
const t = o.value;
|
|
12
|
+
for (let e = 0; e < r.length; e++)
|
|
13
|
+
if (t.uuid === r[e].uuid) return;
|
|
14
|
+
r.push(t), h.push(
|
|
15
|
+
/* @__PURE__ */ i(
|
|
16
|
+
E,
|
|
17
|
+
{
|
|
18
|
+
three: n.three,
|
|
19
|
+
label: `Scene: ${t.name}`,
|
|
20
|
+
scene: t,
|
|
21
|
+
open: !1,
|
|
22
|
+
visible: !1,
|
|
23
|
+
onRefresh: () => {
|
|
24
|
+
n.three.refreshScene(t.name);
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ i(m, { child: t, scene: t, three: n.three })
|
|
27
|
+
},
|
|
28
|
+
t.name
|
|
29
|
+
)
|
|
30
|
+
), a(Date.now());
|
|
31
|
+
}, u = (o) => {
|
|
32
|
+
const t = o.value;
|
|
33
|
+
for (let e = 0; e < r.length; e++)
|
|
34
|
+
if (t.uuid === r[e].uuid) {
|
|
35
|
+
r[e] = t, h[e] = /* @__PURE__ */ i(
|
|
36
|
+
E,
|
|
37
|
+
{
|
|
38
|
+
three: n.three,
|
|
39
|
+
label: `Scene: ${t.name}`,
|
|
40
|
+
scene: t,
|
|
41
|
+
open: h[e].props.open,
|
|
42
|
+
visible: h[e].props.visible,
|
|
43
|
+
onRefresh: () => {
|
|
44
|
+
n.three.refreshScene(t.name);
|
|
45
|
+
},
|
|
46
|
+
children: /* @__PURE__ */ i(m, { child: t, scene: t, three: n.three })
|
|
47
|
+
},
|
|
48
|
+
t.name
|
|
49
|
+
), a(Date.now());
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
}, f = (o) => {
|
|
53
|
+
const t = o.value;
|
|
54
|
+
for (let e = 0; e < r.length; e++)
|
|
55
|
+
if (t.uuid === r[e].uuid) {
|
|
56
|
+
r.splice(e, 1), h.splice(e, 1), a(Date.now());
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}, S = (o) => {
|
|
60
|
+
const t = o.value.name;
|
|
61
|
+
for (let e = 0; e < r.length; e++) {
|
|
62
|
+
const s = r[e], v = s.name === t;
|
|
63
|
+
h[e] = /* @__PURE__ */ i(
|
|
64
|
+
E,
|
|
65
|
+
{
|
|
66
|
+
three: n.three,
|
|
67
|
+
label: `Scene: ${s.name}`,
|
|
68
|
+
scene: s,
|
|
69
|
+
open: v,
|
|
70
|
+
visible: v,
|
|
71
|
+
onRefresh: () => {
|
|
72
|
+
n.three.refreshScene(s.name);
|
|
73
|
+
},
|
|
74
|
+
children: /* @__PURE__ */ i(m, { child: s, scene: s, three: n.three })
|
|
75
|
+
},
|
|
76
|
+
s.name
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
a(Date.now());
|
|
80
|
+
};
|
|
81
|
+
return D(() => (n.three.addEventListener(c.ADD_SCENE, d), n.three.addEventListener(c.SET_SCENE, S), n.three.addEventListener(c.REFRESH_SCENE, u), n.three.addEventListener(c.REMOVE_SCENE, f), () => {
|
|
82
|
+
n.three.removeEventListener(c.ADD_SCENE, d), n.three.removeEventListener(c.SET_SCENE, S), n.three.removeEventListener(c.REFRESH_SCENE, u), n.three.removeEventListener(c.REMOVE_SCENE, f);
|
|
83
|
+
}), []), /* @__PURE__ */ C("div", { id: "SidePanel", children: [
|
|
84
|
+
/* @__PURE__ */ i("div", { className: "scenes", children: h }, R),
|
|
85
|
+
/* @__PURE__ */ i(L, { three: n.three }),
|
|
86
|
+
/* @__PURE__ */ i(b, { three: n.three })
|
|
87
|
+
] });
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
T as default
|
|
91
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsxs as r, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as u, useRef as c } from "react";
|
|
3
|
+
import d from "./InspectNumber.js";
|
|
4
|
+
import { radToDeg as b, degToRad as x } from "three/src/math/MathUtils.js";
|
|
5
|
+
function z(n) {
|
|
6
|
+
const f = n.value.x !== void 0 && n.value.y !== void 0 && n.value.z !== void 0, h = n.value.isEuler !== void 0, m = n.value.elements !== void 0, v = n.step !== void 0 ? n.step : 0.01, i = [];
|
|
7
|
+
if (h) {
|
|
8
|
+
const l = u(() => n.value, []);
|
|
9
|
+
["_x", "_y", "_z"].forEach((e) => {
|
|
10
|
+
const t = c(null);
|
|
11
|
+
i.push(
|
|
12
|
+
/* @__PURE__ */ r("div", { children: [
|
|
13
|
+
/* @__PURE__ */ a("span", { ref: t, children: e.substring(1).toUpperCase() }),
|
|
14
|
+
/* @__PURE__ */ a(
|
|
15
|
+
d,
|
|
16
|
+
{
|
|
17
|
+
value: b(l[e]),
|
|
18
|
+
type: "number",
|
|
19
|
+
prop: e,
|
|
20
|
+
step: 0.1,
|
|
21
|
+
labelRef: t,
|
|
22
|
+
onChange: (o, g) => {
|
|
23
|
+
l[o] = x(g), n.onChange({ target: { value: l } });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
] }, e)
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
} else if (f) {
|
|
31
|
+
const l = u(() => n.value, []), s = (t, o) => {
|
|
32
|
+
l[t] = o, n.onChange({ target: { value: l } });
|
|
33
|
+
};
|
|
34
|
+
["x", "y", "z"].forEach((t) => {
|
|
35
|
+
const o = c(null);
|
|
36
|
+
i.push(
|
|
37
|
+
/* @__PURE__ */ r("div", { children: [
|
|
38
|
+
/* @__PURE__ */ a("label", { ref: o, children: t.toUpperCase() }),
|
|
39
|
+
/* @__PURE__ */ a(
|
|
40
|
+
d,
|
|
41
|
+
{
|
|
42
|
+
value: l[t],
|
|
43
|
+
type: "number",
|
|
44
|
+
prop: t,
|
|
45
|
+
step: v,
|
|
46
|
+
labelRef: o,
|
|
47
|
+
onChange: s
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] }, t)
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
} else if (m) {
|
|
54
|
+
const l = u(() => n.value, []), s = (e, t) => {
|
|
55
|
+
const o = Number(e);
|
|
56
|
+
l.elements[o] = t, n.onChange({ target: { value: l } });
|
|
57
|
+
};
|
|
58
|
+
for (let e = 0; e < 9; e++) {
|
|
59
|
+
const t = c(null);
|
|
60
|
+
i.push(
|
|
61
|
+
/* @__PURE__ */ r("div", { children: [
|
|
62
|
+
/* @__PURE__ */ a("label", { ref: t, children: e + 1 }),
|
|
63
|
+
/* @__PURE__ */ a(
|
|
64
|
+
d,
|
|
65
|
+
{
|
|
66
|
+
value: l.elements[e],
|
|
67
|
+
type: "number",
|
|
68
|
+
prop: e.toString(),
|
|
69
|
+
step: v,
|
|
70
|
+
labelRef: t,
|
|
71
|
+
onChange: s
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] }, e.toString())
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return /* @__PURE__ */ a("div", { className: "grid3", children: i }, Math.random().toString());
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
z as default
|
|
82
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsxs as a, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as u, useRef as d } from "react";
|
|
3
|
+
import m from "./InspectNumber.js";
|
|
4
|
+
function b(n) {
|
|
5
|
+
const f = n.value.x !== void 0, i = n.step !== void 0 ? n.step : 0.01, r = [];
|
|
6
|
+
if (f) {
|
|
7
|
+
const o = u(() => n.value, []), c = (e, l) => {
|
|
8
|
+
o[e] = l, n.onChange({ target: { value: o } });
|
|
9
|
+
};
|
|
10
|
+
["x", "y", "z", "w"].forEach((e) => {
|
|
11
|
+
const l = d(null);
|
|
12
|
+
r.push(
|
|
13
|
+
/* @__PURE__ */ a("div", { children: [
|
|
14
|
+
/* @__PURE__ */ s("label", { ref: l, children: e.toUpperCase() }),
|
|
15
|
+
/* @__PURE__ */ s(
|
|
16
|
+
m,
|
|
17
|
+
{
|
|
18
|
+
value: o[e],
|
|
19
|
+
type: "number",
|
|
20
|
+
prop: e,
|
|
21
|
+
step: i,
|
|
22
|
+
labelRef: l,
|
|
23
|
+
onChange: c
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
] }, e)
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
const o = u(() => n.value, []), c = (t, e) => {
|
|
31
|
+
const l = Number(t);
|
|
32
|
+
o.elements[l] = e, n.onChange({ target: { value: o } });
|
|
33
|
+
};
|
|
34
|
+
for (let t = 0; t < 16; t++) {
|
|
35
|
+
const e = d(null);
|
|
36
|
+
r.push(
|
|
37
|
+
/* @__PURE__ */ a("div", { children: [
|
|
38
|
+
/* @__PURE__ */ s("span", { ref: e, children: t + 1 }),
|
|
39
|
+
/* @__PURE__ */ s(
|
|
40
|
+
m,
|
|
41
|
+
{
|
|
42
|
+
value: o.elements[t],
|
|
43
|
+
type: "number",
|
|
44
|
+
prop: t.toString(),
|
|
45
|
+
step: i,
|
|
46
|
+
labelRef: e,
|
|
47
|
+
onChange: c
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] }, t.toString())
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ s("div", { className: "grid4", children: r });
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
b as default
|
|
58
|
+
};
|