@tomorrowevening/hermes 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -6,18 +6,21 @@ Open the [Application](https://hermes-lovat.vercel.app/) and [editor](https://he
6
6
 
7
7
  ## Setup
8
8
 
9
- This example uses [React](https://react.dev/), [ThreeJS](https://threejs.org/), and [TheatreJS](https://theatrejs.com/), and will default to using `BroadcastChannel` instead of `WebSocket` for simplicity.
9
+ This example uses [React](https://react.dev/), [ThreeJS](https://threejs.org/), and [TheatreJS](https://theatrejs.com/).
10
10
 
11
11
  ### Create an `Application`
12
12
 
13
- An application isn't required, however it's nice to maintain multiple remotes. Alternatively, Remotes can be created independent.
13
+ An application isn't required, however it's nice to maintain multiple remotes. Alternatively, Remotes can be created independently.
14
14
 
15
- The `CustomEditor` is used as a multi-view editor for [ThreeJS](https://threejs.org/), and should be limited to only the Editor app.
15
+ The `ThreeEditor` is used as a multi-view editor for [ThreeJS](https://threejs.org/), and should be limited to only the Editor app.
16
16
 
17
17
  ```
18
18
  const IS_DEV = true;
19
19
  const IS_EDITOR = IS_DEV && document.location.hash.search('editor') > -1;
20
20
 
21
+ const theatre = new RemoteTheatre(IS_DEV, IS_EDITOR);
22
+ const three = new RemoteThree('Hermes Example', IS_DEV, IS_EDITOR);
23
+
21
24
  export default function AppWrapper() {
22
25
  const [app, setApp] = useState<Application | null>(null);
23
26
 
@@ -25,13 +28,9 @@ export default function AppWrapper() {
25
28
  const instance = new Application();
26
29
  instance.detectSettings(IS_DEV, IS_EDITOR).then(() => {
27
30
  // TheatreJS
28
- instance.addComponent('theatre', new RemoteTheatre(IS_DEV, IS_EDITOR));
31
+ instance.addComponent('theatre', theatre);
29
32
 
30
33
  // ThreeJS
31
- const scenes: Map<string, any> = new Map();
32
- scenes.set('ExampleScene', ExampleScene); // extends Scene class
33
- const three = new RemoteThree('Hermes Example', IS_DEV, IS_EDITOR);
34
- three.scenes = scenes;
35
34
  instance.addComponent('three', three);
36
35
 
37
36
  // Ready
@@ -39,13 +38,29 @@ export default function AppWrapper() {
39
38
  });
40
39
  }, []);
41
40
 
41
+ // MultiView requires you identify each scene so they can be instantiated by the editor
42
+ const scenes: Map<string, any> = new Map();
43
+ scenes.set('Scene1', Scene1);
44
+ scenes.set('Scene2', Scene2);
45
+ scenes.set('RTTScene', RTTScene);
46
+
42
47
  return (
43
48
  <>
44
49
  {app !== null && (
45
50
  <>
46
- {IS_DEV && <RemoteSetup app={app} />}
47
- {IS_EDITOR && <CustomEditor app={app} />}
48
- <Wrapper app={app} />
51
+ {IS_DEV && (
52
+ <>
53
+ {IS_EDITOR && (
54
+ <ThreeEditor
55
+ three={three}
56
+ scenes={scenes}
57
+ onSceneUpdate={(scene: any) => {
58
+ scene.update();
59
+ }}
60
+ />
61
+ )}
62
+ </>
63
+ )}
49
64
  </>
50
65
  )}
51
66
  </>
@@ -53,13 +68,16 @@ export default function AppWrapper() {
53
68
  }
54
69
  ```
55
70
 
71
+ ### Scene setup
72
+
73
+ After all object's have been added to your scene, run `hierarchyUUID(yourScene)` to update the UUIDs of every object. This helps communicate back and forth between the app and your editor.
74
+
56
75
  ### Custom remote commands
57
76
 
58
77
  This component is added only in debug-mode to add extra support for remote-components.
59
78
 
60
79
  In this example it's added to add custom Remote Component support for:
61
80
 
62
- - [ThreeJS](https://threejs.org/) - `SceneInspector` communicates with the Multi-view editor
63
81
  - [TheatreJS](https://theatrejs.com/) - Communicates with the `studio` instance
64
82
 
65
83
  ```
@@ -72,8 +90,7 @@ export default function RemoteSetup(props: RemoteProps) {
72
90
  // Remote Theatre setup
73
91
  props.theatre.studio = studio;
74
92
  props.theatre.handleEditorApp();
75
-
76
- return <SceneInspector three={props.three} />;
93
+ return null;
77
94
  }
78
95
  ```
79
96