@tomorrowevening/hermes 0.1.39 → 0.1.40
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-CB5dBR7Q.js} +1 -1
- 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 +442 -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 +22 -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-DepTXu6T.js} +454 -454
- 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/dist/.vite/manifest.json +0 -12
- package/dist/hermes.es.js +0 -8077
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { Color as g, ColorManagement as l, WebGPURenderer as f, RenderTarget as E, WebGLRenderTarget as S } from "three/webgpu";
|
|
2
|
+
import b from "./BaseRemote.js";
|
|
3
|
+
import { stripObject as u, getSubItem as C, setItemProps as R, textureFromSrc as m, stripScene as o } from "../../editor/sidePanel/utils.js";
|
|
4
|
+
import { clamp as T } from "../../utils/math.js";
|
|
5
|
+
import { dispose as v, hierarchyUUID as h, ExportTexture as c, resetThreeObjects as p } from "../../utils/three.js";
|
|
6
|
+
var O = /* @__PURE__ */ ((i) => (i.CUSTOM = "ToolEvents::custom", i.SELECT_DROPDOWN = "ToolEvents::selectDropdown", i.DRAG_UPDATE = "ToolEvents::dragUpdate", i.ADD_SCENE = "ToolEvents::addScene", i.REFRESH_SCENE = "ToolEvents::refreshScene", i.REMOVE_SCENE = "ToolEvents::removeScene", i.SET_SCENE = "ToolEvents::setScene", i.SET_OBJECT = "ToolEvents::setObject", i.CLEAR_OBJECT = "ToolEvents::clearObject", i.ADD_CAMERA = "ToolEvents::addCamera", i.REMOVE_CAMERA = "ToolEvents::removeCamera", i.ADD_GROUP = "ToolEvents::addGroup", i.REMOVE_GROUP = "ToolEvents::removeGroup", i.ADD_SPLINE = "ToolEvents::addSpline", i.ADD_RENDERER = "ToolEvents::addRenderer", i.UPDATE_RENDERER = "ToolEvents::updateRenderer", i))(O || {});
|
|
7
|
+
class A extends b {
|
|
8
|
+
name;
|
|
9
|
+
canvas = null;
|
|
10
|
+
// Canvas or OffscreenCanvas
|
|
11
|
+
inputElement = null;
|
|
12
|
+
// reference this to receive events
|
|
13
|
+
scene = void 0;
|
|
14
|
+
scenes = /* @__PURE__ */ new Map();
|
|
15
|
+
// scene instances
|
|
16
|
+
renderer = void 0;
|
|
17
|
+
renderTargets = /* @__PURE__ */ new Map();
|
|
18
|
+
renderTargetsResize = /* @__PURE__ */ new Map();
|
|
19
|
+
groups = /* @__PURE__ */ new Map();
|
|
20
|
+
_listeners = {};
|
|
21
|
+
constructor(e, t = !1, r = !1) {
|
|
22
|
+
super("RemoteThree", t, r), this.name = e;
|
|
23
|
+
}
|
|
24
|
+
dispose() {
|
|
25
|
+
this.scenes.forEach((e) => {
|
|
26
|
+
v(e);
|
|
27
|
+
}), this.scenes.clear(), this.scene && v(this.scene), this.renderTargets.forEach((e) => {
|
|
28
|
+
e.dispose();
|
|
29
|
+
}), this.renderTargets.clear(), this.renderer?.dispose();
|
|
30
|
+
}
|
|
31
|
+
// Event Dispatching (used for editor only)
|
|
32
|
+
addEventListener(e, t) {
|
|
33
|
+
this._listeners === void 0 && (this._listeners = {});
|
|
34
|
+
const r = this._listeners;
|
|
35
|
+
r[e] === void 0 && (r[e] = []), r[e].indexOf(t) === -1 && r[e].push(t);
|
|
36
|
+
}
|
|
37
|
+
hasEventListener(e, t) {
|
|
38
|
+
const r = this._listeners;
|
|
39
|
+
return r === void 0 ? !1 : r[e] !== void 0 && r[e].indexOf(t) !== -1;
|
|
40
|
+
}
|
|
41
|
+
removeEventListener(e, t) {
|
|
42
|
+
const r = this._listeners;
|
|
43
|
+
if (r === void 0) return;
|
|
44
|
+
const s = r[e];
|
|
45
|
+
if (s !== void 0) {
|
|
46
|
+
const d = s.indexOf(t);
|
|
47
|
+
d !== -1 && s.splice(d, 1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
dispatchEvent(e) {
|
|
51
|
+
const t = this._listeners;
|
|
52
|
+
if (t === void 0) return;
|
|
53
|
+
const r = t[e.type];
|
|
54
|
+
if (r !== void 0) {
|
|
55
|
+
const s = { ...e, target: this }, d = r.slice(0);
|
|
56
|
+
for (let a = 0, n = d.length; a < n; a++)
|
|
57
|
+
d[a].call(this, s);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Objects
|
|
61
|
+
/**
|
|
62
|
+
* Searches ALL active scenes
|
|
63
|
+
*/
|
|
64
|
+
getObjectByUUID(e) {
|
|
65
|
+
const t = e.split(".")[0], r = this.scenes.get(t);
|
|
66
|
+
if (r !== void 0)
|
|
67
|
+
return r.getObjectByProperty("uuid", e);
|
|
68
|
+
}
|
|
69
|
+
getObject(e) {
|
|
70
|
+
if (!this.debug) return;
|
|
71
|
+
this.renderer !== void 0 && (c.renderer = this.renderer);
|
|
72
|
+
const t = this.getObjectByUUID(e);
|
|
73
|
+
t && this.setObject(t);
|
|
74
|
+
}
|
|
75
|
+
setObject(e) {
|
|
76
|
+
this.renderer !== void 0 && (c.renderer = this.renderer);
|
|
77
|
+
const t = u(e);
|
|
78
|
+
this.dispatchEvent({ type: "ToolEvents::setObject", value: t });
|
|
79
|
+
}
|
|
80
|
+
requestMethod(e, t, r, s) {
|
|
81
|
+
const d = this.getObjectByUUID(e);
|
|
82
|
+
if (d)
|
|
83
|
+
try {
|
|
84
|
+
s !== void 0 ? C(d, s)[t](r) : d[t](r);
|
|
85
|
+
} catch (a) {
|
|
86
|
+
console.log("Hermes - Error requesting method:", e, t, r), console.log(a);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
updateObject(e, t, r) {
|
|
90
|
+
this.send({
|
|
91
|
+
event: "updateObject",
|
|
92
|
+
target: "app",
|
|
93
|
+
// used by both
|
|
94
|
+
data: {
|
|
95
|
+
uuid: e,
|
|
96
|
+
key: t,
|
|
97
|
+
value: r
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
createTexture(e, t, r) {
|
|
102
|
+
this.send({
|
|
103
|
+
event: "createTexture",
|
|
104
|
+
target: "app",
|
|
105
|
+
// used by both
|
|
106
|
+
data: {
|
|
107
|
+
uuid: e,
|
|
108
|
+
key: t,
|
|
109
|
+
value: r
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
onUpdateObject(e, t, r) {
|
|
114
|
+
const s = this.getObjectByUUID(e);
|
|
115
|
+
s && R(s, t, r);
|
|
116
|
+
}
|
|
117
|
+
onCreateTexture(e, t, r) {
|
|
118
|
+
const s = this.getObjectByUUID(e);
|
|
119
|
+
if (s) {
|
|
120
|
+
const d = (a) => {
|
|
121
|
+
const n = t.split(".");
|
|
122
|
+
switch (n.length) {
|
|
123
|
+
case 1:
|
|
124
|
+
s[n[0]] = a;
|
|
125
|
+
break;
|
|
126
|
+
case 2:
|
|
127
|
+
s[n[0]][n[1]] = a;
|
|
128
|
+
break;
|
|
129
|
+
case 3:
|
|
130
|
+
s[n[0]][n[1]][n[2]] = a;
|
|
131
|
+
break;
|
|
132
|
+
case 4:
|
|
133
|
+
s[n[0]][n[1]][n[2]][n[3]] = a;
|
|
134
|
+
break;
|
|
135
|
+
case 5:
|
|
136
|
+
s[n[0]][n[1]][n[2]][n[3]][n[4]] = a;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
s.material.needsUpdate = !0;
|
|
140
|
+
};
|
|
141
|
+
r.src.length > 0 ? m(r.src).then((a) => {
|
|
142
|
+
a.offset.set(r.offset[0], r.offset[1]), a.repeat.set(r.repeat[0], r.repeat[1]), d(a);
|
|
143
|
+
}) : d(null);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Groups
|
|
147
|
+
addGroup(e) {
|
|
148
|
+
this.groups.get(e.title) === void 0 && (this.groups.set(e.title, {
|
|
149
|
+
title: e.title,
|
|
150
|
+
onUpdate: e.onUpdate
|
|
151
|
+
}), this.send({
|
|
152
|
+
event: "addGroup",
|
|
153
|
+
target: "editor",
|
|
154
|
+
data: JSON.stringify(e)
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
removeGroup(e) {
|
|
158
|
+
this.groups.get(e) !== void 0 && (this.groups.delete(e), this.send({
|
|
159
|
+
event: "removeGroup",
|
|
160
|
+
target: "editor",
|
|
161
|
+
data: e
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
updateGroup(e, t, r) {
|
|
165
|
+
this.send({
|
|
166
|
+
event: "updateGroup",
|
|
167
|
+
target: "app",
|
|
168
|
+
data: JSON.stringify({ group: e, prop: t, value: r })
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
addSplineCurve(e) {
|
|
172
|
+
setTimeout(() => {
|
|
173
|
+
this.send({
|
|
174
|
+
event: "addSpline",
|
|
175
|
+
target: "editor",
|
|
176
|
+
data: JSON.stringify(e.toJSON())
|
|
177
|
+
});
|
|
178
|
+
}, 1);
|
|
179
|
+
}
|
|
180
|
+
addSplineObject(e) {
|
|
181
|
+
setTimeout(() => {
|
|
182
|
+
this.send({
|
|
183
|
+
event: "addSpline",
|
|
184
|
+
target: "editor",
|
|
185
|
+
data: JSON.stringify(e)
|
|
186
|
+
});
|
|
187
|
+
}, 1);
|
|
188
|
+
}
|
|
189
|
+
// Renderer
|
|
190
|
+
setRenderer(e, t = null) {
|
|
191
|
+
if (this.renderer = e, this.canvas = e.domElement, this.inputElement = t !== null ? t : this.canvas, !this.debug) return;
|
|
192
|
+
const r = `#${e.getClearColor(new g()).getHexString()}`;
|
|
193
|
+
this.send({
|
|
194
|
+
event: "addRenderer",
|
|
195
|
+
target: "editor",
|
|
196
|
+
data: {
|
|
197
|
+
autoClearColor: e.autoClearColor,
|
|
198
|
+
outputColorSpace: e.outputColorSpace,
|
|
199
|
+
clearColor: r,
|
|
200
|
+
clearAlpha: e.getClearAlpha(),
|
|
201
|
+
colorManagement: l.enabled,
|
|
202
|
+
toneMapping: e.toneMapping,
|
|
203
|
+
toneMappingExposure: e.toneMappingExposure,
|
|
204
|
+
type: e.isWebGLRenderer ? "WebGLRenderer" : "WebGPURenderer"
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
updateRenderer(e) {
|
|
209
|
+
this.send({
|
|
210
|
+
event: "updateRenderer",
|
|
211
|
+
target: "app",
|
|
212
|
+
data: e
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
// Scenes
|
|
216
|
+
addScene(e) {
|
|
217
|
+
if (e === void 0 || (this.scenes.set(e.name, e), !this.debug)) return;
|
|
218
|
+
p(), h(e);
|
|
219
|
+
const t = o(e);
|
|
220
|
+
this.send({
|
|
221
|
+
event: "addScene",
|
|
222
|
+
target: "editor",
|
|
223
|
+
data: t
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
refreshScene(e) {
|
|
227
|
+
if (!this.debug) return;
|
|
228
|
+
const t = this.scenes.get(e);
|
|
229
|
+
if (t !== void 0) {
|
|
230
|
+
const r = o(t);
|
|
231
|
+
this.send({
|
|
232
|
+
event: "refreshScene",
|
|
233
|
+
target: "app",
|
|
234
|
+
data: r
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
removeScene(e) {
|
|
239
|
+
if (e === void 0 || (this.scenes.delete(e.name), !this.debug)) return;
|
|
240
|
+
const t = o(e);
|
|
241
|
+
this.send({
|
|
242
|
+
event: "removeScene",
|
|
243
|
+
target: "editor",
|
|
244
|
+
data: t
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
removeAllScenes() {
|
|
248
|
+
this.scenes.forEach((e) => this.removeScene(e));
|
|
249
|
+
}
|
|
250
|
+
getScene(e) {
|
|
251
|
+
let t = null;
|
|
252
|
+
return this.scene !== void 0 && this.scene.uuid.search(e) > -1 ? this.scene : (this.scenes.forEach((r, s) => {
|
|
253
|
+
e.search(s) > -1 && (t = r);
|
|
254
|
+
}), t);
|
|
255
|
+
}
|
|
256
|
+
setScene(e) {
|
|
257
|
+
if (e === void 0 || (this.scene = e, !this.debug)) return;
|
|
258
|
+
this.renderer !== void 0 && (c.renderer = this.renderer), p(), h(e);
|
|
259
|
+
const t = o(e);
|
|
260
|
+
this.send({
|
|
261
|
+
event: "setScene",
|
|
262
|
+
target: "editor",
|
|
263
|
+
data: t
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
requestSize() {
|
|
267
|
+
this.send({
|
|
268
|
+
event: "requestSize",
|
|
269
|
+
target: "app"
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
requestRenderer() {
|
|
273
|
+
this.send({
|
|
274
|
+
event: "requestRenderer",
|
|
275
|
+
target: "app"
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
requestScene() {
|
|
279
|
+
this.send({
|
|
280
|
+
event: "requestScene",
|
|
281
|
+
target: "app"
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
// Cameras
|
|
285
|
+
addCamera(e) {
|
|
286
|
+
if (!this.debug) return;
|
|
287
|
+
const t = u(e);
|
|
288
|
+
this.send({
|
|
289
|
+
event: "addCamera",
|
|
290
|
+
target: "editor",
|
|
291
|
+
data: t
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
removeCamera(e) {
|
|
295
|
+
if (!this.debug) return;
|
|
296
|
+
const t = u(e);
|
|
297
|
+
this.send({
|
|
298
|
+
event: "removeCamera",
|
|
299
|
+
target: "editor",
|
|
300
|
+
data: t
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
handleApp(e) {
|
|
304
|
+
switch (e.event) {
|
|
305
|
+
case "refreshScene":
|
|
306
|
+
this.send({
|
|
307
|
+
event: "refreshScene",
|
|
308
|
+
target: "editor",
|
|
309
|
+
data: o(this.scenes.get(e.data.name))
|
|
310
|
+
});
|
|
311
|
+
break;
|
|
312
|
+
case "updateRenderer":
|
|
313
|
+
this.renderer && (this.renderer.autoClearColor = e.data.autoClearColor, this.renderer.outputColorSpace = e.data.outputColorSpace, this.renderer.setClearColor(e.data.clearColor, e.data.clearAlpha), this.renderer.toneMapping = e.data.toneMapping, this.renderer.toneMappingExposure = e.data.toneMappingExposure, l.enabled = e.data.colorManagement);
|
|
314
|
+
break;
|
|
315
|
+
case "requestRenderer":
|
|
316
|
+
if (this.renderer !== void 0) {
|
|
317
|
+
const t = `#${this.renderer.getClearColor(new g()).getHexString()}`;
|
|
318
|
+
this.send({
|
|
319
|
+
event: "addRenderer",
|
|
320
|
+
target: "editor",
|
|
321
|
+
data: {
|
|
322
|
+
autoClearColor: this.renderer.autoClearColor,
|
|
323
|
+
outputColorSpace: this.renderer.outputColorSpace,
|
|
324
|
+
clearColor: t,
|
|
325
|
+
clearAlpha: this.renderer.getClearAlpha(),
|
|
326
|
+
colorManagement: l.enabled,
|
|
327
|
+
toneMapping: this.renderer.toneMapping,
|
|
328
|
+
toneMappingExposure: this.renderer.toneMappingExposure,
|
|
329
|
+
type: this.renderer.isWebGLRenderer ? "WebGLRenderer" : "WebGPURenderer"
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
break;
|
|
334
|
+
case "requestScene":
|
|
335
|
+
this.scenes.forEach((t) => {
|
|
336
|
+
p(), h(t), this.send({
|
|
337
|
+
event: "addScene",
|
|
338
|
+
target: "editor",
|
|
339
|
+
data: o(t)
|
|
340
|
+
});
|
|
341
|
+
}), this.scene !== void 0 && (this.renderer !== void 0 && (c.renderer = this.renderer), p(), h(this.scene), this.send({
|
|
342
|
+
event: "setScene",
|
|
343
|
+
target: "editor",
|
|
344
|
+
data: o(this.scene)
|
|
345
|
+
}));
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
if (e.event === "updateGroup") {
|
|
349
|
+
const t = JSON.parse(e.data);
|
|
350
|
+
this.groups.get(t.group)?.onUpdate(t.prop, t.value);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
handleEditor(e) {
|
|
354
|
+
switch (e.event) {
|
|
355
|
+
case "addScene":
|
|
356
|
+
this.dispatchEvent({ type: "ToolEvents::addScene", value: e.data });
|
|
357
|
+
break;
|
|
358
|
+
case "refreshScene":
|
|
359
|
+
this.dispatchEvent({ type: "ToolEvents::refreshScene", value: e.data });
|
|
360
|
+
break;
|
|
361
|
+
case "removeScene":
|
|
362
|
+
this.dispatchEvent({ type: "ToolEvents::removeScene", value: e.data });
|
|
363
|
+
break;
|
|
364
|
+
case "setScene":
|
|
365
|
+
this.dispatchEvent({ type: "ToolEvents::setScene", value: e.data });
|
|
366
|
+
break;
|
|
367
|
+
case "addCamera":
|
|
368
|
+
this.dispatchEvent({ type: "ToolEvents::addCamera", value: e.data });
|
|
369
|
+
break;
|
|
370
|
+
case "removeCamera":
|
|
371
|
+
this.dispatchEvent({ type: "ToolEvents::removeCamera", value: e.data });
|
|
372
|
+
break;
|
|
373
|
+
case "addGroup":
|
|
374
|
+
this.dispatchEvent({ type: "ToolEvents::addGroup", value: e.data });
|
|
375
|
+
break;
|
|
376
|
+
case "removeGroup":
|
|
377
|
+
this.dispatchEvent({ type: "ToolEvents::removeGroup", value: e.data });
|
|
378
|
+
break;
|
|
379
|
+
case "addSpline":
|
|
380
|
+
this.dispatchEvent({ type: "ToolEvents::addSpline", value: e.data });
|
|
381
|
+
break;
|
|
382
|
+
case "addRenderer":
|
|
383
|
+
this.dispatchEvent({ type: "ToolEvents::addRenderer", value: e.data });
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
messageHandler(e) {
|
|
387
|
+
const t = e.data;
|
|
388
|
+
if (t.event === "updateObject") {
|
|
389
|
+
this.onUpdateObject(t.data.uuid, t.data.key, t.data.value);
|
|
390
|
+
return;
|
|
391
|
+
} else if (t.event === "createTexture") {
|
|
392
|
+
this.onCreateTexture(t.data.uuid, t.data.key, t.data.value);
|
|
393
|
+
return;
|
|
394
|
+
} else if (t.event === "requestSize") {
|
|
395
|
+
t.target === "app" ? this.send({
|
|
396
|
+
event: "requestSize",
|
|
397
|
+
target: "editor",
|
|
398
|
+
data: {
|
|
399
|
+
width: this.width,
|
|
400
|
+
height: this.height
|
|
401
|
+
}
|
|
402
|
+
}) : this.scenes.forEach((r) => {
|
|
403
|
+
r.resize !== void 0 && r.resize(t.data.width, t.data.height);
|
|
404
|
+
});
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
t.target === "app" ? this.handleApp(t) : this.handleEditor(t);
|
|
408
|
+
}
|
|
409
|
+
// Renderer
|
|
410
|
+
addRT(e, t = !0, r) {
|
|
411
|
+
if (!this.renderer) return;
|
|
412
|
+
let s;
|
|
413
|
+
this.renderer instanceof f ? s = new E(32, 32, r) : s = new S(32, 32, r), s.texture.name = e, this.renderTargets.set(e, s), this.renderTargetsResize.set(e, t);
|
|
414
|
+
}
|
|
415
|
+
removeRT(e) {
|
|
416
|
+
this.renderTargets.delete(e), this.renderTargetsResize.delete(e);
|
|
417
|
+
}
|
|
418
|
+
resize(e, t) {
|
|
419
|
+
const r = this.dpr;
|
|
420
|
+
this.renderTargets.forEach((d, a) => {
|
|
421
|
+
this.renderTargetsResize.get(a) && d.setSize(e * r, t * r);
|
|
422
|
+
});
|
|
423
|
+
const s = !(this.renderer?.domElement instanceof OffscreenCanvas);
|
|
424
|
+
this.renderer?.setSize(e, t, s);
|
|
425
|
+
}
|
|
426
|
+
set dpr(e) {
|
|
427
|
+
this.renderer?.setPixelRatio(T(1, 2, e));
|
|
428
|
+
}
|
|
429
|
+
get dpr() {
|
|
430
|
+
return this.renderer !== void 0 ? this.renderer?.getPixelRatio() : 1;
|
|
431
|
+
}
|
|
432
|
+
get width() {
|
|
433
|
+
return this.renderer !== void 0 ? this.renderer.domElement.width / this.dpr : 0;
|
|
434
|
+
}
|
|
435
|
+
get height() {
|
|
436
|
+
return this.renderer !== void 0 ? this.renderer.domElement.height / this.dpr : 0;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
export {
|
|
440
|
+
O as ToolEvents,
|
|
441
|
+
A as default
|
|
442
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as a } from "react";
|
|
3
|
+
/* empty css */
|
|
4
|
+
const i = a((e, d) => /* @__PURE__ */ t("div", { className: "editor", ref: d, style: e.style, children: [
|
|
5
|
+
e.header && /* @__PURE__ */ r("div", { className: "header", children: e.header }),
|
|
6
|
+
e.children,
|
|
7
|
+
e.footer && /* @__PURE__ */ r("div", { className: "footer", children: e.footer })
|
|
8
|
+
] }));
|
|
9
|
+
i.displayName = "Editor";
|
|
10
|
+
export {
|
|
11
|
+
i as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as t, Fragment as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as u, useEffect as l } from "react";
|
|
3
|
+
function m(i) {
|
|
4
|
+
const {
|
|
5
|
+
app: e,
|
|
6
|
+
renderEditor: n,
|
|
7
|
+
onLoad: o,
|
|
8
|
+
renderLoading: s = null,
|
|
9
|
+
children: c
|
|
10
|
+
} = i, [a, d] = u(!1);
|
|
11
|
+
if (l(() => {
|
|
12
|
+
e.detectSettings().then(() => {
|
|
13
|
+
o ? o(e).then(() => d(!0)) : d(!0);
|
|
14
|
+
});
|
|
15
|
+
}, []), !a) return /* @__PURE__ */ t(r, { children: s });
|
|
16
|
+
if (e.editor && n) {
|
|
17
|
+
const f = e.components.get("three");
|
|
18
|
+
return /* @__PURE__ */ t(r, { children: n(f) });
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ t(r, { children: c?.(e) });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
m as default
|
|
24
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs as t, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import r from "./Editor.js";
|
|
3
|
+
import i from "./multiView/MultiView.js";
|
|
4
|
+
import o from "./sidePanel/SidePanel.js";
|
|
5
|
+
function f(e) {
|
|
6
|
+
return /* @__PURE__ */ t(r, { children: [
|
|
7
|
+
/* @__PURE__ */ n(
|
|
8
|
+
i,
|
|
9
|
+
{
|
|
10
|
+
three: e.three,
|
|
11
|
+
scenes: e.scenes,
|
|
12
|
+
onSceneAdd: e.onSceneAdd,
|
|
13
|
+
onSceneResize: e.onSceneResize,
|
|
14
|
+
onSceneUpdate: e.onSceneUpdate
|
|
15
|
+
}
|
|
16
|
+
),
|
|
17
|
+
/* @__PURE__ */ n(o, { three: e.three })
|
|
18
|
+
] });
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
f as default
|
|
22
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsxs as x, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l } from "react";
|
|
3
|
+
import I from "./NavButton.js";
|
|
4
|
+
import v from "./DraggableItem.js";
|
|
5
|
+
function E(n) {
|
|
6
|
+
const [g, d] = l(!1), [o, i] = l(n.options), [s, a] = l(null), m = (e) => {
|
|
7
|
+
n.onDragComplete(e), i(e);
|
|
8
|
+
}, u = (e) => {
|
|
9
|
+
const t = [...o];
|
|
10
|
+
t.splice(e, 1), m(t);
|
|
11
|
+
}, p = (e) => {
|
|
12
|
+
a(e);
|
|
13
|
+
}, f = (e) => {
|
|
14
|
+
if (s === e || s === null) return;
|
|
15
|
+
const t = [...o], b = t.splice(s, 1)[0];
|
|
16
|
+
t.splice(e, 0, b), a(e), i(t);
|
|
17
|
+
}, D = () => {
|
|
18
|
+
n.onDragComplete(o), a(null);
|
|
19
|
+
};
|
|
20
|
+
let c = "dropdown draggable";
|
|
21
|
+
return n.subdropdown && (c += " subdropdown"), /* @__PURE__ */ x("div", { className: c, onMouseEnter: () => d(!0), onMouseLeave: () => d(!1), children: [
|
|
22
|
+
/* @__PURE__ */ r(I, { title: n.title }),
|
|
23
|
+
/* @__PURE__ */ r("ul", { className: "reorder-list", style: { display: g ? "block" : "none" }, children: o.map((e, t) => /* @__PURE__ */ r(
|
|
24
|
+
v,
|
|
25
|
+
{
|
|
26
|
+
title: e,
|
|
27
|
+
index: t,
|
|
28
|
+
draggingIndex: s,
|
|
29
|
+
onDelete: u,
|
|
30
|
+
onDragStart: p,
|
|
31
|
+
onDragOver: f,
|
|
32
|
+
onDragEnd: D
|
|
33
|
+
},
|
|
34
|
+
e
|
|
35
|
+
)) })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
E as default
|
|
40
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as n, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import t from "./icons/CloseIcon.js";
|
|
3
|
+
import i from "./icons/DragIcon.js";
|
|
4
|
+
function o(e) {
|
|
5
|
+
return /* @__PURE__ */ n(
|
|
6
|
+
"li",
|
|
7
|
+
{
|
|
8
|
+
className: `reorder-item ${e.draggingIndex === e.index ? "dragging" : ""}`,
|
|
9
|
+
draggable: !0,
|
|
10
|
+
onDragStart: () => e.onDragStart(e.index),
|
|
11
|
+
onDragOver: (r) => {
|
|
12
|
+
r.preventDefault(), e.onDragOver(e.index);
|
|
13
|
+
},
|
|
14
|
+
onDragEnd: e.onDragEnd,
|
|
15
|
+
children: /* @__PURE__ */ a("div", { children: [
|
|
16
|
+
i,
|
|
17
|
+
/* @__PURE__ */ n("span", { children: e.title }),
|
|
18
|
+
/* @__PURE__ */ n("button", { className: "closeIcon", onClick: () => e.onDelete(e.index), children: t })
|
|
19
|
+
] })
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
o as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a } from "react";
|
|
3
|
+
import m from "./NavButton.js";
|
|
4
|
+
import u from "./DropdownItem.js";
|
|
5
|
+
function w(e) {
|
|
6
|
+
const [s, o] = a(!1), n = [];
|
|
7
|
+
e.options.map((i, l) => {
|
|
8
|
+
e.onSelect !== void 0 && (i.onSelect = e.onSelect), n.push(/* @__PURE__ */ t(u, { option: i }, l));
|
|
9
|
+
});
|
|
10
|
+
let d = "dropdown";
|
|
11
|
+
return e.subdropdown && (d += " subdropdown"), /* @__PURE__ */ r(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: d,
|
|
15
|
+
onMouseEnter: () => o(!0),
|
|
16
|
+
onMouseLeave: () => o(!1),
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ t(m, { title: e.title }),
|
|
19
|
+
/* @__PURE__ */ t(
|
|
20
|
+
"ul",
|
|
21
|
+
{
|
|
22
|
+
style: { visibility: s ? "visible" : "hidden" },
|
|
23
|
+
children: n
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
w as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a } from "react";
|
|
3
|
+
import s from "./Draggable.js";
|
|
4
|
+
import c from "./Dropdown.js";
|
|
5
|
+
import { randomID as p } from "../utils.js";
|
|
6
|
+
function g(i) {
|
|
7
|
+
const { option: e } = i, [l, r] = a("");
|
|
8
|
+
let t;
|
|
9
|
+
switch (e.type) {
|
|
10
|
+
case "draggable":
|
|
11
|
+
t = /* @__PURE__ */ o(
|
|
12
|
+
s,
|
|
13
|
+
{
|
|
14
|
+
title: e.title,
|
|
15
|
+
options: e.value,
|
|
16
|
+
onDragComplete: (n) => {
|
|
17
|
+
e.onDragComplete !== void 0 && e.onDragComplete(n);
|
|
18
|
+
},
|
|
19
|
+
subdropdown: !0
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
break;
|
|
23
|
+
case "dropdown":
|
|
24
|
+
t = /* @__PURE__ */ o(
|
|
25
|
+
c,
|
|
26
|
+
{
|
|
27
|
+
title: e.title,
|
|
28
|
+
options: e.value,
|
|
29
|
+
onSelect: e.onSelect,
|
|
30
|
+
subdropdown: !0
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
break;
|
|
34
|
+
case "option":
|
|
35
|
+
t = /* @__PURE__ */ o(
|
|
36
|
+
"button",
|
|
37
|
+
{
|
|
38
|
+
onClick: () => {
|
|
39
|
+
e.onSelect !== void 0 && e.onSelect(e.value), e.selectable && (l !== e.title ? r(e.title) : r(""));
|
|
40
|
+
},
|
|
41
|
+
children: e.title
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
return /* @__PURE__ */ o("li", { className: l === e.title ? "selected" : "", children: t }, p());
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
g as default
|
|
50
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
function l(t) {
|
|
3
|
+
return t.title.search("<") > -1 ? /* @__PURE__ */ e("button", { className: "svg", dangerouslySetInnerHTML: { __html: t.title } }) : /* @__PURE__ */ e("button", { children: t.title });
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
l as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const A = "data:image/gif;base64,R0lGODlhDgFkAIAAAP///wAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDIgNzkuZGJhM2RhM2I1LCAyMDIzLzEyLzE1LTEwOjQyOjM3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjUuNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoyMDk3M0NEODAxQjQxMUVGODVGNENDMkUyMUExNDk1NSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMDk3M0NEOTAxQjQxMUVGODVGNENDMkUyMUExNDk1NSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkE4ODc3Qzg5MDFCMzExRUY4NUY0Q0MyRTIxQTE0OTU1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkE4ODc3QzhBMDFCMzExRUY4NUY0Q0MyRTIxQTE0OTU1Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAAAAAAAsAAAAAA4BZAAAAv+Mj6nL7Q+jnLTai7PevPsPhuJIluaJpurKtu4Lx/JM1/aN5/rO9/4PDAqHxKLxiEwql8ym8wmNSqfUqvWKzWq33K73Cw6Lx+Sy+YxOq9fstvsNj8vn9Lr9js/r9/y+/w8YKDhIWGh4iJiouMjY6PgIGSk5SVlpeYmZqTkJAGDQ+dnpuekmGgAKejpKuiZqmprKqoZKGyrbOlqrejub6xvLGyw8TFzcprurGuvqybxq7ETbrItsCz0l7Zpc+6p9/cS967w9/S2FTF0u/mzehK4Oqz3eTl9vf4+fr7/P3+//DzCgwIEECxo8iDChwoUMGzp8CDGixIkUK1q8iDGjxo0XHDt6/AgypMiRJEuaPIkypcqVLFt+KwAAOw==";
|
|
2
|
+
export {
|
|
3
|
+
A as noImage
|
|
4
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
const l = /* @__PURE__ */ s("svg", { className: "closeIcon", width: "14", height: "14", fill: "none", stroke: "#666666", strokeMiterlimit: "10", children: [
|
|
3
|
+
/* @__PURE__ */ e("circle", { cx: "7", cy: "7", r: "6" }),
|
|
4
|
+
/* @__PURE__ */ e("line", { x1: "4", y1: "4", x2: "10", y2: "10" }),
|
|
5
|
+
/* @__PURE__ */ e("line", { x1: "4", y1: "10", x2: "10", y2: "4" })
|
|
6
|
+
] });
|
|
7
|
+
export {
|
|
8
|
+
l as default
|
|
9
|
+
};
|