@tomorrowevening/hermes 0.0.11 → 0.0.12
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 +1473 -1277
- package/dist/hermes.umd.cjs +16 -16
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/core/RemoteController.ts +7 -0
- package/src/core/remote/RemoteThree.ts +20 -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 +187 -5
- 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 +114 -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/remote/RemoteThree.d.ts +3 -1
- 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/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
@@ -3,17 +3,17 @@ import { Component, ReactNode } from 'react';
|
|
3
3
|
// Models
|
4
4
|
import { debugDispatcher, ToolEvents } from '../global';
|
5
5
|
// Components
|
6
|
-
import '../scss/
|
6
|
+
import '../scss/_sidePanel.scss';
|
7
7
|
import Accordion from './Accordion';
|
8
8
|
import ContainerObject from './ContainerObject';
|
9
9
|
import Inspector from './inspector/Inspector';
|
10
|
-
import {
|
10
|
+
import { SidePanelState } from './types';
|
11
11
|
import RemoteThree from '@/core/remote/RemoteThree';
|
12
12
|
|
13
|
-
export default class
|
13
|
+
export default class SidePanel extends Component<SidePanelState> {
|
14
14
|
private three: RemoteThree;
|
15
15
|
|
16
|
-
constructor(props:
|
16
|
+
constructor(props: SidePanelState) {
|
17
17
|
super(props);
|
18
18
|
this.state = {
|
19
19
|
scene: props.scene !== undefined ? props.scene : null,
|
@@ -30,7 +30,7 @@ export default class SceneHierarchy extends Component<SceneHierarchyState> {
|
|
30
30
|
const hasScene = this.componentState.scene !== null;
|
31
31
|
const HierarchyName = 'Hierarchy - ' + (hasScene ? `${this.componentState.scene?.name}` : 'No Scene');
|
32
32
|
return (
|
33
|
-
<div id="
|
33
|
+
<div id="SidePanel" key="SidePanel">
|
34
34
|
{(
|
35
35
|
<>
|
36
36
|
<Accordion label={HierarchyName} open={true}>
|
@@ -41,9 +41,7 @@ export default class SceneHierarchy extends Component<SceneHierarchyState> {
|
|
41
41
|
</>
|
42
42
|
</Accordion>
|
43
43
|
|
44
|
-
<
|
45
|
-
<Inspector key="Inspector" three={this.three} />
|
46
|
-
</Accordion>
|
44
|
+
<Inspector three={this.three} />
|
47
45
|
</>
|
48
46
|
)}
|
49
47
|
</div>
|
@@ -60,7 +58,7 @@ export default class SceneHierarchy extends Component<SceneHierarchyState> {
|
|
60
58
|
|
61
59
|
// Getters / Setters
|
62
60
|
|
63
|
-
get componentState():
|
64
|
-
return this.state as
|
61
|
+
get componentState(): SidePanelState {
|
62
|
+
return this.state as SidePanelState;
|
65
63
|
}
|
66
64
|
}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
import { useEffect, useState } from "react";
|
2
|
+
import { CoreComponentProps, RemoteObject } from "../types";
|
3
|
+
import { ToolEvents, debugDispatcher } from "../../global";
|
4
|
+
// Components
|
5
|
+
import './inspector.scss';
|
6
|
+
import Accordion from "../Accordion";
|
7
|
+
import InspectorField from './InspectorField';
|
8
|
+
// Utils
|
9
|
+
import { InspectCamera } from "./utils/InspectCamera";
|
10
|
+
import { InspectMaterial } from "./utils/InspectMaterial";
|
11
|
+
import { InspectTransform } from "./utils/InspectTransform";
|
12
|
+
import { InspectLight } from "./utils/InspectLight";
|
13
|
+
import { setItemProps } from "../utils";
|
14
|
+
import { AnimationMixer } from "three";
|
15
|
+
import InspectAnimation from "./utils/InspectAnimation";
|
16
|
+
|
17
|
+
export default function Inspector(props: CoreComponentProps) {
|
18
|
+
const [lastRefresh, setLastRefresh] = useState(-1);
|
19
|
+
const [currentObject, setCurrentObject] = useState<RemoteObject>({
|
20
|
+
name: '',
|
21
|
+
uuid: '',
|
22
|
+
type: '',
|
23
|
+
visible: false,
|
24
|
+
matrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
25
|
+
animations: [],
|
26
|
+
material: undefined,
|
27
|
+
perspectiveCameraInfo: undefined,
|
28
|
+
orthographicCameraInfo: undefined,
|
29
|
+
lightInfo: undefined,
|
30
|
+
});
|
31
|
+
|
32
|
+
useEffect(() => {
|
33
|
+
function onSelectItem(evt: any) {
|
34
|
+
const obj = evt.value as RemoteObject;
|
35
|
+
setCurrentObject(obj);
|
36
|
+
setLastRefresh(Date.now());
|
37
|
+
if (props.three.scene !== undefined) {
|
38
|
+
const child = props.three.scene.getObjectByProperty('uuid', obj.uuid);
|
39
|
+
if (child !== undefined && child.animations.length > 0) {
|
40
|
+
const mixer = new AnimationMixer(child);
|
41
|
+
console.log(mixer);
|
42
|
+
console.log(child.animations);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
debugDispatcher.addEventListener(ToolEvents.SET_OBJECT, onSelectItem);
|
48
|
+
return () => {
|
49
|
+
debugDispatcher.removeEventListener(ToolEvents.SET_OBJECT, onSelectItem);
|
50
|
+
};
|
51
|
+
}, []);
|
52
|
+
|
53
|
+
const objType = currentObject.type.toLowerCase();
|
54
|
+
|
55
|
+
return (
|
56
|
+
<Accordion label='Inspector' key='Inspector'>
|
57
|
+
<div id="Inspector" className={props.class} key={lastRefresh}>
|
58
|
+
{currentObject.uuid.length > 0 && (
|
59
|
+
<>
|
60
|
+
{/* Core */}
|
61
|
+
<>
|
62
|
+
<InspectorField
|
63
|
+
type="string"
|
64
|
+
title="Name"
|
65
|
+
prop="name"
|
66
|
+
value={currentObject.name}
|
67
|
+
disabled={true}
|
68
|
+
/>
|
69
|
+
<InspectorField
|
70
|
+
type="string"
|
71
|
+
title="Type"
|
72
|
+
prop="type"
|
73
|
+
value={currentObject.type}
|
74
|
+
disabled={true}
|
75
|
+
/>
|
76
|
+
<InspectorField
|
77
|
+
type="string"
|
78
|
+
title="UUID"
|
79
|
+
prop="uuid"
|
80
|
+
value={currentObject.uuid}
|
81
|
+
disabled={true}
|
82
|
+
/>
|
83
|
+
<InspectorField
|
84
|
+
type="boolean"
|
85
|
+
title="Visible"
|
86
|
+
prop="visible"
|
87
|
+
value={currentObject.visible}
|
88
|
+
onChange={(key: string, value: any) => {
|
89
|
+
props.three.updateObject(currentObject.uuid, key, value);
|
90
|
+
const child = props.three.scene?.getObjectByProperty('uuid', currentObject.uuid);
|
91
|
+
if (child !== undefined) setItemProps(child, key, value);
|
92
|
+
}}
|
93
|
+
/>
|
94
|
+
</>
|
95
|
+
|
96
|
+
{/* Data */}
|
97
|
+
<>
|
98
|
+
{/* Transform */}
|
99
|
+
{InspectTransform(currentObject, props.three)}
|
100
|
+
{/* Animations */}
|
101
|
+
{currentObject.animations.length > 0 ? InspectAnimation(currentObject, props.three) : null}
|
102
|
+
{/* Cameras */}
|
103
|
+
{objType.search('camera') > -1 ? InspectCamera(currentObject, props.three) : null}
|
104
|
+
{/* Lights */}
|
105
|
+
{objType.search('light') > -1 ? InspectLight(currentObject, props.three) : null}
|
106
|
+
{/* Material */}
|
107
|
+
{objType.search('mesh') > -1 ? InspectMaterial(currentObject, props.three) : null}
|
108
|
+
</>
|
109
|
+
</>
|
110
|
+
)}
|
111
|
+
</div>
|
112
|
+
</Accordion>
|
113
|
+
);
|
114
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import RemoteThree from "@/core/remote/RemoteThree";
|
2
|
+
import InspectorGroup from "../InspectorGroup";
|
3
|
+
import { InspectorFieldProps } from '../InspectorField';
|
4
|
+
import { AnimationClipInfo, RemoteObject } from '../../types';
|
5
|
+
import { setItemProps } from "../../utils";
|
6
|
+
|
7
|
+
export default function InspectAnimation(obj: RemoteObject, three: RemoteThree) {
|
8
|
+
const items: InspectorFieldProps[] = [];
|
9
|
+
obj.animations.forEach((value: AnimationClipInfo) => {
|
10
|
+
// Add animation
|
11
|
+
items.push({
|
12
|
+
title: 'Name',
|
13
|
+
type: 'string',
|
14
|
+
prop: 'name',
|
15
|
+
value: value.name,
|
16
|
+
disabled: true,
|
17
|
+
onChange: (prop: string, value: any) => {
|
18
|
+
three.updateObject(obj.uuid, prop, value);
|
19
|
+
const child = three.scene?.getObjectByProperty('uuid', obj.uuid);
|
20
|
+
if (child !== undefined) setItemProps(child, prop, value);
|
21
|
+
},
|
22
|
+
});
|
23
|
+
items.push({
|
24
|
+
title: 'Duration',
|
25
|
+
type: 'number',
|
26
|
+
prop: 'duration',
|
27
|
+
value: value.duration,
|
28
|
+
disabled: true,
|
29
|
+
onChange: (prop: string, value: any) => {
|
30
|
+
three.updateObject(obj.uuid, prop, value);
|
31
|
+
const child = three.scene?.getObjectByProperty('uuid', obj.uuid);
|
32
|
+
if (child !== undefined) setItemProps(child, prop, value);
|
33
|
+
},
|
34
|
+
});
|
35
|
+
items.push({
|
36
|
+
title: 'Blend Mode',
|
37
|
+
type: 'number',
|
38
|
+
prop: 'blendMode',
|
39
|
+
value: value.blendMode,
|
40
|
+
disabled: true,
|
41
|
+
onChange: (prop: string, value: any) => {
|
42
|
+
three.updateObject(obj.uuid, prop, value);
|
43
|
+
const child = three.scene?.getObjectByProperty('uuid', obj.uuid);
|
44
|
+
if (child !== undefined) setItemProps(child, prop, value);
|
45
|
+
},
|
46
|
+
});
|
47
|
+
});
|
48
|
+
return (
|
49
|
+
<InspectorGroup title="Animations" items={items} />
|
50
|
+
);
|
51
|
+
}
|
@@ -11,7 +11,7 @@ export interface ChildObjectProps extends CoreComponentProps {
|
|
11
11
|
three: RemoteThree
|
12
12
|
}
|
13
13
|
|
14
|
-
export interface
|
14
|
+
export interface SidePanelState {
|
15
15
|
scene?: Object3D
|
16
16
|
three: RemoteThree
|
17
17
|
}
|
@@ -71,6 +71,14 @@ export interface RemoteMaterial {
|
|
71
71
|
specularColor?: Color
|
72
72
|
}
|
73
73
|
|
74
|
+
// Animation Info
|
75
|
+
|
76
|
+
export interface AnimationClipInfo {
|
77
|
+
name: string;
|
78
|
+
duration: number;
|
79
|
+
blendMode: number;
|
80
|
+
}
|
81
|
+
|
74
82
|
// Camera Info
|
75
83
|
|
76
84
|
export interface PerspectiveCameraInfo {
|
@@ -114,6 +122,7 @@ export interface RemoteObject {
|
|
114
122
|
type: string
|
115
123
|
visible: boolean
|
116
124
|
matrix: number[] // based on Matrix4.elements
|
125
|
+
animations: AnimationClipInfo[]
|
117
126
|
material?: RemoteMaterial | RemoteMaterial[]
|
118
127
|
perspectiveCameraInfo?: PerspectiveCameraInfo
|
119
128
|
orthographicCameraInfo?: OrthographicCameraInfo
|
@@ -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';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Scene } from 'three';
|
1
|
+
import { Camera, Scene } from 'three';
|
2
2
|
import BaseRemote from './BaseRemote';
|
3
3
|
export default class RemoteThree extends BaseRemote {
|
4
4
|
scene?: Scene;
|
@@ -8,4 +8,6 @@ export default class RemoteThree extends BaseRemote {
|
|
8
8
|
updateObject(uuid: string, key: string, value: any): void;
|
9
9
|
createTexture(uuid: string, key: string, value: any): void;
|
10
10
|
setScene(value: Scene): void;
|
11
|
+
addCamera(camera: Camera): void;
|
12
|
+
removeCamera(camera: Camera): void;
|
11
13
|
}
|
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
@@ -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
|