@tomorrowevening/hermes 0.0.11 → 0.0.13
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/hermes.js +1541 -1446
- package/dist/hermes.umd.cjs +16 -16
- package/dist/style.css +1 -1
- package/package.json +3 -2
- package/src/core/Application.ts +1 -1
- package/src/core/RemoteController.ts +4 -151
- package/src/core/remote/RemoteComponents.ts +15 -1
- package/src/core/remote/RemoteTheatre.ts +114 -3
- package/src/core/remote/RemoteThree.ts +57 -2
- package/src/core/remote/RemoteTweakpane.ts +28 -2
- package/src/core/types.ts +2 -0
- package/src/editor/global.ts +3 -0
- package/src/editor/multiView/CameraWindow.tsx +20 -7
- package/src/editor/multiView/MultiView.scss +2 -0
- package/src/editor/multiView/MultiView.tsx +203 -9
- package/src/editor/scss/{_sceneHierarchy.scss → _sidePanel.scss} +1 -1
- package/src/editor/scss/index.scss +1 -1
- package/src/editor/{sceneHierarchy/SceneHierarchy.tsx → sidePanel/SidePanel.tsx} +8 -10
- package/src/editor/sidePanel/inspector/Inspector.tsx +111 -0
- package/src/editor/sidePanel/inspector/utils/InspectAnimation.tsx +51 -0
- package/src/editor/{sceneHierarchy → sidePanel}/types.ts +10 -1
- package/src/editor/{sceneHierarchy → sidePanel}/utils.ts +11 -2
- package/src/index.ts +6 -6
- package/types/core/Application.d.ts +1 -1
- package/types/core/RemoteController.d.ts +1 -1
- package/types/core/remote/RemoteComponents.d.ts +3 -0
- package/types/core/remote/RemoteTheatre.d.ts +3 -0
- package/types/core/remote/RemoteThree.d.ts +7 -1
- package/types/core/remote/RemoteTweakpane.d.ts +2 -0
- package/types/core/types.d.ts +1 -1
- package/types/editor/global.d.ts +2 -0
- package/types/editor/multiView/CameraWindow.d.ts +2 -0
- package/types/editor/multiView/MultiView.d.ts +4 -0
- package/types/editor/sidePanel/SidePanel.d.ts +11 -0
- package/types/editor/sidePanel/inspector/utils/InspectAnimation.d.ts +3 -0
- package/types/editor/{sceneHierarchy → sidePanel}/types.d.ts +7 -1
- package/types/index.d.ts +6 -6
- package/src/editor/sceneHierarchy/inspector/Inspector.tsx +0 -97
- package/types/editor/sceneHierarchy/SceneHierarchy.d.ts +0 -11
- /package/src/editor/{sceneHierarchy → sidePanel}/Accordion.tsx +0 -0
- /package/src/editor/{sceneHierarchy → sidePanel}/ChildObject.tsx +0 -0
- /package/src/editor/{sceneHierarchy → sidePanel}/ContainerObject.tsx +0 -0
- /package/src/editor/{sceneHierarchy → sidePanel}/ToggleBtn.tsx +0 -0
- /package/src/editor/{sceneHierarchy → sidePanel}/inspector/InspectorField.tsx +0 -0
- /package/src/editor/{sceneHierarchy → sidePanel}/inspector/InspectorGroup.tsx +0 -0
- /package/src/editor/{sceneHierarchy → sidePanel}/inspector/SceneInspector.tsx +0 -0
- /package/src/editor/{sceneHierarchy → sidePanel}/inspector/inspector.scss +0 -0
- /package/src/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectCamera.tsx +0 -0
- /package/src/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectLight.tsx +0 -0
- /package/src/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectMaterial.tsx +0 -0
- /package/src/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectTransform.tsx +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/Accordion.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/ChildObject.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/ContainerObject.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/ToggleBtn.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/inspector/Inspector.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/inspector/InspectorField.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/inspector/InspectorGroup.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/inspector/SceneInspector.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectCamera.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectLight.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectMaterial.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectTransform.d.ts +0 -0
- /package/types/editor/{sceneHierarchy → sidePanel}/utils.d.ts +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CubeTexture, Material, Mesh, Object3D, RepeatWrapping, Texture } from 'three';
|
1
|
+
import { AnimationClip, CubeTexture, Material, Mesh, Object3D, RepeatWrapping, Texture } from 'three';
|
2
2
|
import { MinimumObject, RemoteMaterial, RemoteObject } from './types';
|
3
3
|
|
4
4
|
export function determineIcon(obj: Object3D): string {
|
@@ -132,14 +132,23 @@ export function stripObject(obj: Object3D): RemoteObject {
|
|
132
132
|
uuid: obj.uuid,
|
133
133
|
visible: obj.visible,
|
134
134
|
matrix: obj.matrix.elements,
|
135
|
+
animations: [],
|
135
136
|
material: undefined,
|
136
137
|
perspectiveCameraInfo: undefined,
|
137
138
|
orthographicCameraInfo: undefined,
|
138
139
|
lightInfo: undefined,
|
139
140
|
};
|
140
141
|
|
141
|
-
|
142
|
+
// Animations
|
143
|
+
obj.animations.forEach((clip: AnimationClip) => {
|
144
|
+
stripped.animations.push({
|
145
|
+
name: clip.name,
|
146
|
+
duration: clip.duration,
|
147
|
+
blendMode: clip.blendMode,
|
148
|
+
});
|
149
|
+
});
|
142
150
|
|
151
|
+
const type = obj.type.toLowerCase();
|
143
152
|
if (type.search('mesh') > -1) {
|
144
153
|
const mesh = obj as Mesh;
|
145
154
|
if (Array.isArray(mesh.material)) {
|
package/src/index.ts
CHANGED
@@ -17,11 +17,11 @@ export { default as RemoteController } from './core/RemoteController';
|
|
17
17
|
// RemoteThree
|
18
18
|
export { default as InfiniteGridHelper } from './editor/multiView/InfiniteGridHelper';
|
19
19
|
export { default as UVMaterial } from './editor/multiView/UVMaterial';
|
20
|
-
export { default as
|
21
|
-
export { default as Accordion } from './editor/
|
22
|
-
export { default as ChildObject } from './editor/
|
23
|
-
export { default as ContainerObject } from './editor/
|
24
|
-
export { default as Inspector } from './editor/
|
25
|
-
export { default as SceneInspector } from './editor/
|
20
|
+
export { default as SidePanel } from './editor/sidePanel/SidePanel';
|
21
|
+
export { default as Accordion } from './editor/sidePanel/Accordion';
|
22
|
+
export { default as ChildObject } from './editor/sidePanel/ChildObject';
|
23
|
+
export { default as ContainerObject } from './editor/sidePanel/ContainerObject';
|
24
|
+
export { default as Inspector } from './editor/sidePanel/inspector/Inspector';
|
25
|
+
export { default as SceneInspector } from './editor/sidePanel/inspector/SceneInspector';
|
26
26
|
export { default as MultiView } from './editor/multiView/MultiView';
|
27
27
|
export { default as Editor } from './editor/Editor';
|
@@ -4,7 +4,7 @@ export default class Application {
|
|
4
4
|
channel?: BroadcastChannel | undefined;
|
5
5
|
components: Map<string, any>;
|
6
6
|
protected _mode: ApplicationMode;
|
7
|
-
constructor(name: string, debugEnabled: boolean, editorHashtag
|
7
|
+
constructor(name: string, debugEnabled: boolean, editorHashtag?: string);
|
8
8
|
addComponent(name: string, component: BaseRemote): void;
|
9
9
|
dispose(): void;
|
10
10
|
send(data: BroadcastData): void;
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import Application from './Application';
|
2
|
-
export default function RemoteController(app: Application): void;
|
2
|
+
export default function RemoteController(app: Application, appHandlers: any[], editorHandlers: any[]): void;
|
@@ -1,5 +1,8 @@
|
|
1
|
+
import Application from '../Application';
|
1
2
|
import BaseRemote from './BaseRemote';
|
3
|
+
import { BroadcastData } from '../types';
|
2
4
|
export default class RemoteComponents extends BaseRemote {
|
3
5
|
selectDropdown(dropdown: string, value: any): void;
|
4
6
|
updateDropdown(dropdown: string, list: string[]): void;
|
5
7
|
}
|
8
|
+
export declare function HandleAppRemoteComponents(_: Application, msg: BroadcastData): void;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { IProject, IProjectConfig, ISheet, ISheetObject } from '@theatre/core';
|
2
2
|
import Application from '../Application';
|
3
3
|
import BaseRemote from './BaseRemote';
|
4
|
+
import { BroadcastData } from '../types';
|
4
5
|
import type { DataUpdateCallback, VoidCallback } from '../types';
|
5
6
|
export default class RemoteTheatre extends BaseRemote {
|
6
7
|
project: IProject | undefined;
|
@@ -14,3 +15,5 @@ export default class RemoteTheatre extends BaseRemote {
|
|
14
15
|
sheetObject(sheetName: string, key: string, props: any, onUpdate?: DataUpdateCallback): ISheetObject | undefined;
|
15
16
|
unsubscribe(sheet: ISheetObject): undefined;
|
16
17
|
}
|
18
|
+
export declare function HandleAppRemoteTheatre(app: Application, msg: BroadcastData): void;
|
19
|
+
export declare function HandleEditorRemoteTheatre(app: Application): void;
|
@@ -1,5 +1,7 @@
|
|
1
|
-
import { Scene } from 'three';
|
1
|
+
import { Camera, Scene } from 'three';
|
2
2
|
import BaseRemote from './BaseRemote';
|
3
|
+
import Application from '../Application';
|
4
|
+
import { BroadcastData } from '../types';
|
3
5
|
export default class RemoteThree extends BaseRemote {
|
4
6
|
scene?: Scene;
|
5
7
|
getObject(uuid: string): void;
|
@@ -8,4 +10,8 @@ export default class RemoteThree extends BaseRemote {
|
|
8
10
|
updateObject(uuid: string, key: string, value: any): void;
|
9
11
|
createTexture(uuid: string, key: string, value: any): void;
|
10
12
|
setScene(value: Scene): void;
|
13
|
+
addCamera(camera: Camera): void;
|
14
|
+
removeCamera(camera: Camera): void;
|
11
15
|
}
|
16
|
+
export declare function HandleAppRemoteThree(_: Application, msg: BroadcastData): void;
|
17
|
+
export declare function HandleEditorRemoteThree(_: Application, msg: BroadcastData): void;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Pane } from 'tweakpane';
|
2
2
|
import Application from '../Application';
|
3
3
|
import BaseRemote from './BaseRemote';
|
4
|
+
import { BroadcastData } from '../types';
|
4
5
|
import type { DataUpdateCallback, VoidCallback } from '../types';
|
5
6
|
export default class RemoteTweakpane extends BaseRemote {
|
6
7
|
bindCBs: Map<string, DataUpdateCallback>;
|
@@ -21,3 +22,4 @@ export default class RemoteTweakpane extends BaseRemote {
|
|
21
22
|
createInspector(): void;
|
22
23
|
clearInspector(): void;
|
23
24
|
}
|
25
|
+
export declare function HandleAppRemoteTweakpane(app: Application, msg: BroadcastData): void;
|
package/types/core/types.d.ts
CHANGED
@@ -6,7 +6,7 @@ export interface BroadcastData {
|
|
6
6
|
export type ApplicationMode = 'app' | 'editor';
|
7
7
|
export type VoidCallback = () => void;
|
8
8
|
export type DataUpdateCallback = (data: any) => void;
|
9
|
-
export type EditorEvent = 'custom' | 'setSheet' | 'setSheetObject' | 'updateSheetObject' | 'updateTimeline' | 'getObject' | 'setObject' | 'updateObject' | 'setScene' | 'createTexture' | 'requestMethod' | 'addFolder' | 'bindObject' | 'updateBind' | 'addButton' | 'clickButton' | 'selectComponent' | 'draggableListUpdate';
|
9
|
+
export type EditorEvent = 'custom' | 'setSheet' | 'setSheetObject' | 'updateSheetObject' | 'updateTimeline' | 'getObject' | 'setObject' | 'updateObject' | 'setScene' | 'createTexture' | 'requestMethod' | 'addCamera' | 'removeCamera' | 'addFolder' | 'bindObject' | 'updateBind' | 'addButton' | 'clickButton' | 'selectComponent' | 'draggableListUpdate';
|
10
10
|
export type VoidFunc = () => void;
|
11
11
|
export type BroadcastCallback = (data: BroadcastData) => void;
|
12
12
|
export type TheatreUpdateCallback = (data: any) => void;
|
package/types/editor/global.d.ts
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
import { Scene } from 'three';
|
1
2
|
import { MultiViewMode } from './MultiViewData';
|
2
3
|
import './MultiView.scss';
|
3
4
|
import RemoteThree from '@/core/remote/RemoteThree';
|
4
5
|
interface MultiViewProps {
|
5
6
|
three: RemoteThree;
|
6
7
|
mode?: MultiViewMode;
|
8
|
+
scenes: Map<string, any>;
|
9
|
+
onSceneSet?: (scene: Scene) => void;
|
10
|
+
onSceneUpdate?: (scene: Scene) => void;
|
7
11
|
}
|
8
12
|
export default function MultiView(props: MultiViewProps): import("react/jsx-runtime").JSX.Element;
|
9
13
|
export {};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Component, ReactNode } from 'react';
|
2
|
+
import '../scss/_sidePanel.scss';
|
3
|
+
import { SidePanelState } from './types';
|
4
|
+
export default class SidePanel extends Component<SidePanelState> {
|
5
|
+
private three;
|
6
|
+
constructor(props: SidePanelState);
|
7
|
+
componentWillUnmount(): void;
|
8
|
+
render(): ReactNode;
|
9
|
+
private setScene;
|
10
|
+
get componentState(): SidePanelState;
|
11
|
+
}
|
@@ -8,7 +8,7 @@ export interface ChildObjectProps extends CoreComponentProps {
|
|
8
8
|
child: Object3D;
|
9
9
|
three: RemoteThree;
|
10
10
|
}
|
11
|
-
export interface
|
11
|
+
export interface SidePanelState {
|
12
12
|
scene?: Object3D;
|
13
13
|
three: RemoteThree;
|
14
14
|
}
|
@@ -58,6 +58,11 @@ export interface RemoteMaterial {
|
|
58
58
|
sheenColor?: Color;
|
59
59
|
specularColor?: Color;
|
60
60
|
}
|
61
|
+
export interface AnimationClipInfo {
|
62
|
+
name: string;
|
63
|
+
duration: number;
|
64
|
+
blendMode: number;
|
65
|
+
}
|
61
66
|
export interface PerspectiveCameraInfo {
|
62
67
|
fov: number;
|
63
68
|
zoom: number;
|
@@ -92,6 +97,7 @@ export interface RemoteObject {
|
|
92
97
|
type: string;
|
93
98
|
visible: boolean;
|
94
99
|
matrix: number[];
|
100
|
+
animations: AnimationClipInfo[];
|
95
101
|
material?: RemoteMaterial | RemoteMaterial[];
|
96
102
|
perspectiveCameraInfo?: PerspectiveCameraInfo;
|
97
103
|
orthographicCameraInfo?: OrthographicCameraInfo;
|
package/types/index.d.ts
CHANGED
@@ -14,11 +14,11 @@ export { default as Dropdown } from './editor/components/Dropdown';
|
|
14
14
|
export { default as RemoteController } from './core/RemoteController';
|
15
15
|
export { default as InfiniteGridHelper } from './editor/multiView/InfiniteGridHelper';
|
16
16
|
export { default as UVMaterial } from './editor/multiView/UVMaterial';
|
17
|
-
export { default as
|
18
|
-
export { default as Accordion } from './editor/
|
19
|
-
export { default as ChildObject } from './editor/
|
20
|
-
export { default as ContainerObject } from './editor/
|
21
|
-
export { default as Inspector } from './editor/
|
22
|
-
export { default as SceneInspector } from './editor/
|
17
|
+
export { default as SidePanel } from './editor/sidePanel/SidePanel';
|
18
|
+
export { default as Accordion } from './editor/sidePanel/Accordion';
|
19
|
+
export { default as ChildObject } from './editor/sidePanel/ChildObject';
|
20
|
+
export { default as ContainerObject } from './editor/sidePanel/ContainerObject';
|
21
|
+
export { default as Inspector } from './editor/sidePanel/inspector/Inspector';
|
22
|
+
export { default as SceneInspector } from './editor/sidePanel/inspector/SceneInspector';
|
23
23
|
export { default as MultiView } from './editor/multiView/MultiView';
|
24
24
|
export { default as Editor } from './editor/Editor';
|
@@ -1,97 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from "react";
|
2
|
-
import { CoreComponentProps, RemoteObject } from "../types";
|
3
|
-
import { ToolEvents, debugDispatcher } from "../../global";
|
4
|
-
import './inspector.scss';
|
5
|
-
import InspectorField from './InspectorField';
|
6
|
-
// Utils
|
7
|
-
import { InspectCamera } from "./utils/InspectCamera";
|
8
|
-
import { InspectMaterial } from "./utils/InspectMaterial";
|
9
|
-
import { InspectTransform } from "./utils/InspectTransform";
|
10
|
-
import { InspectLight } from "./utils/InspectLight";
|
11
|
-
import { setItemProps } from "../utils";
|
12
|
-
|
13
|
-
export default function Inspector(props: CoreComponentProps) {
|
14
|
-
const [lastRefresh, setLastRefresh] = useState(-1);
|
15
|
-
const [currentObject, setCurrentObject] = useState<RemoteObject>({
|
16
|
-
name: '',
|
17
|
-
uuid: '',
|
18
|
-
type: '',
|
19
|
-
visible: false,
|
20
|
-
matrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
21
|
-
material: undefined,
|
22
|
-
perspectiveCameraInfo: undefined,
|
23
|
-
orthographicCameraInfo: undefined,
|
24
|
-
lightInfo: undefined,
|
25
|
-
});
|
26
|
-
|
27
|
-
useEffect(() => {
|
28
|
-
function onSelectItem(evt: any) {
|
29
|
-
const obj = evt.value as RemoteObject;
|
30
|
-
setCurrentObject(obj);
|
31
|
-
setLastRefresh(Date.now());
|
32
|
-
}
|
33
|
-
|
34
|
-
debugDispatcher.addEventListener(ToolEvents.SET_OBJECT, onSelectItem);
|
35
|
-
return () => {
|
36
|
-
debugDispatcher.removeEventListener(ToolEvents.SET_OBJECT, onSelectItem);
|
37
|
-
};
|
38
|
-
}, []);
|
39
|
-
|
40
|
-
const objType = currentObject.type.toLowerCase();
|
41
|
-
|
42
|
-
return (
|
43
|
-
<div id="Inspector" className={props.class} key={lastRefresh}>
|
44
|
-
{currentObject.uuid.length > 0 && (
|
45
|
-
<>
|
46
|
-
{/* Core */}
|
47
|
-
<>
|
48
|
-
<InspectorField
|
49
|
-
type="string"
|
50
|
-
title="Name"
|
51
|
-
prop="name"
|
52
|
-
value={currentObject.name}
|
53
|
-
disabled={true}
|
54
|
-
/>
|
55
|
-
<InspectorField
|
56
|
-
type="string"
|
57
|
-
title="Type"
|
58
|
-
prop="type"
|
59
|
-
value={currentObject.type}
|
60
|
-
disabled={true}
|
61
|
-
/>
|
62
|
-
<InspectorField
|
63
|
-
type="string"
|
64
|
-
title="UUID"
|
65
|
-
prop="uuid"
|
66
|
-
value={currentObject.uuid}
|
67
|
-
disabled={true}
|
68
|
-
/>
|
69
|
-
<InspectorField
|
70
|
-
type="boolean"
|
71
|
-
title="Visible"
|
72
|
-
prop="visible"
|
73
|
-
value={currentObject.visible}
|
74
|
-
onChange={(key: string, value: any) => {
|
75
|
-
props.three.updateObject(currentObject.uuid, key, value);
|
76
|
-
const child = props.three.scene?.getObjectByProperty('uuid', currentObject.uuid);
|
77
|
-
if (child !== undefined) setItemProps(child, key, value);
|
78
|
-
}}
|
79
|
-
/>
|
80
|
-
</>
|
81
|
-
|
82
|
-
{/* Data */}
|
83
|
-
<>
|
84
|
-
{/* Transform */}
|
85
|
-
{InspectTransform(currentObject, props.three)}
|
86
|
-
{/* Cameras */}
|
87
|
-
{objType.search('camera') > -1 ? InspectCamera(currentObject, props.three) : null}
|
88
|
-
{/* Lights */}
|
89
|
-
{objType.search('light') > -1 ? InspectLight(currentObject, props.three) : null}
|
90
|
-
{/* Material */}
|
91
|
-
{objType.search('mesh') > -1 ? InspectMaterial(currentObject, props.three) : null}
|
92
|
-
</>
|
93
|
-
</>
|
94
|
-
)}
|
95
|
-
</div>
|
96
|
-
);
|
97
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { Component, ReactNode } from 'react';
|
2
|
-
import '../scss/_sceneHierarchy.scss';
|
3
|
-
import { SceneHierarchyState } from './types';
|
4
|
-
export default class SceneHierarchy extends Component<SceneHierarchyState> {
|
5
|
-
private three;
|
6
|
-
constructor(props: SceneHierarchyState);
|
7
|
-
componentWillUnmount(): void;
|
8
|
-
render(): ReactNode;
|
9
|
-
private setScene;
|
10
|
-
get componentState(): SceneHierarchyState;
|
11
|
-
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|