@tomorrowevening/hermes 0.0.33 → 0.0.35

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 (52) hide show
  1. package/package.json +2 -6
  2. package/src/core/Application.ts +0 -111
  3. package/src/core/RemoteController.ts +0 -60
  4. package/src/core/remote/BaseRemote.ts +0 -16
  5. package/src/core/remote/RemoteComponents.ts +0 -45
  6. package/src/core/remote/RemoteTheatre.ts +0 -300
  7. package/src/core/remote/RemoteThree.ts +0 -143
  8. package/src/core/remote/RemoteTweakpane.ts +0 -194
  9. package/src/core/types.ts +0 -56
  10. package/src/editor/Editor.tsx +0 -20
  11. package/src/editor/components/Draggable.tsx +0 -40
  12. package/src/editor/components/DraggableItem.tsx +0 -22
  13. package/src/editor/components/Dropdown.tsx +0 -38
  14. package/src/editor/components/DropdownItem.tsx +0 -64
  15. package/src/editor/components/NavButton.tsx +0 -11
  16. package/src/editor/components/content.ts +0 -2
  17. package/src/editor/components/icons/CloseIcon.tsx +0 -7
  18. package/src/editor/components/icons/DragIcon.tsx +0 -9
  19. package/src/editor/components/types.ts +0 -41
  20. package/src/editor/global.ts +0 -20
  21. package/src/editor/multiView/CameraWindow.tsx +0 -74
  22. package/src/editor/multiView/InfiniteGridHelper.ts +0 -24
  23. package/src/editor/multiView/InfiniteGridMaterial.ts +0 -127
  24. package/src/editor/multiView/MultiView.scss +0 -101
  25. package/src/editor/multiView/MultiView.tsx +0 -636
  26. package/src/editor/multiView/MultiViewData.ts +0 -59
  27. package/src/editor/multiView/UVMaterial.ts +0 -55
  28. package/src/editor/scss/_debug.scss +0 -58
  29. package/src/editor/scss/_draggable.scss +0 -43
  30. package/src/editor/scss/_dropdown.scss +0 -84
  31. package/src/editor/scss/_sidePanel.scss +0 -278
  32. package/src/editor/scss/_theme.scss +0 -9
  33. package/src/editor/scss/index.scss +0 -67
  34. package/src/editor/sidePanel/Accordion.tsx +0 -41
  35. package/src/editor/sidePanel/ChildObject.tsx +0 -57
  36. package/src/editor/sidePanel/ContainerObject.tsx +0 -11
  37. package/src/editor/sidePanel/SidePanel.tsx +0 -64
  38. package/src/editor/sidePanel/ToggleBtn.tsx +0 -27
  39. package/src/editor/sidePanel/inspector/Inspector.tsx +0 -119
  40. package/src/editor/sidePanel/inspector/InspectorField.tsx +0 -198
  41. package/src/editor/sidePanel/inspector/InspectorGroup.tsx +0 -50
  42. package/src/editor/sidePanel/inspector/SceneInspector.tsx +0 -84
  43. package/src/editor/sidePanel/inspector/inspector.scss +0 -161
  44. package/src/editor/sidePanel/inspector/utils/InspectAnimation.tsx +0 -102
  45. package/src/editor/sidePanel/inspector/utils/InspectCamera.tsx +0 -75
  46. package/src/editor/sidePanel/inspector/utils/InspectLight.tsx +0 -62
  47. package/src/editor/sidePanel/inspector/utils/InspectMaterial.tsx +0 -710
  48. package/src/editor/sidePanel/inspector/utils/InspectTransform.tsx +0 -113
  49. package/src/editor/sidePanel/types.ts +0 -130
  50. package/src/editor/sidePanel/utils.ts +0 -278
  51. package/src/editor/utils.ts +0 -117
  52. package/src/index.ts +0 -27
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "module": "./dist/hermes.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "type": "module",
10
- "version": "0.0.33",
10
+ "version": "0.0.35",
11
11
  "homepage": "https://github.com/tomorrowevening/hermes#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/tomorrowevening/hermes/issues"
