@tomorrowevening/hermes 0.0.19 → 0.0.21
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 +561 -558
- package/dist/hermes.umd.cjs +15 -15
- package/package.json +1 -1
- package/src/core/remote/RemoteTheatre.ts +15 -4
- package/src/editor/Editor.tsx +1 -1
- package/src/editor/components/Draggable.tsx +1 -1
- package/src/editor/components/DraggableItem.tsx +1 -1
- package/src/editor/components/NavButton.tsx +1 -1
- package/src/editor/components/icons/CloseIcon.tsx +4 -4
- package/src/editor/components/icons/DragIcon.tsx +3 -3
- package/src/editor/multiView/CameraWindow.tsx +2 -2
- package/src/editor/multiView/UVMaterial.ts +1 -1
- package/src/editor/sidePanel/Accordion.tsx +3 -3
- package/src/editor/sidePanel/ChildObject.tsx +5 -5
- package/src/editor/sidePanel/SidePanel.tsx +1 -1
- package/src/editor/sidePanel/ToggleBtn.tsx +1 -1
- package/src/editor/sidePanel/inspector/Inspector.tsx +23 -23
- package/src/editor/sidePanel/inspector/InspectorField.tsx +12 -12
- package/src/editor/sidePanel/inspector/SceneInspector.tsx +5 -5
- package/src/editor/sidePanel/inspector/inspector.scss +5 -5
- package/src/editor/sidePanel/inspector/utils/InspectAnimation.tsx +4 -4
- package/src/editor/sidePanel/inspector/utils/InspectCamera.tsx +1 -1
- package/src/editor/sidePanel/inspector/utils/InspectLight.tsx +1 -1
- package/src/editor/sidePanel/inspector/utils/InspectMaterial.tsx +2 -2
- package/src/editor/sidePanel/inspector/utils/InspectTransform.tsx +2 -2
- package/src/editor/utils.ts +1 -1
- package/types/core/remote/RemoteTheatre.d.ts +4 -2
- package/types/editor/multiView/UVMaterial.d.ts +1 -1
- package/types/editor/sidePanel/inspector/Inspector.d.ts +1 -1
- package/types/editor/sidePanel/inspector/SceneInspector.d.ts +1 -1
- package/types/editor/sidePanel/inspector/utils/InspectAnimation.d.ts +1 -1
- package/types/editor/sidePanel/inspector/utils/InspectMaterial.d.ts +1 -1
- package/types/editor/sidePanel/inspector/utils/InspectTransform.d.ts +1 -1
- package/types/editor/utils.d.ts +1 -1
@@ -27,11 +27,11 @@ export const Dropdown = (props: DropdownProps) => {
|
|
27
27
|
|
28
28
|
return (
|
29
29
|
<div className={`dropdown ${props.up === true ? 'up' : ''}`}>
|
30
|
-
<div className=
|
30
|
+
<div className='dropdown-toggle' onClick={handleToggle}>
|
31
31
|
{selectedOption}
|
32
32
|
</div>
|
33
33
|
{props.open && (
|
34
|
-
<ul className=
|
34
|
+
<ul className='dropdown-menu'>
|
35
35
|
{props.options.map((option) => (
|
36
36
|
<li key={option} onClick={() => handleSelect(option)}>
|
37
37
|
{option}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { useState } from
|
1
|
+
import { useState } from 'react';
|
2
2
|
|
3
3
|
type AccordionProps = {
|
4
4
|
label: string
|
@@ -15,7 +15,7 @@ export default function Accordion(props: AccordionProps) {
|
|
15
15
|
return (
|
16
16
|
<div className={`accordion ${hide ? 'hide' : ''}`}>
|
17
17
|
<button
|
18
|
-
className=
|
18
|
+
className='toggle'
|
19
19
|
onClick={() => {
|
20
20
|
const value = !open;
|
21
21
|
if (props.onToggle !== undefined) props.onToggle(value);
|
@@ -27,7 +27,7 @@ export default function Accordion(props: AccordionProps) {
|
|
27
27
|
>
|
28
28
|
Toggle
|
29
29
|
</p>
|
30
|
-
<p className=
|
30
|
+
<p className='label'>{props.label}</p>
|
31
31
|
</button>
|
32
32
|
{props.button}
|
33
33
|
<div className={open ? 'open' : ''}>
|
@@ -18,11 +18,11 @@ export default function ChildObject(props: ChildObjectProps) {
|
|
18
18
|
}
|
19
19
|
|
20
20
|
return (
|
21
|
-
<div className=
|
22
|
-
<div className=
|
21
|
+
<div className='childObject' key={Math.random()}>
|
22
|
+
<div className='child'>
|
23
23
|
{hasChildren ? (
|
24
24
|
<button
|
25
|
-
className=
|
25
|
+
className='status'
|
26
26
|
style={{
|
27
27
|
backgroundPositionX: open ? '-14px' : '2px',
|
28
28
|
}}
|
@@ -32,7 +32,7 @@ export default function ChildObject(props: ChildObjectProps) {
|
|
32
32
|
></button>
|
33
33
|
) : null}
|
34
34
|
<button
|
35
|
-
className=
|
35
|
+
className='name'
|
36
36
|
style={{
|
37
37
|
left: hasChildren ? '20px' : '5px',
|
38
38
|
}}
|
@@ -47,7 +47,7 @@ export default function ChildObject(props: ChildObjectProps) {
|
|
47
47
|
<div className={`icon ${determineIcon(props.child)}`}></div>
|
48
48
|
</div>
|
49
49
|
<div className={open ? 'open' : ''}>
|
50
|
-
<div className=
|
50
|
+
<div className='container'>
|
51
51
|
{children}
|
52
52
|
</div>
|
53
53
|
</div>
|
@@ -30,7 +30,7 @@ export default class SidePanel extends Component<SidePanelState> {
|
|
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}>
|
@@ -1,17 +1,17 @@
|
|
1
|
-
import { useEffect, useState } from
|
2
|
-
import { CoreComponentProps, RemoteObject } from
|
3
|
-
import { ToolEvents, debugDispatcher } from
|
1
|
+
import { useEffect, useState } from 'react';
|
2
|
+
import { CoreComponentProps, RemoteObject } from '../types';
|
3
|
+
import { ToolEvents, debugDispatcher } from '../../global';
|
4
4
|
// Components
|
5
5
|
import './inspector.scss';
|
6
|
-
import Accordion from
|
6
|
+
import Accordion from '../Accordion';
|
7
7
|
import InspectorField from './InspectorField';
|
8
8
|
// Utils
|
9
|
-
import { InspectCamera } from
|
10
|
-
import { InspectMaterial } from
|
11
|
-
import { InspectTransform } from
|
12
|
-
import { InspectLight } from
|
13
|
-
import { setItemProps } from
|
14
|
-
import InspectAnimation from
|
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 InspectAnimation from './utils/InspectAnimation';
|
15
15
|
|
16
16
|
const defaultObject: RemoteObject = {
|
17
17
|
name: '',
|
@@ -54,36 +54,36 @@ export default function Inspector(props: CoreComponentProps) {
|
|
54
54
|
|
55
55
|
return (
|
56
56
|
<Accordion label='Inspector' key='Inspector'>
|
57
|
-
<div id=
|
57
|
+
<div id='Inspector' className={props.class} key={lastUpdated}>
|
58
58
|
{currentObject.uuid.length > 0 && (
|
59
59
|
<>
|
60
60
|
{/* Core */}
|
61
61
|
<>
|
62
62
|
<InspectorField
|
63
|
-
type=
|
64
|
-
title=
|
65
|
-
prop=
|
63
|
+
type='string'
|
64
|
+
title='Name'
|
65
|
+
prop='name'
|
66
66
|
value={currentObject.name}
|
67
67
|
disabled={true}
|
68
68
|
/>
|
69
69
|
<InspectorField
|
70
|
-
type=
|
71
|
-
title=
|
72
|
-
prop=
|
70
|
+
type='string'
|
71
|
+
title='Type'
|
72
|
+
prop='type'
|
73
73
|
value={currentObject.type}
|
74
74
|
disabled={true}
|
75
75
|
/>
|
76
76
|
<InspectorField
|
77
|
-
type=
|
78
|
-
title=
|
79
|
-
prop=
|
77
|
+
type='string'
|
78
|
+
title='UUID'
|
79
|
+
prop='uuid'
|
80
80
|
value={currentObject.uuid}
|
81
81
|
disabled={true}
|
82
82
|
/>
|
83
83
|
<InspectorField
|
84
|
-
type=
|
85
|
-
title=
|
86
|
-
prop=
|
84
|
+
type='boolean'
|
85
|
+
title='Visible'
|
86
|
+
prop='visible'
|
87
87
|
value={currentObject.visible}
|
88
88
|
onChange={(key: string, value: any) => {
|
89
89
|
props.three.updateObject(currentObject.uuid, key, value);
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { colorToHex } from
|
2
|
-
import { useEffect, useRef, useState } from
|
3
|
-
import { noImage } from
|
4
|
-
import { uploadLocalImage } from
|
1
|
+
import { colorToHex } from '@/editor/utils';
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
3
|
+
import { noImage } from '@/editor/components/content';
|
4
|
+
import { uploadLocalImage } from './utils/InspectMaterial';
|
5
5
|
|
6
6
|
export type InspectorFieldType = 'string' | 'number' | 'boolean' | 'range' | 'color' | 'button' | 'image'
|
7
7
|
|
@@ -89,12 +89,12 @@ export default function InspectorField(props: InspectorFieldProps) {
|
|
89
89
|
return (
|
90
90
|
<div className={`field ${block ? 'block' : ''}`}>
|
91
91
|
{props.type !== 'button' && (
|
92
|
-
<label key=
|
92
|
+
<label key='fieldLabel' ref={labelRef}>{props.title}</label>
|
93
93
|
)}
|
94
94
|
|
95
95
|
{props.type === 'string' && !textfield && (
|
96
96
|
<input
|
97
|
-
type=
|
97
|
+
type='text'
|
98
98
|
disabled={props.disabled}
|
99
99
|
onChange={onChange}
|
100
100
|
value={fieldValue}
|
@@ -113,7 +113,7 @@ export default function InspectorField(props: InspectorFieldProps) {
|
|
113
113
|
|
114
114
|
{props.type === 'boolean' && (
|
115
115
|
<input
|
116
|
-
type=
|
116
|
+
type='checkbox'
|
117
117
|
disabled={props.disabled}
|
118
118
|
onChange={onChange}
|
119
119
|
checked={fieldValue}
|
@@ -123,7 +123,7 @@ export default function InspectorField(props: InspectorFieldProps) {
|
|
123
123
|
{props.type === 'number' && (
|
124
124
|
<input
|
125
125
|
ref={inputRef}
|
126
|
-
type=
|
126
|
+
type='number'
|
127
127
|
value={fieldValue}
|
128
128
|
min={props.min}
|
129
129
|
max={props.max}
|
@@ -134,10 +134,10 @@ export default function InspectorField(props: InspectorFieldProps) {
|
|
134
134
|
|
135
135
|
{props.type === 'range' && (
|
136
136
|
<>
|
137
|
-
<input type=
|
137
|
+
<input type='text' value={fieldValue.toString()} onChange={onChange} className='min' />
|
138
138
|
<input
|
139
139
|
disabled={props.disabled}
|
140
|
-
type=
|
140
|
+
type='range'
|
141
141
|
value={fieldValue}
|
142
142
|
min={props.min}
|
143
143
|
max={props.max}
|
@@ -149,8 +149,8 @@ export default function InspectorField(props: InspectorFieldProps) {
|
|
149
149
|
|
150
150
|
{props.type === 'color' && (
|
151
151
|
<>
|
152
|
-
<input type=
|
153
|
-
<input type=
|
152
|
+
<input type='text' value={fieldValue.toString()} onChange={onChange} className='color' />
|
153
|
+
<input type='color' value={fieldValue} onChange={onChange} />
|
154
154
|
</>
|
155
155
|
)}
|
156
156
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import RemoteThree from
|
2
|
-
import { ToolEvents, debugDispatcher } from
|
3
|
-
import { useEffect } from
|
4
|
-
import { Texture } from
|
5
|
-
import { setItemProps, textureFromSrc } from
|
1
|
+
import RemoteThree from '@/core/remote/RemoteThree';
|
2
|
+
import { ToolEvents, debugDispatcher } from '@/editor/global';
|
3
|
+
import { useEffect } from 'react';
|
4
|
+
import { Texture } from 'three';
|
5
|
+
import { setItemProps, textureFromSrc } from '../utils';
|
6
6
|
|
7
7
|
export interface SceneInspectorProps {
|
8
8
|
three: RemoteThree
|
@@ -39,11 +39,11 @@ $icon_folder: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAB1CAYAAAD
|
|
39
39
|
}
|
40
40
|
}
|
41
41
|
|
42
|
-
input[type=
|
42
|
+
input[type='checkbox'] {
|
43
43
|
flex: none;
|
44
44
|
}
|
45
45
|
|
46
|
-
input[type=
|
46
|
+
input[type='color'] {
|
47
47
|
block-size: revert;
|
48
48
|
height: 21px;
|
49
49
|
padding-block: revert;
|
@@ -51,16 +51,16 @@ $icon_folder: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAB1CAYAAAD
|
|
51
51
|
margin: 0;
|
52
52
|
}
|
53
53
|
|
54
|
-
input[type=
|
54
|
+
input[type='number'], input[type='range'] {
|
55
55
|
appearance: none;
|
56
56
|
height: 11px;
|
57
57
|
}
|
58
58
|
|
59
|
-
input[type=
|
59
|
+
input[type='range']::-webkit-slider-runnable-track {
|
60
60
|
border: none;
|
61
61
|
}
|
62
62
|
|
63
|
-
input[type=
|
63
|
+
input[type='range']::-webkit-slider-thumb {
|
64
64
|
appearance: none;
|
65
65
|
background-color: #666;
|
66
66
|
height: 17px;
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import RemoteThree from
|
2
|
-
import InspectorGroup from
|
1
|
+
import RemoteThree from '@/core/remote/RemoteThree';
|
2
|
+
import InspectorGroup from '../InspectorGroup';
|
3
3
|
import { InspectorFieldProps } from '../InspectorField';
|
4
4
|
import { AnimationClipInfo, RemoteObject } from '../../types';
|
5
|
-
import { setItemProps } from
|
5
|
+
import { setItemProps } from '../../utils';
|
6
6
|
|
7
7
|
export default function InspectAnimation(obj: RemoteObject, three: RemoteThree) {
|
8
8
|
const items: InspectorFieldProps[] = [];
|
@@ -46,6 +46,6 @@ export default function InspectAnimation(obj: RemoteObject, three: RemoteThree)
|
|
46
46
|
});
|
47
47
|
});
|
48
48
|
return (
|
49
|
-
<InspectorGroup title=
|
49
|
+
<InspectorGroup title='Animations' items={items} />
|
50
50
|
);
|
51
51
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Color, Texture } from 'three';
|
2
2
|
import InspectorGroup from '../InspectorGroup';
|
3
|
-
import { RemoteMaterial, RemoteObject } from
|
3
|
+
import { RemoteMaterial, RemoteObject } from '../../types';
|
4
4
|
import RemoteThree from '@/core/remote/RemoteThree';
|
5
5
|
import { setItemProps, textureFromSrc } from '../../utils';
|
6
6
|
|
@@ -348,7 +348,7 @@ export function InspectMaterial(object: RemoteObject, three: RemoteThree): any {
|
|
348
348
|
} else {
|
349
349
|
return (
|
350
350
|
<InspectorGroup
|
351
|
-
title=
|
351
|
+
title='Material'
|
352
352
|
items={inspectMaterialItems(material, object, three)}
|
353
353
|
/>
|
354
354
|
);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Euler, Matrix4, Vector3 } from 'three';
|
2
2
|
import { degToRad, radToDeg } from 'three/src/math/MathUtils';
|
3
3
|
import InspectorGroup from '../InspectorGroup';
|
4
|
-
import { RemoteObject } from
|
4
|
+
import { RemoteObject } from '../../types';
|
5
5
|
import RemoteThree from '@/core/remote/RemoteThree';
|
6
6
|
import { setItemProps } from '../../utils';
|
7
7
|
import { round } from '@/editor/utils';
|
@@ -30,7 +30,7 @@ export function InspectTransform(obj: RemoteObject, three: RemoteThree) {
|
|
30
30
|
|
31
31
|
return (
|
32
32
|
<InspectorGroup
|
33
|
-
title=
|
33
|
+
title='Transform'
|
34
34
|
items={[
|
35
35
|
{
|
36
36
|
title: 'Position X',
|
package/src/editor/utils.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { IProject, IProjectConfig, ISheet, ISheetObject } from '@theatre/core';
|
1
|
+
import type { IProject, IProjectConfig, IRafDriver, ISheet, ISheetObject } from '@theatre/core';
|
2
2
|
import Application from '../Application';
|
3
3
|
import BaseRemote from './BaseRemote';
|
4
4
|
import { BroadcastData } from '../types';
|
@@ -9,12 +9,14 @@ export default class RemoteTheatre extends BaseRemote {
|
|
9
9
|
sheetObjects: Map<string, ISheetObject>;
|
10
10
|
sheetObjectCBs: Map<string, DataUpdateCallback>;
|
11
11
|
sheetObjectUnsubscribe: Map<string, VoidCallback>;
|
12
|
-
|
12
|
+
private static rafDriver;
|
13
|
+
init(projectName: string, projectConfig?: IProjectConfig | undefined): Promise<void>;
|
13
14
|
dispose(): void;
|
14
15
|
sheet(name: string): ISheet | undefined;
|
15
16
|
clearSheetObjects(sheetName: string): void;
|
16
17
|
sheetObject(sheetName: string, key: string, props: any, onUpdate?: DataUpdateCallback): ISheetObject | undefined;
|
17
18
|
unsubscribe(sheetObject: ISheetObject): undefined;
|
19
|
+
static getRafDriver(): IRafDriver;
|
18
20
|
}
|
19
21
|
export declare function HandleAppRemoteTheatre(app: Application, msg: BroadcastData): void;
|
20
22
|
export declare function HandleEditorRemoteTheatre(app: Application): void;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import RemoteThree from
|
1
|
+
import RemoteThree from '@/core/remote/RemoteThree';
|
2
2
|
import { RemoteObject } from '../../types';
|
3
3
|
export default function InspectAnimation(obj: RemoteObject, three: RemoteThree): import("react/jsx-runtime").JSX.Element;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { RemoteMaterial, RemoteObject } from
|
1
|
+
import { RemoteMaterial, RemoteObject } from '../../types';
|
2
2
|
import RemoteThree from '@/core/remote/RemoteThree';
|
3
3
|
export declare function acceptedMaterialNames(name: string): boolean;
|
4
4
|
export declare function prettyName(name: string): string;
|
package/types/editor/utils.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Material, Object3D, Texture } from
|
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;
|