@woosh/meep-engine 2.46.29 → 2.46.31
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/editor/Editor.js +793 -0
- package/editor/SelectionVisualizer.js +148 -0
- package/editor/actions/concrete/ActionUpdateTexture.js +21 -0
- package/editor/actions/concrete/ArrayCopyAction.js +39 -0
- package/editor/actions/concrete/ComponentAddAction.js +47 -0
- package/editor/actions/concrete/ComponentRemoveAction.js +38 -0
- package/editor/actions/concrete/EntityCreateAction.js +47 -0
- package/editor/actions/concrete/EntityRemoveAction.js +51 -0
- package/editor/actions/concrete/ModifyPatchSampler2DAction.js +118 -0
- package/editor/actions/concrete/ModifyPatchSampler2DAction.spec.js +30 -0
- package/editor/actions/concrete/ModifyPatchTextureArray2DAction.js +182 -0
- package/editor/actions/concrete/PaintTerrainOverlayAction.js +45 -0
- package/editor/actions/concrete/PatchTerrainHeightAction.js +67 -0
- package/editor/actions/concrete/PatchTerrainTextureAction.js +152 -0
- package/editor/actions/concrete/SelectionAddAction.js +36 -0
- package/editor/actions/concrete/SelectionClearAction.js +22 -0
- package/editor/actions/concrete/SelectionRemoveAction.js +30 -0
- package/editor/actions/concrete/TransformModifyAction.js +46 -0
- package/editor/actions/concrete/WriteGridValueAction.js +46 -0
- package/editor/ecs/EditorEntity.js +12 -0
- package/editor/ecs/EditorEntitySystem.js +14 -0
- package/editor/ecs/component/FieldDescriptor.js +34 -0
- package/editor/ecs/component/FieldValueAdapter.js +20 -0
- package/editor/ecs/component/TypeEditor.js +33 -0
- package/editor/ecs/component/TypeSchema.d.ts +38 -0
- package/editor/ecs/component/createFieldEditor.js +92 -0
- package/editor/ecs/component/createObjectEditor.js +361 -0
- package/editor/ecs/component/editors/ColorEditor.js +39 -0
- package/editor/ecs/component/editors/HTMLElementEditor.js +17 -0
- package/editor/ecs/component/editors/ImagePathEditor.js +82 -0
- package/editor/ecs/component/editors/LargeStrongEditor.js +107 -0
- package/editor/ecs/component/editors/NumericIntervalEditor.js +86 -0
- package/editor/ecs/component/editors/ObservedBooleanEditor.js +13 -0
- package/editor/ecs/component/editors/ObservedEnumEditor.js +32 -0
- package/editor/ecs/component/editors/ObservedIntegerEditor.js +43 -0
- package/editor/ecs/component/editors/ObservedStringEditor.js +51 -0
- package/editor/ecs/component/editors/Sampler2DEditor.js +221 -0
- package/editor/ecs/component/editors/collection/ListEditor.js +83 -0
- package/editor/ecs/component/editors/common/BitFlagsEditor.js +80 -0
- package/editor/ecs/component/editors/common/EnumEditor.js +41 -0
- package/editor/ecs/component/editors/common/makeV3_editor.js +85 -0
- package/editor/ecs/component/editors/common/noEditor.js +9 -0
- package/editor/ecs/component/editors/ecs/GridObstacleEditor.js +17 -0
- package/editor/ecs/component/editors/ecs/MinimapMarkerEditor.js +16 -0
- package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.js +225 -0
- package/editor/ecs/component/editors/ecs/ParameterTrackEditor.js +17 -0
- package/editor/ecs/component/editors/ecs/ParameterTrackSetEditor.js +18 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterEditor.js +58 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.js +58 -0
- package/editor/ecs/component/editors/ecs/SimulationStepDefinitionEditor.js +21 -0
- package/editor/ecs/component/editors/ecs/Trail2DEditor.js +33 -0
- package/editor/ecs/component/editors/ecs/TransformEditor.js +23 -0
- package/editor/ecs/component/editors/ecs/terrain/SplatMappingEditor.js +21 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainEditor.js +95 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainLayerEditor.js +18 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainLayersEditor.js +22 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainOverlayEditor.js +20 -0
- package/editor/ecs/component/editors/geom/QuaternionEditor.js +63 -0
- package/editor/ecs/component/editors/geom/Vector1Editor.js +57 -0
- package/editor/ecs/component/editors/geom/Vector2Editor.js +11 -0
- package/editor/ecs/component/editors/geom/Vector3Editor.js +13 -0
- package/editor/ecs/component/editors/geom/Vector4Editor.js +12 -0
- package/editor/ecs/component/editors/primitive/ArrayEditor.js +46 -0
- package/editor/ecs/component/editors/primitive/BooleanEditor.js +27 -0
- package/editor/ecs/component/editors/primitive/FunctionEditor.js +29 -0
- package/editor/ecs/component/editors/primitive/NumberEditor.js +60 -0
- package/editor/ecs/component/editors/primitive/ObjectEditor.js +12 -0
- package/editor/ecs/component/editors/primitive/StringEditor.js +31 -0
- package/editor/ecs/component/editors/three/BufferGeometryEditor.js +28 -0
- package/editor/ecs/component/editors/three/MaterialEditor.js +27 -0
- package/editor/ecs/component/editors/three/MeshEditor.js +35 -0
- package/editor/ecs/component/editors/three/TextureEditor.js +112 -0
- package/editor/ecs/component/findNearestRegisteredType.js +59 -0
- package/editor/ecs/component/prototypeObjectEditor.js +379 -0
- package/editor/enableEditor.js +85 -0
- package/editor/library/MeshLibrary.js +33 -0
- package/editor/process/DisableGameUIProcess.js +43 -0
- package/editor/process/EditorProcess.js +35 -0
- package/editor/process/ObstacleGridDisplayProcess.js +120 -0
- package/editor/process/ProcessEngine.js +123 -0
- package/editor/process/SymbolicDisplayProcess.js +132 -0
- package/editor/process/symbolic/ComponentSymbolicDisplay.js +34 -0
- package/editor/process/symbolic/SymbolicDisplayInternalAPI.js +159 -0
- package/editor/process/symbolic/buildThreeJSHelperEntity.js +36 -0
- package/editor/process/symbolic/make3DSymbolicDisplay.js +91 -0
- package/editor/process/symbolic/makeCameraSymbolicDisplay.js +32 -0
- package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +176 -0
- package/editor/process/symbolic/makeHelperBoxGeometry.js +44 -0
- package/editor/process/symbolic/makeHelperSphereGeometry.js +73 -0
- package/editor/process/symbolic/makeLightSymbolicDisplay.js +77 -0
- package/editor/process/symbolic/makeParticleEmitterSymbolicDisplay.js +146 -0
- package/editor/process/symbolic/makePathSymbolicDisplay.js +105 -0
- package/editor/process/symbolic/makePositionedIconDisplaySymbol.js +74 -0
- package/editor/process/symbolic/makeSocketsSymbolicDisplay.js +153 -0
- package/editor/process/symbolic/makeSolidArrowGeometry.js +391 -0
- package/editor/process/symbolic/makeSoundEmitterSymbolicDisplay.js +89 -0
- package/editor/process/symbolic/makeStoryTriggerSetAreaDisplay.js +114 -0
- package/editor/process/symbolic/synchronizeTransform.js +50 -0
- package/editor/tools/FoliagePaintTool.js +168 -0
- package/editor/tools/GridPaintTool.js +247 -0
- package/editor/tools/SelectionTool.js +407 -0
- package/editor/tools/TopDownCameraControlTool.js +59 -0
- package/editor/tools/TransformTool.js +370 -0
- package/editor/tools/engine/Tool.js +121 -0
- package/editor/tools/engine/ToolEngine.js +193 -0
- package/editor/tools/engine/ToolState.js +9 -0
- package/editor/tools/engine/ToolStateMachine.js +53 -0
- package/editor/tools/paint/TerrainHeightPaintTool.js +297 -0
- package/editor/tools/paint/TerrainPaintTool.js +211 -0
- package/editor/tools/paint/TerrainTexturePaintTool.js +193 -0
- package/editor/tools/paint/prototypeTerrainEditor.js +135 -0
- package/editor/tools/v2/BlenderCameraOrientationGizmo.d.ts +50 -0
- package/editor/tools/v2/BlenderCameraOrientationGizmo.js +500 -0
- package/editor/tools/v2/TransformControls.d.ts +20 -0
- package/editor/tools/v2/TransformControls.js +1782 -0
- package/editor/tools/v2/prototypeTransformControls.js +92 -0
- package/editor/view/EditorView.js +462 -0
- package/editor/view/GridPickCoordinateView.js +88 -0
- package/editor/view/ecs/ComponentControlFactory.js +48 -0
- package/editor/view/ecs/ComponentControlView.js +214 -0
- package/editor/view/ecs/EntityEditor.js +258 -0
- package/editor/view/ecs/EntityList.js +258 -0
- package/editor/view/ecs/components/BlackboardController.js +50 -0
- package/editor/view/ecs/components/DatGuiController.js +216 -0
- package/editor/view/ecs/components/FogOfWarController.js +78 -0
- package/editor/view/ecs/components/FogOfWarRevealerController.js +44 -0
- package/editor/view/ecs/components/GeneratedArmyController.js +42 -0
- package/editor/view/ecs/components/GridObstacleController.js +72 -0
- package/editor/view/ecs/components/GridPositionController.js +40 -0
- package/editor/view/ecs/components/HeadsUpDisplayController.js +30 -0
- package/editor/view/ecs/components/HighlightController.js +47 -0
- package/editor/view/ecs/components/MeshController.js +125 -0
- package/editor/view/ecs/components/PathFollowerController.js +87 -0
- package/editor/view/ecs/components/TagController.js +80 -0
- package/editor/view/ecs/components/TerrainController.js +225 -0
- package/editor/view/ecs/components/TransformController.js +103 -0
- package/editor/view/ecs/components/UnitShopController.js +112 -0
- package/editor/view/ecs/components/army/ArmyController.js +130 -0
- package/editor/view/ecs/components/color/GaugeView.js +107 -0
- package/editor/view/ecs/components/common/AutoCanvasView.js +53 -0
- package/editor/view/ecs/components/common/LineView.js +17 -0
- package/editor/view/ecs/components/common/NumberController.js +112 -0
- package/editor/view/ecs/components/common/NumericIntervalController.js +64 -0
- package/editor/view/ecs/components/gui/GUIElementController.js +117 -0
- package/editor/view/ecs/components/items/ItemContainerController.js +132 -0
- package/editor/view/ecs/components/items/ItemContainerController.stories.js +50 -0
- package/editor/view/ecs/components/items/ItemController.js +52 -0
- package/editor/view/ecs/components/particles/ColorParameterLUTController.js +444 -0
- package/editor/view/ecs/components/particles/ParameterTrackController.js +51 -0
- package/editor/view/ecs/components/particles/ParticleEmitterController.js +213 -0
- package/editor/view/ecs/components/particles/ParticleLayerController.js +213 -0
- package/editor/view/ecs/components/particles/ScalarParameterLUTController.js +401 -0
- package/editor/view/ecs/components/sockets/AttachmentSocketsController.js +51 -0
- package/editor/view/ecs/components/sound/SoundEmitterController.js +137 -0
- package/editor/view/ecs/components/story/StoryTriggerSetController.js +214 -0
- package/editor/view/ecs/components/unit/AuraController.js +45 -0
- package/editor/view/library/MeshLibraryView.js +164 -0
- package/editor/view/node-graph/NodeGraphEditorView.js +170 -0
- package/editor/view/node-graph/NodeGraphView.js +453 -0
- package/editor/view/node-graph/NodeView.js +135 -0
- package/editor/view/node-graph/PortView.js +69 -0
- package/editor/view/process/ProcessView.js +63 -0
- package/editor/view/tools/ToolSettingsView.js +143 -0
- package/editor/view/tools/ToolView.js +58 -0
- package/package.json +2 -1
- package/src/engine/intelligence/behavior/composite/CompositeBehavior.js +18 -2
- package/src/engine/intelligence/behavior/composite/ParallelBehavior.js +21 -9
- package/src/engine/intelligence/behavior/composite/SequenceBehavior.js +5 -1
- package/src/engine/intelligence/behavior/util/DelayBehavior.js +8 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Vector3 from "../../../../../src/core/geom/Vector3.js";
|
|
2
|
+
import Quaternion from "../../../../../src/core/geom/Quaternion.js";
|
|
3
|
+
import { ObjectEditor } from "../primitive/ObjectEditor.js";
|
|
4
|
+
|
|
5
|
+
export class TransformEditor extends ObjectEditor {
|
|
6
|
+
get schema() {
|
|
7
|
+
return {
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
|
|
10
|
+
properties: {
|
|
11
|
+
position: {
|
|
12
|
+
type: Vector3
|
|
13
|
+
},
|
|
14
|
+
rotation: {
|
|
15
|
+
type: Quaternion
|
|
16
|
+
},
|
|
17
|
+
scale: {
|
|
18
|
+
type: Vector3
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ObjectEditor } from "../../primitive/ObjectEditor.js";
|
|
2
|
+
|
|
3
|
+
export class SplatMappingEditor extends ObjectEditor {
|
|
4
|
+
get schema() {
|
|
5
|
+
return {
|
|
6
|
+
properties: {
|
|
7
|
+
depth: {
|
|
8
|
+
transient: true,
|
|
9
|
+
},
|
|
10
|
+
materialTexture: {
|
|
11
|
+
transient: true,
|
|
12
|
+
deprecated: true
|
|
13
|
+
},
|
|
14
|
+
materialSampler: {
|
|
15
|
+
transient: true,
|
|
16
|
+
deprecated: true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ObjectEditor } from "../../primitive/ObjectEditor.js";
|
|
2
|
+
import { BitFlagsEditor } from "../../common/BitFlagsEditor.js";
|
|
3
|
+
import { TerrainFlags } from "../../../../../../src/engine/ecs/terrain/ecs/TerrainFlags.js";
|
|
4
|
+
import { ImagePathEditor } from "../../ImagePathEditor.js";
|
|
5
|
+
import { EnumEditor } from "../../common/EnumEditor.js";
|
|
6
|
+
import { GridTransformKind } from "../../../../../../src/engine/ecs/terrain/ecs/GridTransformKind.js";
|
|
7
|
+
import { Texture } from "three";
|
|
8
|
+
|
|
9
|
+
export class TerrainEditor extends ObjectEditor {
|
|
10
|
+
build(parent, field, registry) {
|
|
11
|
+
const view = super.build(parent, field, registry);
|
|
12
|
+
|
|
13
|
+
if (view) {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {Terrain}
|
|
17
|
+
*/
|
|
18
|
+
const terrain = field.adapter.read(parent, field.name);
|
|
19
|
+
|
|
20
|
+
function updateLayers() {
|
|
21
|
+
|
|
22
|
+
terrain.layers.buildTexture();
|
|
23
|
+
terrain.layers.writeAllLayersDataIntoTexture();
|
|
24
|
+
|
|
25
|
+
terrain.updateMaterial();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// splats
|
|
29
|
+
view.bindSignal(terrain.layers.layers.on.added, () => {
|
|
30
|
+
if (terrain.getFlag(TerrainFlags.Built)) {
|
|
31
|
+
terrain.splat.addWeightLayer();
|
|
32
|
+
updateLayers();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
view.bindSignal(terrain.layers.layers.on.removed, (a, index) => {
|
|
36
|
+
if (terrain.getFlag(TerrainFlags.Built)) {
|
|
37
|
+
terrain.splat.removeWeightLayer(index);
|
|
38
|
+
|
|
39
|
+
updateLayers();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// mapping sizes
|
|
44
|
+
view.bindSignal(terrain.splat.size.onChanged, (x, y) => {
|
|
45
|
+
if (terrain.getFlag(TerrainFlags.Built)) {
|
|
46
|
+
terrain.splat.resize(x, y, terrain.splat.depth);
|
|
47
|
+
|
|
48
|
+
terrain.updateMaterial();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return view;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get schema() {
|
|
57
|
+
return {
|
|
58
|
+
properties: {
|
|
59
|
+
id: {
|
|
60
|
+
transient: true
|
|
61
|
+
},
|
|
62
|
+
flags: {
|
|
63
|
+
editor: new BitFlagsEditor(TerrainFlags),
|
|
64
|
+
transient: true
|
|
65
|
+
},
|
|
66
|
+
gridTransformKind: {
|
|
67
|
+
editor: new EnumEditor(GridTransformKind)
|
|
68
|
+
},
|
|
69
|
+
material: {
|
|
70
|
+
transient: true
|
|
71
|
+
},
|
|
72
|
+
heightMapURL: {
|
|
73
|
+
editor: new ImagePathEditor(),
|
|
74
|
+
deprecated: true,
|
|
75
|
+
type: String
|
|
76
|
+
},
|
|
77
|
+
heightRange: {
|
|
78
|
+
deprecated: true
|
|
79
|
+
},
|
|
80
|
+
bvh: {
|
|
81
|
+
transient: true,
|
|
82
|
+
},
|
|
83
|
+
heightTexture: {
|
|
84
|
+
transient: true
|
|
85
|
+
},
|
|
86
|
+
buildLightMap: {
|
|
87
|
+
type: Function
|
|
88
|
+
},
|
|
89
|
+
aoMap: {
|
|
90
|
+
type: Texture
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ObjectEditor } from "../../primitive/ObjectEditor.js";
|
|
2
|
+
import { ImagePathEditor } from "../../ImagePathEditor.js";
|
|
3
|
+
|
|
4
|
+
export class TerrainLayerEditor extends ObjectEditor {
|
|
5
|
+
get schema() {
|
|
6
|
+
return {
|
|
7
|
+
properties: {
|
|
8
|
+
textureDiffuseURL: {
|
|
9
|
+
type: String,
|
|
10
|
+
editor: new ImagePathEditor()
|
|
11
|
+
},
|
|
12
|
+
diffuse: {
|
|
13
|
+
transient: true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ObjectEditor } from "../../primitive/ObjectEditor.js";
|
|
2
|
+
import List from "../../../../../../src/core/collection/list/List.js";
|
|
3
|
+
import { TerrainLayer } from "../../../../../../src/engine/ecs/terrain/ecs/layers/TerrainLayer.js";
|
|
4
|
+
import Vector2 from "../../../../../../src/core/geom/Vector2.js";
|
|
5
|
+
|
|
6
|
+
export class TerrainLayersEditor extends ObjectEditor {
|
|
7
|
+
get schema() {
|
|
8
|
+
return {
|
|
9
|
+
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
properties: {
|
|
12
|
+
resolution: {
|
|
13
|
+
type: Vector2
|
|
14
|
+
},
|
|
15
|
+
layers: {
|
|
16
|
+
type: List,
|
|
17
|
+
type_parameters: [TerrainLayer]
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ObjectEditor } from "../../primitive/ObjectEditor.js";
|
|
2
|
+
import { ImagePathEditor } from "../../ImagePathEditor.js";
|
|
3
|
+
|
|
4
|
+
export class TerrainOverlayEditor extends ObjectEditor {
|
|
5
|
+
get schema() {
|
|
6
|
+
return {
|
|
7
|
+
properties: {
|
|
8
|
+
tileImage: {
|
|
9
|
+
editor: new ImagePathEditor()
|
|
10
|
+
},
|
|
11
|
+
fillColor: {
|
|
12
|
+
transient: true
|
|
13
|
+
},
|
|
14
|
+
texture: {
|
|
15
|
+
transient: true
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import Vector3 from "../../../../../src/core/geom/Vector3.js";
|
|
3
|
+
import { makeV3_editor } from "../common/makeV3_editor.js";
|
|
4
|
+
import { DEG_TO_RAD } from "../../../../../src/core/math/DEG_TO_RAD.js";
|
|
5
|
+
import { RAD_TO_DEG } from "../../../../../src/core/math/RAD_TO_DEG.js";
|
|
6
|
+
|
|
7
|
+
export class QuaternionEditor extends TypeEditor {
|
|
8
|
+
build(parent, field, registry) {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @type {Quaternion}
|
|
12
|
+
*/
|
|
13
|
+
const q = field.adapter.read(parent, field.name);
|
|
14
|
+
|
|
15
|
+
const euler = new Vector3();
|
|
16
|
+
|
|
17
|
+
let lock = false;
|
|
18
|
+
const sync_down = () => {
|
|
19
|
+
if (lock) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
lock = true;
|
|
24
|
+
|
|
25
|
+
q.__setFromEuler(
|
|
26
|
+
euler.x * DEG_TO_RAD,
|
|
27
|
+
euler.y * DEG_TO_RAD,
|
|
28
|
+
euler.z * DEG_TO_RAD
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
lock = false;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const sync_up = () => {
|
|
35
|
+
if (lock) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
lock = true;
|
|
40
|
+
|
|
41
|
+
const t = new Vector3();
|
|
42
|
+
|
|
43
|
+
q.toEulerAnglesXYZ(t);
|
|
44
|
+
|
|
45
|
+
euler.set(
|
|
46
|
+
t.x * RAD_TO_DEG,
|
|
47
|
+
t.y * RAD_TO_DEG,
|
|
48
|
+
t.z * RAD_TO_DEG,
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
lock = false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const editor = makeV3_editor(euler);
|
|
55
|
+
|
|
56
|
+
editor.bindSignal(q.onChanged, sync_up);
|
|
57
|
+
editor.bindSignal(euler.onChanged, sync_down);
|
|
58
|
+
|
|
59
|
+
editor.on.linked.add(sync_up);
|
|
60
|
+
|
|
61
|
+
return editor;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { NumberController } from "../../../../view/ecs/components/common/NumberController.js";
|
|
3
|
+
import Vector1 from "../../../../../src/core/geom/Vector1.js";
|
|
4
|
+
import { isSubclassOf } from "../../../../../src/engine/plugin/isSubclassOf.js";
|
|
5
|
+
|
|
6
|
+
export class Vector1Editor extends TypeEditor {
|
|
7
|
+
build(parent, field, registry) {
|
|
8
|
+
/**
|
|
9
|
+
* @type {Vector1}
|
|
10
|
+
*/
|
|
11
|
+
const v1 = field.adapter.read(parent, field.name);
|
|
12
|
+
|
|
13
|
+
if (!((v1 instanceof Vector1) || isSubclassOf(v1, Vector1))) {
|
|
14
|
+
throw new Error(`Field ${field} is not Vector1`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const view = new NumberController({ value: v1.getValue() });
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
let lock = false;
|
|
21
|
+
|
|
22
|
+
const sync_up = () => {
|
|
23
|
+
if (lock) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
lock = true;
|
|
28
|
+
|
|
29
|
+
view.value.set(v1.x);
|
|
30
|
+
|
|
31
|
+
lock = false;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const sync_down = () => {
|
|
35
|
+
|
|
36
|
+
if (lock) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
lock = true;
|
|
41
|
+
|
|
42
|
+
v1.set(
|
|
43
|
+
view.value.getValue(),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
lock = false;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
view.on.linked.add(sync_up);
|
|
50
|
+
|
|
51
|
+
view.bindSignal(view.value.onChanged, sync_down);
|
|
52
|
+
view.bindSignal(v1.onChanged, sync_up);
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
return view;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { make_row_editor } from "../common/makeV3_editor.js";
|
|
3
|
+
|
|
4
|
+
export class Vector2Editor extends TypeEditor {
|
|
5
|
+
|
|
6
|
+
build(parent, field) {
|
|
7
|
+
const v2 = field.adapter.read(parent, field.name);
|
|
8
|
+
|
|
9
|
+
return make_row_editor(['x', 'y'], v2);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { makeV3_editor } from "../common/makeV3_editor.js";
|
|
3
|
+
|
|
4
|
+
export class Vector3Editor extends TypeEditor {
|
|
5
|
+
|
|
6
|
+
build(parent, field) {
|
|
7
|
+
|
|
8
|
+
const v3 = field.adapter.read(parent, field.name);
|
|
9
|
+
|
|
10
|
+
return makeV3_editor(v3);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { make_row_editor } from "../common/makeV3_editor.js";
|
|
3
|
+
|
|
4
|
+
export class Vector4Editor extends TypeEditor {
|
|
5
|
+
|
|
6
|
+
build(parent, field) {
|
|
7
|
+
const v4 = field.adapter.read(parent, field.name);
|
|
8
|
+
|
|
9
|
+
return make_row_editor(['x', 'y', 'z', 'w'], v4);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import List from "../../../../../src/core/collection/list/List.js";
|
|
3
|
+
import { FieldDescriptor } from "../../FieldDescriptor.js";
|
|
4
|
+
import { FieldValueAdapter } from "../../FieldValueAdapter.js";
|
|
5
|
+
import { ListEditor } from "../collection/ListEditor.js";
|
|
6
|
+
import { noop } from "../../../../../src/core/function/Functions.js";
|
|
7
|
+
|
|
8
|
+
export class ArrayEditor extends TypeEditor {
|
|
9
|
+
inline = false;
|
|
10
|
+
|
|
11
|
+
__list_editor = new ListEditor();
|
|
12
|
+
|
|
13
|
+
build(parent, field, registry) {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {Array}
|
|
17
|
+
*/
|
|
18
|
+
const array = field.adapter.read(parent, field.name);
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const list = new List();
|
|
22
|
+
list.data = array;
|
|
23
|
+
list.length = array.length;
|
|
24
|
+
|
|
25
|
+
// remap to list
|
|
26
|
+
const surrogate_field = new FieldDescriptor();
|
|
27
|
+
surrogate_field.type = List;
|
|
28
|
+
|
|
29
|
+
if (field.schema) {
|
|
30
|
+
|
|
31
|
+
surrogate_field.schema = Object.assign({}, field.schema, {
|
|
32
|
+
type: List
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
surrogate_field.name = field.name;
|
|
37
|
+
surrogate_field.adapter = new FieldValueAdapter();
|
|
38
|
+
surrogate_field.adapter.read = () => list;
|
|
39
|
+
surrogate_field.adapter.write = noop;
|
|
40
|
+
surrogate_field.adapter.writable = false;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
return this.__list_editor.build(parent, surrogate_field, registry);
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import ObservedBoolean from "../../../../../src/core/model/ObservedBoolean.js";
|
|
3
|
+
import { CheckboxView } from "../../../../../src/view/elements/CheckboxView.js";
|
|
4
|
+
|
|
5
|
+
export class BooleanEditor extends TypeEditor {
|
|
6
|
+
build(parent, field,registry) {
|
|
7
|
+
const v = new ObservedBoolean(field.adapter.read(parent, field.name));
|
|
8
|
+
|
|
9
|
+
const ctrl = new CheckboxView({
|
|
10
|
+
value: v
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
function sync_up() {
|
|
14
|
+
v.set(field.adapter.read(parent, field.name));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function sync_down() {
|
|
18
|
+
field.adapter.write(parent, field.name, v.getValue());
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ctrl.on.linked.add(sync_up);
|
|
22
|
+
v.onChanged.add(sync_down);
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
return ctrl;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import ButtonView from "../../../../../src/view/elements/button/ButtonView.js";
|
|
3
|
+
|
|
4
|
+
export class FunctionEditor extends TypeEditor {
|
|
5
|
+
build(parent, field, registry) {
|
|
6
|
+
|
|
7
|
+
if (field.schema === undefined) {
|
|
8
|
+
// no schema, function editors are only available for explicit schema
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {Function}
|
|
14
|
+
*/
|
|
15
|
+
const v = field.adapter.read(parent, field.name);
|
|
16
|
+
|
|
17
|
+
if (typeof v !== "function") {
|
|
18
|
+
// wrong type
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return new ButtonView({
|
|
23
|
+
action: () => {
|
|
24
|
+
v.call(parent);
|
|
25
|
+
},
|
|
26
|
+
name: 'execute'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { NumberController } from "../../../../view/ecs/components/common/NumberController.js";
|
|
3
|
+
import LabelView from "../../../../../src/view/common/LabelView.js";
|
|
4
|
+
|
|
5
|
+
export class NumberEditor extends TypeEditor {
|
|
6
|
+
build(parent, field, registry) {
|
|
7
|
+
function read_value() {
|
|
8
|
+
return field.adapter.read(parent, field.name);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (field.adapter.writable) {
|
|
12
|
+
|
|
13
|
+
const ctrl = new NumberController();
|
|
14
|
+
|
|
15
|
+
let lock = false;
|
|
16
|
+
|
|
17
|
+
function sync_up() {
|
|
18
|
+
if (lock) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
lock = true;
|
|
23
|
+
|
|
24
|
+
let v = read_value();
|
|
25
|
+
|
|
26
|
+
if (Number.isNaN(v)) {
|
|
27
|
+
v = 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (typeof v !== "number") {
|
|
31
|
+
v = v.valueOf();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
ctrl.value.set(v);
|
|
35
|
+
|
|
36
|
+
lock = false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function sync_down() {
|
|
40
|
+
if (lock) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
lock = true;
|
|
45
|
+
|
|
46
|
+
field.adapter.write(parent, field.name, ctrl.value.getValue());
|
|
47
|
+
|
|
48
|
+
lock = false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ctrl.on.linked.add(sync_up);
|
|
52
|
+
ctrl.value.onChanged.add(sync_down);
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
return ctrl;
|
|
56
|
+
} else {
|
|
57
|
+
return new LabelView(read_value());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { createObjectEditor } from "../../createObjectEditor.js";
|
|
3
|
+
|
|
4
|
+
export class ObjectEditor extends TypeEditor {
|
|
5
|
+
inline = false;
|
|
6
|
+
|
|
7
|
+
build(parent, field, registry) {
|
|
8
|
+
const result = createObjectEditor(field.adapter.read(parent, field.name), registry);
|
|
9
|
+
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import EmptyView from "../../../../../src/view/elements/EmptyView.js";
|
|
3
|
+
|
|
4
|
+
export class StringEditor extends TypeEditor {
|
|
5
|
+
build(parent, field, registry) {
|
|
6
|
+
|
|
7
|
+
const ctrl = new EmptyView({
|
|
8
|
+
tag: 'input'
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
ctrl.attr({
|
|
12
|
+
type: 'text'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
function sync_up() {
|
|
16
|
+
ctrl.el.value = field.adapter.read(parent, field.name);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function sync_down() {
|
|
20
|
+
const str = ctrl.el.value;
|
|
21
|
+
|
|
22
|
+
field.adapter.write(parent, field.name, str);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ctrl.on.linked.add(sync_up);
|
|
26
|
+
ctrl.el.addEventListener('input', sync_down);
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
return ctrl;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { Sampler2D } from "../../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
3
|
+
import { renderObjectToSampler2D } from "../../../../../src/engine/graphics/util/renderObjectToSampler2D.js";
|
|
4
|
+
import { Mesh, MeshPhongMaterial } from "three";
|
|
5
|
+
import AABB2 from "../../../../../src/core/geom/AABB2.js";
|
|
6
|
+
import { CanvasView } from "../../../../../src/view/elements/CanvasView.js";
|
|
7
|
+
import sampler2D2Canvas from "../../../../../src/engine/graphics/texture/sampler/Sampler2D2Canvas.js";
|
|
8
|
+
|
|
9
|
+
export class BufferGeometryEditor extends TypeEditor {
|
|
10
|
+
build(parent, field, registry) {
|
|
11
|
+
|
|
12
|
+
const geo = field.adapter.read(parent, field.name);
|
|
13
|
+
|
|
14
|
+
const sampler = Sampler2D.uint8(4, 64, 64);
|
|
15
|
+
|
|
16
|
+
const preview = renderObjectToSampler2D(sampler, new Mesh(geo, new MeshPhongMaterial()), undefined, new AABB2(-0.05, -0.05, 1.05, 1.05));
|
|
17
|
+
|
|
18
|
+
preview.render();
|
|
19
|
+
|
|
20
|
+
const view = new CanvasView();
|
|
21
|
+
|
|
22
|
+
sampler2D2Canvas(sampler, 1, 0, view.el);
|
|
23
|
+
|
|
24
|
+
preview.dispose();
|
|
25
|
+
|
|
26
|
+
return view;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { Sampler2D } from "../../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
3
|
+
import { renderObjectToSampler2D } from "../../../../../src/engine/graphics/util/renderObjectToSampler2D.js";
|
|
4
|
+
import { Mesh, SphereBufferGeometry } from "three";
|
|
5
|
+
import { CanvasView } from "../../../../../src/view/elements/CanvasView.js";
|
|
6
|
+
import sampler2D2Canvas from "../../../../../src/engine/graphics/texture/sampler/Sampler2D2Canvas.js";
|
|
7
|
+
|
|
8
|
+
export class MaterialEditor extends TypeEditor {
|
|
9
|
+
build(parent, field, registry) {
|
|
10
|
+
|
|
11
|
+
const mat = field.adapter.read(parent, field.name);
|
|
12
|
+
|
|
13
|
+
const sampler = Sampler2D.uint8(4, 64, 64);
|
|
14
|
+
|
|
15
|
+
const preview = renderObjectToSampler2D(sampler, new Mesh(new SphereBufferGeometry(1), mat));
|
|
16
|
+
|
|
17
|
+
preview.render();
|
|
18
|
+
|
|
19
|
+
const view = new CanvasView();
|
|
20
|
+
|
|
21
|
+
sampler2D2Canvas(sampler, 1, 0, view.el);
|
|
22
|
+
|
|
23
|
+
preview.dispose();
|
|
24
|
+
|
|
25
|
+
return view;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { Sampler2D } from "../../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
3
|
+
import { renderObjectToSampler2D } from "../../../../../src/engine/graphics/util/renderObjectToSampler2D.js";
|
|
4
|
+
import AABB2 from "../../../../../src/core/geom/AABB2.js";
|
|
5
|
+
import { CanvasView } from "../../../../../src/view/elements/CanvasView.js";
|
|
6
|
+
import sampler2D2Canvas from "../../../../../src/engine/graphics/texture/sampler/Sampler2D2Canvas.js";
|
|
7
|
+
import { threeUpdateTransform } from "../../../../../src/engine/graphics/util/threeUpdateTransform.js";
|
|
8
|
+
|
|
9
|
+
export class MeshEditor extends TypeEditor {
|
|
10
|
+
build(parent, field, registry) {
|
|
11
|
+
const mesh = field.adapter.read(parent, field.name);
|
|
12
|
+
|
|
13
|
+
const sampler = Sampler2D.uint8(4, 128, 128);
|
|
14
|
+
|
|
15
|
+
const m = mesh.clone();
|
|
16
|
+
|
|
17
|
+
m.position.set(0, 0, 0);
|
|
18
|
+
m.rotation.set(0, 0, 0);
|
|
19
|
+
m.scale.set(1, 1, 1);
|
|
20
|
+
|
|
21
|
+
threeUpdateTransform(m);
|
|
22
|
+
|
|
23
|
+
const preview = renderObjectToSampler2D(sampler, m, undefined, new AABB2(-0.05, -0.05, 1.05, 1.05));
|
|
24
|
+
|
|
25
|
+
preview.render();
|
|
26
|
+
|
|
27
|
+
const view = new CanvasView();
|
|
28
|
+
|
|
29
|
+
sampler2D2Canvas(sampler, 1, 0, view.el);
|
|
30
|
+
|
|
31
|
+
preview.dispose();
|
|
32
|
+
|
|
33
|
+
return view;
|
|
34
|
+
}
|
|
35
|
+
}
|