@@ -20,9 +20,6 @@
20
20
  "Tweakpane"
21
21
  ],
22
22
  "files": [
23
- "src/index.ts",
24
- "src/core",
25
- "src/editor",
26
23
  "dist/hermes.js",
27
24
  "dist/hermes.umd.cjs",
28
25
  "dist/style.css",
@@ -35,8 +32,7 @@
35
32
  "types": "./types/index.d.ts"
36
33
  },
37
34
  "./dist/style.css": "./dist/style.css",
38
- "./server/index.mjs": "./server/index.mjs",
39
- "./src/*": "./src/*"
35
+ "./server/index.mjs": "./server/index.mjs"
40
36
  },
41
37
  "repository": {
42
38
  "type": "git",
@@ -1,111 +0,0 @@
1
- import BaseRemote from './remote/BaseRemote';
2
- import { ApplicationMode, BroadcastCallback, BroadcastData } from './types';
3
-
4
- export default class Application {
5
- components: Map<string, any> = new Map();
6
- listen?: BroadcastCallback;
7
-
8
- // Protected
9
- protected _debugEnabled: boolean;
10
- protected broadcastChannel?: BroadcastChannel | undefined = undefined;
11
- protected webSocket?: WebSocket | undefined = undefined;
12
- protected _mode: ApplicationMode = 'app';
13
- protected _connected = false;
14
- protected useBC = false;
15
-
16
- constructor(id: string, debugEnabled: boolean, useBC:boolean = true, editorHashtag: string = 'editor') {
17
- this.editor = debugEnabled && document.location.hash.search(editorHashtag) > -1;
18
- this._debugEnabled = debugEnabled;
19
-
20
- if (debugEnabled) {
21
- this.useBC = useBC;
22
- if (useBC) {
23
- this.broadcastChannel = new BroadcastChannel(id);
24
- this.broadcastChannel.addEventListener('message', this.messageHandler);
25
- } else {
26
- this.webSocket = new WebSocket(id);
27
- this.webSocket.addEventListener('open', this.openHandler);
28
- this.webSocket.addEventListener('close', this.closeHandler);
29
- this.webSocket.addEventListener('message', this.messageHandler);
30
- }
31
- }
32
- }
33
-
34
- addComponent(name: string, component: BaseRemote) {
35
- this.components.set(name, component);
36
- }
37
-
38
- dispose() {
39
- if (this.broadcastChannel !== undefined) {
40
- this.broadcastChannel.removeEventListener('message', this.messageHandler);
41
- }
42
- if (this.webSocket !== undefined) {
43
- this.webSocket.removeEventListener('open', this.openHandler);
44
- this.webSocket.removeEventListener('close', this.closeHandler);
45
- this.webSocket.removeEventListener('message', this.messageHandler);
46
- }
47
- this.components.forEach((value: BaseRemote) => {
48
- value.dispose();
49
- });
50
- this.components.clear();
51
- }
52
-
53
- // Remote
54
-
55
- send(data: BroadcastData) {
56
- if (this._mode !== data.target) {
57
- if (this.useBC) {
58
- this.broadcastChannel?.postMessage(data);
59
- } else if (this._connected) {
60
- this.webSocket?.send(JSON.stringify(data));
61
- }
62
- }
63
- }
64
-
65
- private messageHandler = (evt: MessageEvent) => {
66
- if (this.listen !== undefined) {
67
- if (this.useBC) {
68
- this.listen(evt.data);
69
- } else {
70
- this.listen(JSON.parse(evt.data));
71
- }
72
- }
73
- };
74
-
75
- private openHandler = () => {
76
- this._connected = true;
77
- };
78
-
79
- private closeHandler = () => {
80
- this._connected = false;
81
- };
82
-
83
- // Getters / Setters
84
-
85
- get connected(): boolean {
86
- return this._connected;
87
- }
88
-
89
- get debugEnabled(): boolean {
90
- return this._debugEnabled;
91
- }
92
-
93
- get mode(): ApplicationMode {
94
- return this._mode;
95
- }
96
-
97
- get isApp(): boolean {
98
- return this._mode === 'app';
99
- }
100
-
101
- get editor(): boolean {
102
- return this._mode === 'editor';
103
- }
104
-
105
- set editor(value: boolean) {
106
- if (value) {
107
- this._mode = 'editor';
108
- document.title += ' - Editor';
109
- }
110
- }
111
- }
@@ -1,60 +0,0 @@
1
- // Core
2
- import Application from './Application';
3
- import { ToolEvents, debugDispatcher } from '@/editor/global';
4
- import { BroadcastData } from './types';
5
- import BaseRemote from './remote/BaseRemote';
6
- import RemoteComponents, { HandleAppRemoteComponents } from './remote/RemoteComponents';
7
- import RemoteTheatre, { HandleAppRemoteTheatre, HandleEditorRemoteTheatre, UpdateRemoteTheatre } from './remote/RemoteTheatre';
8
- import RemoteThree, { HandleAppRemoteThree, HandleEditorRemoteThree } from './remote/RemoteThree';
9
- import RemoteTweakpane, { HandleAppRemoteTweakpane } from './remote/RemoteTweakpane';
10
-
11
- export default function RemoteController(app: Application) {
12
- const appHandlers: any[] = [];
13
- const editorHandlers: any[] = [];
14
-
15
- // Correct handlers based on the App's components
16
- app.components.forEach((value: BaseRemote) => {
17
- if (value instanceof RemoteComponents) {
18
- appHandlers.push(HandleAppRemoteComponents);
19
- } else if (value instanceof RemoteTheatre) {
20
- appHandlers.push(HandleAppRemoteTheatre);
21
- editorHandlers.push(HandleEditorRemoteTheatre);
22
- UpdateRemoteTheatre(app);
23
- } else if (value instanceof RemoteThree) {
24
- appHandlers.push(HandleAppRemoteThree);
25
- editorHandlers.push(HandleEditorRemoteThree);
26
- } else if (value instanceof RemoteTweakpane) {
27
- appHandlers.push(HandleAppRemoteTweakpane);
28
- }
29
- });
30
-
31
- function handleAppBroadcast(msg: BroadcastData) {
32
- appHandlers.forEach((handler: any) => handler(app, msg));
33
- switch (msg.event) {
34
- case 'custom':
35
- // @ts-ignore
36
- debugDispatcher.dispatchEvent({ type: ToolEvents.CUSTOM, value: msg.data });
37
- break;
38
- }
39
- }
40
-
41
- function handleEditorBroadcast(msg: BroadcastData) {
42
- editorHandlers.forEach((handler: any) => handler(app, msg));
43
- switch (msg.event) {
44
- case 'custom':
45
- // @ts-ignore
46
- debugDispatcher.dispatchEvent({ type: ToolEvents.CUSTOM, value: msg.data });
47
- break;
48
- }
49
- }
50
-
51
- // Begin app
52
-
53
- app.listen = (msg: BroadcastData) => {
54
- if (msg.target === 'editor') {
55
- handleEditorBroadcast(msg);
56
- } else {
57
- handleAppBroadcast(msg);
58
- }
59
- };
60
- }
@@ -1,16 +0,0 @@
1
- import Application from '../Application';
2
-
3
- /**
4
- * Base class for remote-related extensions
5
- */
6
- export default class BaseRemote {
7
- protected app: Application;
8
-
9
- constructor(app: Application) {
10
- this.app = app;
11
- }
12
-
13
- dispose() {
14
- //
15
- }
16
- }
@@ -1,45 +0,0 @@
1
- // Core
2
- import { ToolEvents, debugDispatcher } from '@/editor/global';
3
- import Application from '../Application';
4
- import BaseRemote from './BaseRemote';
5
- import { BroadcastData } from '../types';
6
-
7
- /**
8
- * Communicates between custom React Components
9
- */
10
- export default class RemoteComponents extends BaseRemote {
11
- selectDropdown(dropdown: string, value: any) {
12
- this.app.send({
13
- event: 'selectComponent',
14
- target: 'app',
15
- data: {
16
- dropdown,
17
- value
18
- }
19
- });
20
- }
21
-
22
- updateDropdown(dropdown: string, list: string[]) {
23
- this.app.send({
24
- event: 'draggableListUpdate',
25
- target: 'app',
26
- data: {
27
- dropdown,
28
- value: list
29
- }
30
- });
31
- }
32
- }
33
-
34
- export function HandleAppRemoteComponents(_: Application, msg: BroadcastData) {
35
- switch (msg.event) {
36
- case 'selectComponent':
37
- // @ts-ignore
38
- debugDispatcher.dispatchEvent({ type: ToolEvents.SELECT_DROPDOWN, value: msg.data });
39
- break;
40
- case 'draggableListUpdate':
41
- // @ts-ignore
42
- debugDispatcher.dispatchEvent({ type: ToolEvents.DRAG_UPDATE, value: msg.data });
43
- break;
44
- }
45
- }
@@ -1,300 +0,0 @@
1
- // Libs
2
- import { createRafDriver, getProject } from '@theatre/core';
3
- import { IProject, IProjectConfig, IRafDriver, ISheet, ISheetObject } from '@theatre/core';
4
- import studio from '@theatre/studio';
5
- // Core
6
- import Application from '../Application';
7
- import BaseRemote from './BaseRemote';
8
- import { isColor } from '@/editor/utils';
9
- import { BroadcastData, DataUpdateCallback, EditorEvent, VoidCallback, noop } from '../types';
10
-
11
- export default class RemoteTheatre extends BaseRemote {
12
- project: IProject | undefined;
13
- sheets: Map<string, ISheet> = new Map();
14
- sheetObjects: Map<string, ISheetObject> = new Map();
15
- sheetObjectCBs: Map<string, DataUpdateCallback> = new Map();
16
- sheetObjectUnsubscribe: Map<string, VoidCallback> = new Map();
17
-
18
- private static rafDriver: IRafDriver | null = null;
19
-
20
- init(projectName: string, projectConfig?: IProjectConfig | undefined): Promise<void> {
21
- this.project = getProject(projectName, projectConfig);
22
- return this.project.ready;
23
- }
24
-
25
- override dispose(): void {
26
- this.project = undefined;
27
- this.sheets = new Map();
28
- this.sheetObjects = new Map();
29
- this.sheetObjectCBs = new Map();
30
- this.sheetObjectUnsubscribe = new Map();
31
- }
32
-
33
- sheet(name: string): ISheet | undefined {
34
- if (this.project === undefined) {
35
- console.error('Theatre Project hasn\'t been created yet.');
36
- return undefined;
37
- }
38
-
39
- let sheet = this.sheets.get(name);
40
- if (sheet !== undefined) return sheet;
41
-
42
- sheet = this.project?.sheet(name);
43
- this.sheets.set(name, sheet);
44
- return sheet;
45
- }
46
-
47
- playSheet(name: string, params?: any) {
48
- this.sheet(name)?.sequence.play(params);
49
-
50
- this.app.send({
51
- event: 'playSheet',
52
- target: 'editor',
53
- data: {
54
- sheet: name,
55
- value: params,
56
- },
57
- });
58
- }
59
-
60
- pauseSheet(name: string) {
61
- this.sheet(name)?.sequence.pause();
62
-
63
- this.app.send({
64
- event: 'pauseSheet',
65
- target: 'editor',
66
- data: {
67
- sheet: name,
68
- },
69
- });
70
- }
71
-
72
- clearSheetObjects(sheetName: string) {
73
- this.sheetObjects.forEach((value: ISheetObject, key: string) => {
74
- const sameSheet = key.search(`${sheetName}_`) > -1;
75
- if (sameSheet) this.unsubscribe(value);
76
- });
77
- }
78
-
79
- sheetObject(
80
- sheetName: string,
81
- key: string,
82
- props: any,
83
- onUpdate?: DataUpdateCallback,
84
- ): ISheetObject | undefined {
85
- if (this.project === undefined) {
86
- console.error('Theatre Project hasn\'t been created yet.');
87
- return undefined;
88
- }
89
- const sheet = this.sheet(sheetName);
90
- if (sheet === undefined) return undefined;
91
-
92
- const objName = `${sheetName}_${key}`;
93
- let obj = this.sheetObjects.get(objName);
94
- if (obj !== undefined) {
95
- obj = sheet.object(key, {...props, ...obj.value}, {reconfigure: true});
96
- } else {
97
- obj = sheet.object(key, props);
98
- }
99
-
100
- this.sheetObjects.set(objName, obj);
101
- this.sheetObjectCBs.set(objName, onUpdate !== undefined ? onUpdate : noop);
102
-
103
- const unsubscribe = obj.onValuesChange((values: any) => {
104
- if (this.app.editor) {
105
- for (const i in values) {
106
- const value = values[i];
107
- if (typeof value === 'object') {
108
- if (isColor(value)) {
109
- values[i] = {
110
- r: value.r,
111
- g: value.g,
112
- b: value.b,
113
- a: value.a,
114
- };
115
- }
116
- }
117
- }
118
- this.app.send({
119
- event: 'updateSheetObject',
120
- target: 'app',
121
- data: {
122
- sheet: sheetName,
123
- sheetObject: objName,
124
- values: values,
125
- },
126
- });
127
- }
128
-
129
- const callback = this.sheetObjectCBs.get(objName);
130
- if (callback !== undefined) callback(values);
131
- });
132
- this.sheetObjectUnsubscribe.set(objName, unsubscribe);
133
-
134
- return obj;
135
- }
136
-
137
- unsubscribe(sheetObject: ISheetObject) {
138
- if (this.project === undefined) {
139
- console.error('Theatre Project hasn\'t been created yet.');
140
- return undefined;
141
- }
142
-
143
- const sheetName = sheetObject.address.sheetId;
144
- const sheetObjectName = sheetObject.address.objectKey;
145
- const sheet = this.sheets.get(sheetName);
146
- sheet?.detachObject(sheetObjectName);
147
-
148
- const id = `${sheetName}_${sheetObjectName}`;
149
- const unsubscribe = this.sheetObjectUnsubscribe.get(id);
150
- if (unsubscribe !== undefined) {
151
- this.sheetObjects.delete(id);
152
- this.sheetObjectCBs.delete(id);
153
- this.sheetObjectUnsubscribe.delete(id);
154
- unsubscribe();
155
- }
156
- }
157
-
158
- public static getRafDriver(): IRafDriver {
159
- if (!RemoteTheatre.rafDriver) {
160
- RemoteTheatre.rafDriver = createRafDriver();
161
- }
162
- return RemoteTheatre.rafDriver;
163
- }
164
- }
165
-
166
- let activeSheet: ISheet | undefined;
167
-
168
- export function HandleAppRemoteTheatre(app: Application, msg: BroadcastData) {
169
- app.components.forEach((component: any) => {
170
- if (component instanceof RemoteTheatre) {
171
- let value = undefined;
172
- const theatre = component as RemoteTheatre;
173
- switch (msg.event) {
174
- case 'setSheet':
175
- // @ts-ignore
176
- value = theatre.sheets.get(msg.data.sheet);
177
- if (value !== undefined) {
178
- activeSheet = value as ISheet;
179
- studio.setSelection([value]);
180
- }
181
- break;
182
- case 'setSheetObject':
183
- // @ts-ignore
184
- value = theatre.sheetObjects.get(`${msg.data.sheet}_${msg.data.key}`);
185
- if (value !== undefined) {
186
- studio.setSelection([value]);
187
- }
188
- break;
189
- case 'updateSheetObject':
190
- // @ts-ignore
191
- value = theatre.sheets.get(msg.data.sheet); // pause current animation
192
- // @ts-ignore
193
- if (value !== undefined) value.sequence.pause();
194
- // @ts-ignore
195
- value = theatre.sheetObjectCBs.get(msg.data.sheetObject);
196
- // @ts-ignore
197
- if (value !== undefined) value(msg.data.values);
198
- break;
199
- case 'updateTimeline':
200
- // @ts-ignore
201
- value = theatre.sheets.get(msg.data.sheet);
202
- if (activeSheet !== undefined) {
203
- (activeSheet as ISheet).sequence.position = msg.data.position;
204
- }
205
- break;
206
- }
207
- }
208
- });
209
- }
210
-
211
- export function UpdateRemoteTheatre(app: Application) {
212
- if (app.editor) {
213
- let theatre: RemoteTheatre;
214
- app.components.forEach((component: any) => {
215
- if (component instanceof RemoteTheatre) {
216
- theatre = component;
217
- }
218
- });
219
-
220
- studio.ui.restore();
221
- studio.onSelectionChange((value: any[]) => {
222
- if (value.length < 1) return;
223
-
224
- value.forEach((obj: any) => {
225
- let id = obj.address.sheetId;
226
- let type: EditorEvent = 'setSheet';
227
- let data = {};
228
- switch (obj.type) {
229
- case 'Theatre_Sheet_PublicAPI':
230
- type = 'setSheet';
231
- data = {
232
- sheet: obj.address.sheetId,
233
- };
234
- activeSheet = theatre.sheets.get(obj.address.sheetId);
235
- break;
236
-
237
- case 'Theatre_SheetObject_PublicAPI':
238
- type = 'setSheetObject';
239
- id += `_${obj.address.objectKey}`;
240
- data = {
241
- id: id,
242
- sheet: obj.address.sheetId,
243
- key: obj.address.objectKey,
244
- };
245
- break;
246
- }
247
- app.send({ event: type, target: 'app', data: data });
248
- });
249
- });
250
-
251
- // Timeline
252
- let position = 0;
253
- const onRafUpdate = () => {
254
- // RemoteTheatre.getRafDriver().tick(performance.now());
255
-
256
- if (
257
- activeSheet !== undefined &&
258
- position !== activeSheet.sequence.position
259
- ) {
260
- position = activeSheet.sequence.position;
261
- const t = activeSheet as ISheet;
262
- app.send({
263
- event: 'updateTimeline',
264
- target: 'app',
265
- data: {
266
- position: position,
267
- sheet: t.address.sheetId,
268
- },
269
- });
270
- }
271
- };
272
- const onRaf = () => {
273
- onRafUpdate();
274
- requestAnimationFrame(onRaf);
275
- };
276
- onRafUpdate(); // Initial position
277
- onRaf();
278
- } else {
279
- studio.ui.hide();
280
- }
281
- }
282
-
283
- export function HandleEditorRemoteTheatre(app: Application, msg: BroadcastData) {
284
- if (app.editor) {
285
- app.components.forEach((component: any) => {
286
- if (component instanceof RemoteTheatre) {
287
- const theatre = component;
288
- switch (msg.event) {
289
- case 'playSheet':
290
- theatre.sheet(msg.data.sheet)?.sequence.play(msg.data.value);
291
- break;
292
- case 'pauseSheet':
293
- theatre.sheet(msg.data.sheet)?.sequence.pause();
294
- break;
295
- }
296
- return;
297
- }
298
- });
299
- }
300
- }
@@ -1,143 +0,0 @@
1
- import { Camera, Scene } from 'three';
2
- import BaseRemote from './BaseRemote';
3
- import { stripObject, stripScene } from '@/editor/sidePanel/utils';
4
- import { hierarchyUUID, resetThreeObjects } from '@/editor/utils';
5
- import Application from '../Application';
6
- import { BroadcastData } from '../types';
7
- import { ToolEvents, debugDispatcher } from '@/editor/global';
8
-
9
- export default class RemoteThree extends BaseRemote {
10
- scene?: Scene = undefined;
11
-
12
- getObject(uuid: string) {
13
- if (!this.app.debugEnabled) return;
14
- this.app.send({
15
- event: 'getObject',
16
- target: 'app',
17
- data: uuid,
18
- });
19
- }
20
-
21
- setObject(value: any) {
22
- const stripped = stripObject(value);
23
- this.app.send({
24
- event: 'setObject',
25
- target: 'editor',
26
- data: stripped,
27
- });
28
- }
29
-
30
- requestMethod(uuid: string, key: string, value?: any, subitem?: string) {
31
- this.app.send({
32
- event: 'requestMethod',
33
- target: 'app',
34
- data: {
35
- uuid,
36
- key,
37
- value,
38
- subitem,
39
- },
40
- });
41
- }
42
-
43
- updateObject(uuid: string, key: string, value: any) {
44
- this.app.send({
45
- event: 'updateObject',
46
- target: 'app',
47
- data: {
48
- uuid,
49
- key,
50
- value
51
- },
52
- });
53
- }
54
-
55
- createTexture(uuid: string, key: string, value: any) {
56
- this.app.send({
57
- event: 'createTexture',
58
- target: 'app',
59
- data: {
60
- uuid,
61
- key,
62
- value
63
- },
64
- });
65
- }
66
-
67
- setScene(value: Scene) {
68
- if (value === undefined) return;
69
- this.scene = value;
70
-
71
- if (!this.app.debugEnabled) return;
72
- resetThreeObjects();
73
- hierarchyUUID(this.scene);
74
- const stripped = stripScene(this.scene);
75
- this.app.send({
76
- event: 'setScene',
77
- target: 'editor',
78
- data: stripped,
79
- });
80
- }
81
-
82
- addCamera(camera: Camera) {
83
- if (!this.app.debugEnabled) return;
84
- const stripped = stripObject(camera);
85
- this.app.send({
86
- event: 'addCamera',
87
- target: 'editor',
88
- data: stripped,
89
- });
90
- }
91
-
92
- removeCamera(camera: Camera) {
93
- if (!this.app.debugEnabled) return;
94
- const stripped = stripObject(camera);
95
- this.app.send({
96
- event: 'removeCamera',
97
- target: 'editor',
98
- data: stripped,
99
- });
100
- }
101
- }
102
-
103
- export function HandleAppRemoteThree(_: Application, msg: BroadcastData) {
104
- switch (msg.event) {
105
- case 'getObject':
106
- // @ts-ignore
107
- debugDispatcher.dispatchEvent({ type: ToolEvents.GET_OBJECT, value: msg.data });
108
- break;
109
- case 'updateObject':
110
- // @ts-ignore
111
- debugDispatcher.dispatchEvent({ type: ToolEvents.UPDATE_OBJECT, value: msg.data });
112
- break;
113
- case 'createTexture':
114
- // @ts-ignore
115
- debugDispatcher.dispatchEvent({ type: ToolEvents.CREATE_TEXTURE, value: msg.data });
116
- break;
117
- case 'requestMethod':
118
- // @ts-ignore
119
- debugDispatcher.dispatchEvent({ type: ToolEvents.REQUEST_METHOD, value: msg.data });
120
- break;
121
- }
122
- }
123
-
124
- export function HandleEditorRemoteThree(_: Application, msg: BroadcastData) {
125
- switch (msg.event) {
126
- case 'setObject':
127
- // @ts-ignore
128
- debugDispatcher.dispatchEvent({ type: ToolEvents.SET_OBJECT, value: msg.data });
129
- break;
130
- case 'setScene':
131
- // @ts-ignore
132
- debugDispatcher.dispatchEvent({ type: ToolEvents.SET_SCENE, value: msg.data });
133
- break;
134
- case 'addCamera':
135
- // @ts-ignore
136
- debugDispatcher.dispatchEvent({ type: ToolEvents.ADD_CAMERA, value: msg.data });
137
- break;
138
- case 'removeCamera':
139
- // @ts-ignore
140
- debugDispatcher.dispatchEvent({ type: ToolEvents.REMOVE_CAMERA, value: msg.data });
141
- break;
142
- }
143
- }