@tomorrowevening/hermes 0.0.9 → 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 +1608 -1382
- package/dist/hermes.umd.cjs +16 -16
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/core/RemoteController.ts +7 -3
- package/src/core/remote/RemoteThree.ts +24 -11
- package/src/core/types.ts +2 -1
- package/src/editor/global.ts +3 -1
- package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/CameraWindow.tsx +20 -7
- package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/MultiView.scss +8 -0
- package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/MultiView.tsx +286 -56
- package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/MultiViewData.ts +7 -15
- package/src/editor/scss/{_sceneHierarchy.scss → _sidePanel.scss} +1 -1
- package/src/editor/scss/index.scss +1 -1
- package/src/editor/sidePanel/SidePanel.tsx +64 -0
- package/src/editor/sidePanel/inspector/Inspector.tsx +114 -0
- package/src/editor/{sceneHierarchy → sidePanel}/inspector/SceneInspector.tsx +16 -11
- package/src/editor/sidePanel/inspector/utils/InspectAnimation.tsx +51 -0
- package/src/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectMaterial.tsx +1 -0
- package/src/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectTransform.tsx +35 -46
- package/src/editor/{sceneHierarchy → sidePanel}/types.ts +10 -1
- package/src/editor/{sceneHierarchy → sidePanel}/utils.ts +11 -2
- package/src/editor/utils.ts +60 -4
- package/src/index.ts +9 -9
- package/types/core/remote/RemoteThree.d.ts +3 -2
- package/types/core/types.d.ts +1 -1
- package/types/editor/global.d.ts +2 -1
- package/types/editor/{sceneHierarchy/inspector/MultiView → multiView}/CameraWindow.d.ts +2 -0
- package/types/editor/{sceneHierarchy/inspector/MultiView → multiView}/MultiView.d.ts +2 -4
- package/types/editor/{sceneHierarchy/inspector/MultiView → multiView}/MultiViewData.d.ts +4 -4
- package/types/editor/sidePanel/SidePanel.d.ts +11 -0
- package/types/editor/{sceneHierarchy → sidePanel}/inspector/SceneInspector.d.ts +0 -2
- package/types/editor/sidePanel/inspector/utils/InspectAnimation.d.ts +3 -0
- package/types/editor/{sceneHierarchy → sidePanel}/types.d.ts +7 -1
- package/types/editor/utils.d.ts +7 -1
- package/types/index.d.ts +9 -9
- package/src/editor/sceneHierarchy/SceneHierarchy.tsx +0 -80
- package/src/editor/sceneHierarchy/inspector/Inspector.tsx +0 -97
- package/types/editor/sceneHierarchy/SceneHierarchy.d.ts +0 -13
- /package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/InfiniteGridHelper.ts +0 -0
- /package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/InfiniteGridMaterial.ts +0 -0
- /package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/UVMaterial.ts +0 -0
- /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/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/types/editor/{sceneHierarchy/inspector/MultiView → multiView}/InfiniteGridHelper.d.ts +0 -0
- /package/types/editor/{sceneHierarchy/inspector/MultiView → multiView}/InfiniteGridMaterial.d.ts +0 -0
- /package/types/editor/{sceneHierarchy/inspector/MultiView → multiView}/UVMaterial.d.ts +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/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
@@ -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/editor/utils.d.ts
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
-
import { Object3D } from "three";
|
1
|
+
import { Material, Object3D, Texture } from "three";
|
2
2
|
export declare function clamp(min: number, max: number, value: number): number;
|
3
3
|
export declare function distance(x: number, y: number): number;
|
4
4
|
export declare function randomID(): string;
|
5
5
|
export declare function isColor(obj: any): boolean;
|
6
6
|
export declare function colorToHex(obj: any): string;
|
7
|
+
export declare function round(value: number, precision?: number): number;
|
8
|
+
export declare let totalThreeObjects: number;
|
9
|
+
export declare const resetThreeObjects: () => void;
|
7
10
|
export declare const hierarchyUUID: (object: Object3D) => void;
|
11
|
+
export declare const disposeTexture: (texture?: Texture) => void;
|
12
|
+
export declare const disposeMaterial: (material?: Material | Material[]) => void;
|
13
|
+
export declare const dispose: (object: Object3D) => void;
|
package/types/index.d.ts
CHANGED
@@ -12,13 +12,13 @@ export { default as Draggable } from './editor/components/Draggable';
|
|
12
12
|
export { default as DropdownItem } from './editor/components/DropdownItem';
|
13
13
|
export { default as Dropdown } from './editor/components/Dropdown';
|
14
14
|
export { default as RemoteController } from './core/RemoteController';
|
15
|
-
export { default as InfiniteGridHelper } from './editor/
|
16
|
-
export { default as UVMaterial } from './editor/
|
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/
|
23
|
-
export { default as MultiView } from './editor/
|
15
|
+
export { default as InfiniteGridHelper } from './editor/multiView/InfiniteGridHelper';
|
16
|
+
export { default as UVMaterial } from './editor/multiView/UVMaterial';
|
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
|
+
export { default as MultiView } from './editor/multiView/MultiView';
|
24
24
|
export { default as Editor } from './editor/Editor';
|
@@ -1,80 +0,0 @@
|
|
1
|
-
// Libs
|
2
|
-
import { Component, ReactNode } from 'react';
|
3
|
-
// Models
|
4
|
-
import { debugDispatcher, ToolEvents } from '../global';
|
5
|
-
// Components
|
6
|
-
import '../scss/_sceneHierarchy.scss';
|
7
|
-
import Accordion from './Accordion';
|
8
|
-
import ContainerObject from './ContainerObject';
|
9
|
-
import Inspector from './inspector/Inspector';
|
10
|
-
import { SceneHierarchyState } from './types';
|
11
|
-
import RemoteThree from '@/core/remote/RemoteThree';
|
12
|
-
|
13
|
-
export default class SceneHierarchy extends Component<SceneHierarchyState> {
|
14
|
-
private three: RemoteThree;
|
15
|
-
|
16
|
-
constructor(props: SceneHierarchyState) {
|
17
|
-
super(props);
|
18
|
-
this.state = {
|
19
|
-
scene: props.scene !== undefined ? props.scene : null,
|
20
|
-
};
|
21
|
-
this.three = props.three;
|
22
|
-
debugDispatcher.addEventListener(ToolEvents.SET_SCENE, this.setScene);
|
23
|
-
}
|
24
|
-
|
25
|
-
componentDidMount(): void {
|
26
|
-
this.onRefresh();
|
27
|
-
}
|
28
|
-
|
29
|
-
componentWillUnmount(): void {
|
30
|
-
debugDispatcher.removeEventListener(ToolEvents.SET_SCENE, this.setScene);
|
31
|
-
}
|
32
|
-
|
33
|
-
render(): ReactNode {
|
34
|
-
const hasScene = this.componentState.scene !== null;
|
35
|
-
const HierarchyName = 'Hierarchy' + (hasScene ? `: ${this.componentState.scene?.name}` : '');
|
36
|
-
return (
|
37
|
-
<div id="SceneHierarchy" key="SceneHierarchy">
|
38
|
-
{(
|
39
|
-
<>
|
40
|
-
{hasScene && (
|
41
|
-
<Accordion
|
42
|
-
label={HierarchyName}
|
43
|
-
button={(
|
44
|
-
<button className='icon refresh hideText' onClick={this.onRefresh}>
|
45
|
-
Refresh
|
46
|
-
</button>
|
47
|
-
)}
|
48
|
-
open={true}
|
49
|
-
>
|
50
|
-
<ContainerObject child={this.componentState.scene!} three={this.three} />
|
51
|
-
</Accordion>
|
52
|
-
)}
|
53
|
-
|
54
|
-
<Accordion label='Inspector'>
|
55
|
-
<Inspector key="Inspector" three={this.three} />
|
56
|
-
</Accordion>
|
57
|
-
</>
|
58
|
-
)}
|
59
|
-
</div>
|
60
|
-
);
|
61
|
-
}
|
62
|
-
|
63
|
-
// Private
|
64
|
-
|
65
|
-
private onRefresh = () => {
|
66
|
-
this.three.getScene();
|
67
|
-
};
|
68
|
-
|
69
|
-
private setScene = (evt: any) => {
|
70
|
-
this.setState(() => ({
|
71
|
-
scene: evt.value
|
72
|
-
}));
|
73
|
-
};
|
74
|
-
|
75
|
-
// Getters / Setters
|
76
|
-
|
77
|
-
get componentState(): SceneHierarchyState {
|
78
|
-
return this.state as SceneHierarchyState;
|
79
|
-
}
|
80
|
-
}
|
@@ -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,13 +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
|
-
componentDidMount(): void;
|
8
|
-
componentWillUnmount(): void;
|
9
|
-
render(): ReactNode;
|
10
|
-
private onRefresh;
|
11
|
-
private setScene;
|
12
|
-
get componentState(): SceneHierarchyState;
|
13
|
-
}
|
File without changes
|
/package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/InfiniteGridMaterial.ts
RENAMED
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
|
/package/types/editor/{sceneHierarchy/inspector/MultiView → multiView}/InfiniteGridHelper.d.ts
RENAMED
File without changes
|
/package/types/editor/{sceneHierarchy/inspector/MultiView → multiView}/InfiniteGridMaterial.d.ts
RENAMED
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
|