From cb5c109cbd9caf33c14a589f75487d0139c17706 Mon Sep 17 00:00:00 2001 From: AmyOrz <340606700@qq.com> Date: Tue, 22 Jan 2019 11:45:48 +0800 Subject: [PATCH] feat(hotKey): bind hotKeys from setting.json --- src/config/editor/setting.json | 12 ++++- .../LeftHeaderAddGameObjectEventHandler.re | 6 +-- .../LeftHeaderCloneGameObjectEventHandler.re | 4 +- .../header/MainEditorLeftHeader.re | 11 +---- src/core/external/type/ReactEventType.re | 10 ++++- src/core/ui/App.re | 5 --- src/core/utils/engine/DefaultSceneUtils.re | 7 +-- src/core/utils/engine/MainUtils.re | 1 + src/service/record/editor/data/HotKeysType.re | 5 +++ src/service/record/editor/data/SettingType.re | 8 ++++ .../editor/hotKeys/OperateHotKeysService.re | 44 +++++++++++++++++++ .../editor/setting/OperateSettingService.re | 13 +----- .../editor/setting/ParseSettingService.re | 13 +++++- .../editor/setting/RecordSettingService.re | 2 +- .../setting/HotKeysSettingEditorService.re | 40 +++++++++++++++++ .../editor/setting/SetSettingEditorService.re | 2 +- .../state/engine/SceneEngineService.re | 22 ---------- .../engine/camera/CameraEngineService.re | 19 -------- .../stateTuple/logic/CameraLogicService.re | 19 ++++++++ .../logic/GameObjectLogicService.re | 9 +++- .../logic/PrimitiveLogicService.re} | 1 - .../stateTuple/logic/SceneLogicService.re | 20 +++++++++ .../mainEditorAssetHeaderDragWDB_test.re | 14 +++--- .../mainEditorAssetHeaderLoadWDB_test.re | 22 +++++----- .../mainEditorAssetHeaderRemoveWDB_test.re | 2 +- .../header/headerImportPackage_test.re | 16 +++---- .../job/tool/InitPickingJobTool.re | 2 +- test/tool/SceneTreeTool.re | 24 +++++----- test/tool/WDBTool.re | 10 ++--- test/unit/tool/SettingTool.re | 7 +++ 30 files changed, 242 insertions(+), 128 deletions(-) create mode 100644 src/service/record/editor/data/HotKeysType.re create mode 100644 src/service/record/editor/hotKeys/OperateHotKeysService.re create mode 100644 src/service/state/editor/setting/HotKeysSettingEditorService.re rename src/service/{state/engine/PrimitiveEngineService.re => stateTuple/logic/PrimitiveLogicService.re} (99%) mode change 100755 => 100644 create mode 100644 src/service/stateTuple/logic/SceneLogicService.re diff --git a/src/config/editor/setting.json b/src/config/editor/setting.json index dce159900..05d56c3cb 100644 --- a/src/config/editor/setting.json +++ b/src/config/editor/setting.json @@ -8,10 +8,18 @@ }, "hotkeys": { "redo": [ - "ctrl+r" + "ctrl+y", + "command+y" ], "undo": [ - "ctrl+z" + "ctrl+z", + "command+z" + ], + "duplicate": [ + "ctrl+d" + ], + "delete": [ + "delete" ] } } \ No newline at end of file diff --git a/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/eventHandler/LeftHeaderAddGameObjectEventHandler.re b/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/eventHandler/LeftHeaderAddGameObjectEventHandler.re index 246b88803..b3a0ebaed 100755 --- a/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/eventHandler/LeftHeaderAddGameObjectEventHandler.re +++ b/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/eventHandler/LeftHeaderAddGameObjectEventHandler.re @@ -23,7 +23,7 @@ module CustomEventHandler = { ); SceneUtils.addGameObject( - PrimitiveEngineService.createCube(( + PrimitiveLogicService.createCube(( defaultCubeGeometry, defaultLightMaterialData, )), @@ -43,14 +43,14 @@ module CustomEventHandler = { ); SceneUtils.addGameObject( - PrimitiveEngineService.createSphere(( + PrimitiveLogicService.createSphere(( defaultSphereGeometry, defaultLightMaterialData, )), ); | EmptyGameObject => - SceneUtils.addGameObject(PrimitiveEngineService.createEmptyGameObject) + SceneUtils.addGameObject(PrimitiveLogicService.createEmptyGameObject) }; SceneTreeEditorService.setIsShowChildren( diff --git a/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/eventHandler/LeftHeaderCloneGameObjectEventHandler.re b/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/eventHandler/LeftHeaderCloneGameObjectEventHandler.re index f5a3b840a..ca1217e69 100755 --- a/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/eventHandler/LeftHeaderCloneGameObjectEventHandler.re +++ b/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/eventHandler/LeftHeaderCloneGameObjectEventHandler.re @@ -41,7 +41,9 @@ module CustomEventHandler = { engineState |> HierarchyGameObjectEngineService.addChild( engineState - |> HierarchyGameObjectEngineService.getParentGameObject(targetGameObject) + |> HierarchyGameObjectEngineService.getParentGameObject( + targetGameObject, + ) |> OptionService.unsafeGet, clonedGameObject, ); diff --git a/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/header/MainEditorLeftHeader.re b/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/header/MainEditorLeftHeader.re index c88148d59..6877aeed4 100755 --- a/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/header/MainEditorLeftHeader.re +++ b/src/core/composable_component/mainEditor/composable_component/left_components/atom_component/header/MainEditorLeftHeader.re @@ -167,15 +167,8 @@ let _renderCloneGameObjectComponent = let render = (reduxTuple, ({state, send}: ReasonReact.self('a, 'b, 'c)) as self) => { let _isCurrentSceneTreeNodeCanBeOperate = - switch ( - SceneTreeEditorService.getCurrentSceneTreeNode - |> StateLogicService.getEditorState - ) { - | None => false - | Some(gameObject) => - SceneEngineService.isSceneGameObject(gameObject) - |> StateLogicService.getEngineStateToGetData - }; + GameObjectLogicService.isCurrentSceneTreeNodeCanBeOperate + |> StateLogicService.getStateToGetData;
diff --git a/src/core/external/type/ReactEventType.re b/src/core/external/type/ReactEventType.re index 865a37887..ec13d6f24 100755 --- a/src/core/external/type/ReactEventType.re +++ b/src/core/external/type/ReactEventType.re @@ -1,3 +1,9 @@ -external convertReactMouseEventToJsEvent : ReactEventRe.Mouse.t => Js.t({..}) = "%identity"; +external convertReactKeyboardEventToJsEvent : + ReactEventRe.Keyboard.t => Js.t({..}) = + "%identity"; -external convertReactFormEventToJsEvent : ReactEventRe.Form.t => Js.t({..}) = "%identity"; +external convertReactMouseEventToJsEvent : ReactEventRe.Mouse.t => Js.t({..}) = + "%identity"; + +external convertReactFormEventToJsEvent : ReactEventRe.Form.t => Js.t({..}) = + "%identity"; \ No newline at end of file diff --git a/src/core/ui/App.re b/src/core/ui/App.re index 669cc88a3..d044ff38a 100755 --- a/src/core/ui/App.re +++ b/src/core/ui/App.re @@ -47,11 +47,6 @@ let render = ((uiState: AppStore.appState, dispatchFunc), _self) => let make = (~state as uiState: AppStore.appState, ~dispatch, _children) => { ...component, didMount: _self => { - HotKeysJs.hotkeys("shift+m", (e, handler) => { - Js.log(23123); - Js.log(handler); - }); - WonderLog.Wonder_Console.makeObjInToWindow(); AppExtensionUtils.getExtension(Method.getStorageParentKey()) diff --git a/src/core/utils/engine/DefaultSceneUtils.re b/src/core/utils/engine/DefaultSceneUtils.re index 6769ac4d5..69fe1dd0b 100755 --- a/src/core/utils/engine/DefaultSceneUtils.re +++ b/src/core/utils/engine/DefaultSceneUtils.re @@ -28,7 +28,7 @@ let prepareSpecificGameObjects = (editorState, engineState) => { engineState, ); let (editorState, engineState, camera) = - CameraEngineService.createCamera(editorState, engineState); + CameraLogicService.createCamera(editorState, engineState); let (engineState, arcballCameraController) = ArcballCameraEngineService.create(engineState); @@ -73,7 +73,8 @@ let prepareSpecificGameObjects = (editorState, engineState) => { (editorState, engineState, camera); }; -let _prepareEngineState = ((camera, directionLight, cube1, cube2), engineState) => +let _prepareEngineState = + ((camera, directionLight, cube1, cube2), engineState) => engineState |> GameObjectComponentEngineService.unsafeGetBasicCameraViewComponent( camera, @@ -110,7 +111,7 @@ let createDefaultScene = (cubeGeometry, editorState, engineState) => { MaterialDataAssetEditorService.unsafeGetDefaultLightMaterial(editorState); let (editorState, engineState, camera, cube1, cube2, directionLight) = - SceneEngineService.createDefaultSceneGameObjects( + SceneLogicService.createDefaultSceneGameObjects( (cubeGeometry, defaultLightMaterialData), editorState, engineState, diff --git a/src/core/utils/engine/MainUtils.re b/src/core/utils/engine/MainUtils.re index 6ab850675..c63c480b9 100755 --- a/src/core/utils/engine/MainUtils.re +++ b/src/core/utils/engine/MainUtils.re @@ -96,6 +96,7 @@ let init = () => _, StateEditorService.getState(), ) + |> HotKeysSettingEditorService.bindHotKeys |> StateEditorService.setState |> ignore; diff --git a/src/service/record/editor/data/HotKeysType.re b/src/service/record/editor/data/HotKeysType.re new file mode 100644 index 000000000..b747c631f --- /dev/null +++ b/src/service/record/editor/data/HotKeysType.re @@ -0,0 +1,5 @@ +type hotKeyAction = + | Redo + | Undo + | Duplicate + | Delete; \ No newline at end of file diff --git a/src/service/record/editor/data/SettingType.re b/src/service/record/editor/data/SettingType.re index 1315d2ce4..065177298 100755 --- a/src/service/record/editor/data/SettingType.re +++ b/src/service/record/editor/data/SettingType.re @@ -5,7 +5,15 @@ type debug = { type redoUndo = {maxStackSize: int}; +type hotKeys = { + redo: array(string), + undo: array(string), + duplicate: array(string), + delete: array(string), +}; + type settingRecord = { debug: option(debug), redoUndo: option(redoUndo), + hotKeys: option(hotKeys), }; \ No newline at end of file diff --git a/src/service/record/editor/hotKeys/OperateHotKeysService.re b/src/service/record/editor/hotKeys/OperateHotKeysService.re new file mode 100644 index 000000000..04ce02ab7 --- /dev/null +++ b/src/service/record/editor/hotKeys/OperateHotKeysService.re @@ -0,0 +1,44 @@ +open HotKeysType; + +let getHandleFuncByHotKeyAction = hotKeyAction => { + let uiState = UIStateService.getState(); + let dispatch = UIStateService.getDispatch(); + let isCurrentSceneTreeNodeCanBeOperate = + GameObjectLogicService.isCurrentSceneTreeNodeCanBeOperate + |> StateLogicService.getStateToGetData; + + + switch (hotKeyAction) { + | Undo => (() => AllHistoryService.handleUndo(uiState, dispatch)) + | Redo => ( + () => + OperateStateHistoryService.hasRedoState( + AllStateData.getHistoryState(), + ) ? + AllHistoryService.redoHistoryState(uiState, dispatch) + |> StateHistoryService.getAndRefreshStateForHistory : + () + ) + + | Duplicate => ( + () => + isCurrentSceneTreeNodeCanBeOperate ? + MainEditorLeftHeader.Method.cloneCurrentSceneTreeNode( + (uiState, dispatch), + (), + (), + ) : + () + ) + | Delete => ( + () => + isCurrentSceneTreeNodeCanBeOperate ? + MainEditorLeftHeader.Method.disposeCurrentSceneTreeNode( + (uiState, dispatch), + (), + (), + ) : + () + ) + }; +}; \ No newline at end of file diff --git a/src/service/record/editor/setting/OperateSettingService.re b/src/service/record/editor/setting/OperateSettingService.re index ca083d744..197e75dce 100755 --- a/src/service/record/editor/setting/OperateSettingService.re +++ b/src/service/record/editor/setting/OperateSettingService.re @@ -1,17 +1,6 @@ open SettingType; -let setSetting = ({debug, redoUndo}) => { - debug: - switch (debug) { - | None => None - | Some(debug) => Some(debug) - }, - redoUndo: - switch (redoUndo) { - | None => None - | Some(redoUndo) => Some(redoUndo) - }, -}; +let unsafeGetHotKeys = ({hotKeys}) => hotKeys |> OptionService.unsafeGet; let unsafeGetIsDebug = ({debug}) => { let {isDebug} = debug |> OptionService.unsafeGet; diff --git a/src/service/record/editor/setting/ParseSettingService.re b/src/service/record/editor/setting/ParseSettingService.re index f80656e05..b70ed1fb9 100755 --- a/src/service/record/editor/setting/ParseSettingService.re +++ b/src/service/record/editor/setting/ParseSettingService.re @@ -5,7 +5,6 @@ let convertToRecord = setting => { open Decode; let json = setting; - { debug: json @@ -24,5 +23,17 @@ let convertToRecord = setting => { {maxStackSize: json |> field("max_stack_size", int)} ), ), + hotKeys: + json + |> optional( + field("hotkeys", json => + { + redo: json |> field("redo", array(string)), + undo: json |> field("undo", array(string)), + duplicate: json |> field("duplicate", array(string)), + delete: json |> field("delete", array(string)), + } + ), + ), }; }; \ No newline at end of file diff --git a/src/service/record/editor/setting/RecordSettingService.re b/src/service/record/editor/setting/RecordSettingService.re index d497a49a1..55f91cc0b 100755 --- a/src/service/record/editor/setting/RecordSettingService.re +++ b/src/service/record/editor/setting/RecordSettingService.re @@ -1,3 +1,3 @@ open SettingType; -let create = () => {debug: None, redoUndo: None}; \ No newline at end of file +let create = () => {debug: None, redoUndo: None, hotKeys: None}; \ No newline at end of file diff --git a/src/service/state/editor/setting/HotKeysSettingEditorService.re b/src/service/state/editor/setting/HotKeysSettingEditorService.re new file mode 100644 index 000000000..6f98c4dde --- /dev/null +++ b/src/service/state/editor/setting/HotKeysSettingEditorService.re @@ -0,0 +1,40 @@ +open EditorType; + +open HotKeysType; + +let unsafeGetHotKeys = ({settingRecord}) => + OperateSettingService.unsafeGetHotKeys(settingRecord); + +let _preventBrowserHotKeys = event => { + let e = ReactEventType.convertReactKeyboardEventToJsEvent(event); + + EventHelper.preventDefault(e); +}; + +let _handleHotKeyFunc = hotKeyDataArray => + hotKeyDataArray + |> Js.Array.forEach(((hotKeys, hotKeyAction)) => + hotKeys + |> Js.Array.joinWith(",") + |. HotKeysJs.hotkeys((e, handler) => { + _preventBrowserHotKeys(e); + + let handleFunc = + OperateHotKeysService.getHandleFuncByHotKeyAction(hotKeyAction); + + handleFunc(); + }) + ); + +let bindHotKeys = editorState => { + let hotKeySetting = editorState |> unsafeGetHotKeys; + [| + (hotKeySetting.redo, Redo), + (hotKeySetting.undo, Undo), + (hotKeySetting.duplicate, Duplicate), + (hotKeySetting.delete, Delete), + |] + |> _handleHotKeyFunc; + + editorState; +}; \ No newline at end of file diff --git a/src/service/state/editor/setting/SetSettingEditorService.re b/src/service/state/editor/setting/SetSettingEditorService.re index c9c10e4b8..3d2ec35d4 100755 --- a/src/service/state/editor/setting/SetSettingEditorService.re +++ b/src/service/state/editor/setting/SetSettingEditorService.re @@ -8,5 +8,5 @@ let setSetting = (setting, editorState) => { StateEditorService.setStateIsDebug(isDebug); StateEngineService.setIsDebug(isDebug) |> ignore; - {...editorState, settingRecord: OperateSettingService.setSetting(setting)}; + {...editorState, settingRecord: setting}; }; \ No newline at end of file diff --git a/src/service/state/engine/SceneEngineService.re b/src/service/state/engine/SceneEngineService.re index 3852b04c8..e78c9758b 100755 --- a/src/service/state/engine/SceneEngineService.re +++ b/src/service/state/engine/SceneEngineService.re @@ -1,26 +1,4 @@ open Wonderjs; - -let createDefaultSceneGameObjects = (componentData, editorState, engineState) => { - let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube( - componentData, - editorState, - engineState, - ); - let (editorState, engineState, cube2) = - PrimitiveEngineService.createCube( - componentData, - editorState, - engineState, - ); - let (editorState, engineState, directionLight) = - PrimitiveEngineService.createDirectionLight(editorState, engineState); - let (editorState, engineState, camera) = - CameraEngineService.createCamera(editorState, engineState); - - (editorState, engineState, camera, cube1, cube2, directionLight); -}; - let getAmbientLightColor = SceneAPI.getAmbientLightColor; let setAmbientLightColor = SceneAPI.setAmbientLightColor; diff --git a/src/service/state/engine/camera/CameraEngineService.re b/src/service/state/engine/camera/CameraEngineService.re index 234b21fe3..ae7a451db 100755 --- a/src/service/state/engine/camera/CameraEngineService.re +++ b/src/service/state/engine/camera/CameraEngineService.re @@ -17,25 +17,6 @@ let createCameraGroup = engineState => createPerspectiveCamera, )); -let createCamera = (editorState, engineState) => { - let (editorState, (engineState, gameObject)) = - GameObjectLogicService.createGameObject((editorState, engineState)); - let (engineState, cameraComponentRecord) = createCameraGroup(engineState); - - let engineState = - engineState - |> GameObjectEngineService.setGameObjectName("Camera", gameObject); - - let (editorState, engineState) = - (editorState, engineState) - |> GameObjectLogicService.addCameraGroup( - gameObject, - cameraComponentRecord, - ); - - (editorState, engineState, gameObject); -}; - let hasCameraGroup = (gameObject, engineState) => engineState |> CameraGroupEngineService.hasCameraGroupComponents( diff --git a/src/service/stateTuple/logic/CameraLogicService.re b/src/service/stateTuple/logic/CameraLogicService.re index 85be95bf4..41eb2da2b 100755 --- a/src/service/stateTuple/logic/CameraLogicService.re +++ b/src/service/stateTuple/logic/CameraLogicService.re @@ -32,6 +32,25 @@ ); }; */ +let createCamera = (editorState, engineState) => { + let (editorState, (engineState, gameObject)) = + GameObjectLogicService.createGameObject((editorState, engineState)); + let (engineState, cameraComponentRecord) = + CameraEngineService.createCameraGroup(engineState); + + let engineState = + engineState + |> GameObjectEngineService.setGameObjectName("Camera", gameObject); + + let (editorState, engineState) = + (editorState, engineState) + |> GameObjectLogicService.addCameraGroup( + gameObject, + cameraComponentRecord, + ); + + (editorState, engineState, gameObject); +}; let unbindArcballCameraControllerEventIfHasComponentForGameView = (gameObject, editorState, engineState) => { let targetRemoveBasicCameraView = diff --git a/src/service/stateTuple/logic/GameObjectLogicService.re b/src/service/stateTuple/logic/GameObjectLogicService.re index d0867617b..c16f7ab19 100755 --- a/src/service/stateTuple/logic/GameObjectLogicService.re +++ b/src/service/stateTuple/logic/GameObjectLogicService.re @@ -186,4 +186,11 @@ let disposeArcballCameraController = component, engineState, ), -); \ No newline at end of file +); + +let isCurrentSceneTreeNodeCanBeOperate = ((editorState, engineState)) => + switch (editorState |> SceneTreeEditorService.getCurrentSceneTreeNode) { + | None => false + | Some(gameObject) => + ! (engineState |> SceneEngineService.isSceneGameObject(gameObject)) + }; \ No newline at end of file diff --git a/src/service/state/engine/PrimitiveEngineService.re b/src/service/stateTuple/logic/PrimitiveLogicService.re old mode 100755 new mode 100644 similarity index 99% rename from src/service/state/engine/PrimitiveEngineService.re rename to src/service/stateTuple/logic/PrimitiveLogicService.re index d52a5ef1d..7078f896f --- a/src/service/state/engine/PrimitiveEngineService.re +++ b/src/service/stateTuple/logic/PrimitiveLogicService.re @@ -48,7 +48,6 @@ let _create3DGameObject = (editorState, engineState, obj); }; - let createCube = ((cubeGeometry, lightMaterial), editorState, engineState) => _create3DGameObject( ("Cube", cubeGeometry, lightMaterial), diff --git a/src/service/stateTuple/logic/SceneLogicService.re b/src/service/stateTuple/logic/SceneLogicService.re new file mode 100644 index 000000000..df693c431 --- /dev/null +++ b/src/service/stateTuple/logic/SceneLogicService.re @@ -0,0 +1,20 @@ +let createDefaultSceneGameObjects = (componentData, editorState, engineState) => { + let (editorState, engineState, cube1) = + PrimitiveLogicService.createCube( + componentData, + editorState, + engineState, + ); + let (editorState, engineState, cube2) = + PrimitiveLogicService.createCube( + componentData, + editorState, + engineState, + ); + let (editorState, engineState, directionLight) = + PrimitiveLogicService.createDirectionLight(editorState, engineState); + let (editorState, engineState, camera) = + CameraLogicService.createCamera(editorState, engineState); + + (editorState, engineState, camera, cube1, cube2, directionLight); +}; diff --git a/test/integration/asset/composable_component/header/mainEditorAssetHeaderDragWDB_test.re b/test/integration/asset/composable_component/header/mainEditorAssetHeaderDragWDB_test.re index 29c06146f..1e7b7d658 100755 --- a/test/integration/asset/composable_component/header/mainEditorAssetHeaderDragWDB_test.re +++ b/test/integration/asset/composable_component/header/mainEditorAssetHeaderDragWDB_test.re @@ -243,12 +243,12 @@ let _ = _test( (editorState, engineState) => { let (editorState, engineState, directionLight1) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); let (editorState, engineState, directionLight2) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); @@ -262,18 +262,18 @@ let _ = _test( (editorState, engineState) => { let (editorState, engineState, directionLight1) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); let (editorState, engineState, directionLight2) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); let (editorState, engineState, directionLight3) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); @@ -296,12 +296,12 @@ let _ = _test( (editorState, engineState) => { let (editorState, engineState, directionLight1) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); let (editorState, engineState, directionLight2) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); diff --git a/test/integration/asset/composable_component/header/mainEditorAssetHeaderLoadWDB_test.re b/test/integration/asset/composable_component/header/mainEditorAssetHeaderLoadWDB_test.re index 6898cfc37..c63873a37 100755 --- a/test/integration/asset/composable_component/header/mainEditorAssetHeaderLoadWDB_test.re +++ b/test/integration/asset/composable_component/header/mainEditorAssetHeaderLoadWDB_test.re @@ -381,14 +381,14 @@ let _ = LightMaterialEngineService.create(engineState); let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (geometry, lightMaterial), editorState, engineState, ); let (editorState, engineState, cube2) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (geometry, lightMaterial), editorState, engineState, @@ -723,21 +723,21 @@ let _ = ); let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (geometry, lightMaterial1), editorState, engineState, ); let (editorState, engineState, cube2) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (geometry, lightMaterial1), editorState, engineState, ); let (editorState, engineState, cube3) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (geometry, lightMaterial2), editorState, engineState, @@ -811,7 +811,7 @@ let _ = LightMaterialEngineService.create(engineState); let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (geometry, lightMaterial), editorState, engineState, @@ -931,7 +931,7 @@ let _ = GameObjectEngineService.create(engineState); let (editorState, engineState, directionLight1) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); @@ -964,22 +964,22 @@ let _ = let engineState = StateEngineService.unsafeGetState(); let (editorState, engineState, _) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); let (editorState, engineState, _) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); let (editorState, engineState, _) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); let (editorState, engineState, _) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); diff --git a/test/integration/asset/composable_component/header/mainEditorAssetHeaderRemoveWDB_test.re b/test/integration/asset/composable_component/header/mainEditorAssetHeaderRemoveWDB_test.re index 6fe0d291e..f3ad2cf02 100755 --- a/test/integration/asset/composable_component/header/mainEditorAssetHeaderRemoveWDB_test.re +++ b/test/integration/asset/composable_component/header/mainEditorAssetHeaderRemoveWDB_test.re @@ -331,7 +331,7 @@ let _ = LightMaterialEngineService.create(engineState); let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (geometry, lightMaterial), editorState, engineState, diff --git a/test/integration/header/headerImportPackage_test.re b/test/integration/header/headerImportPackage_test.re index 03fa42624..d62e39e1b 100755 --- a/test/integration/header/headerImportPackage_test.re +++ b/test/integration/header/headerImportPackage_test.re @@ -179,7 +179,7 @@ let _ = LightMaterialEngineService.create(engineState); let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (geometry, lightMaterial), editorState, engineState, @@ -193,7 +193,7 @@ let _ = LightMaterialEngineService.create(engineState); let (editorState, engineState, cube2) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (defaultCubeGeometryComponent, lightMaterial), editorState, engineState, @@ -1030,7 +1030,7 @@ let _ = LightMaterialEngineService.create(engineState); let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (geometry, lightMaterial), editorState, engineState, @@ -1651,22 +1651,22 @@ let _ = let editorState = StateEditorService.getState(); let engineState = StateEngineService.unsafeGetState(); let (editorState, engineState, light1) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); let (editorState, engineState, light2) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); let (editorState, engineState, light3) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); let (editorState, engineState, light4) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); @@ -1696,7 +1696,7 @@ let _ = |> JobEngineService.execDisposeJob; let (editorState, engineState, light5) = - PrimitiveEngineService.createDirectionLight( + PrimitiveLogicService.createDirectionLight( editorState, engineState, ); diff --git a/test/integration/job/tool/InitPickingJobTool.re b/test/integration/job/tool/InitPickingJobTool.re index 61cd42b54..d14e431d8 100755 --- a/test/integration/job/tool/InitPickingJobTool.re +++ b/test/integration/job/tool/InitPickingJobTool.re @@ -129,7 +129,7 @@ let createCube = engineState => { let prepareCamera = (cameraPos, (viewWidth, viewHeight), (editorState, engineState)) => { let (editorState, engineState, editCamera) = - CameraEngineService.createCamera(editorState, engineState); + CameraLogicService.createCamera(editorState, engineState); let editCameraPerspectiveCameraProjection = GameObjectComponentEngineService.unsafeGetPerspectiveCameraProjectionComponent( diff --git a/test/tool/SceneTreeTool.re b/test/tool/SceneTreeTool.re index 78c882a2e..9406b1d61 100755 --- a/test/tool/SceneTreeTool.re +++ b/test/tool/SceneTreeTool.re @@ -8,7 +8,7 @@ let _prepareSpecificGameObjects = engineState => { engineState, ); let (editorState, engineState, camera) = - CameraEngineService.createCamera(editorState, engineState); + CameraLogicService.createCamera(editorState, engineState); let (engineState, arcballCameraController) = ArcballCameraEngineService.create(engineState); @@ -36,11 +36,11 @@ let _prepareSpecificGameObjects = engineState => { let _buildTwoCameraSceneGraph = (componentData, editorState, engineState) => { let scene = MainEditorSceneTool.unsafeGetScene(); let (editorState, engineState, camera1) = - CameraEngineService.createCamera(editorState, engineState); + CameraLogicService.createCamera(editorState, engineState); let (editorState, engineState, camera2) = - CameraEngineService.createCamera(editorState, engineState); + CameraLogicService.createCamera(editorState, engineState); let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube(componentData, editorState, engineState); + PrimitiveLogicService.createCube(componentData, editorState, engineState); ( camera1, @@ -94,13 +94,13 @@ let buildTwoCameraSceneGraphToEngine = sandbox => { let _buildThreeLayerSceneGraph = (componentData, editorState, engineState) => { let scene = MainEditorSceneTool.unsafeGetScene(); let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube(componentData, editorState, engineState); + PrimitiveLogicService.createCube(componentData, editorState, engineState); let (editorState, engineState, cube2) = - PrimitiveEngineService.createCube(componentData, editorState, engineState); + PrimitiveLogicService.createCube(componentData, editorState, engineState); let (editorState, engineState, cube3) = - PrimitiveEngineService.createCube(componentData, editorState, engineState); + PrimitiveLogicService.createCube(componentData, editorState, engineState); let (editorState, engineState, cube4) = - PrimitiveEngineService.createCube(componentData, editorState, engineState); + PrimitiveLogicService.createCube(componentData, editorState, engineState); ( editorState, @@ -144,13 +144,13 @@ let buildThreeLayerSceneGraphToEngine = sandbox => { let _buildFourLayerSceneGraph = (componentData, editorState, engineState) => { let scene = MainEditorSceneTool.unsafeGetScene(); let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube(componentData, editorState, engineState); + PrimitiveLogicService.createCube(componentData, editorState, engineState); let (editorState, engineState, cube2) = - PrimitiveEngineService.createCube(componentData, editorState, engineState); + PrimitiveLogicService.createCube(componentData, editorState, engineState); let (editorState, engineState, cube3) = - PrimitiveEngineService.createCube(componentData, editorState, engineState); + PrimitiveLogicService.createCube(componentData, editorState, engineState); let (editorState, engineState, cube4) = - PrimitiveEngineService.createCube(componentData, editorState, engineState); + PrimitiveLogicService.createCube(componentData, editorState, engineState); ( editorState, engineState diff --git a/test/tool/WDBTool.re b/test/tool/WDBTool.re index 756703c16..4b4844789 100755 --- a/test/tool/WDBTool.re +++ b/test/tool/WDBTool.re @@ -137,14 +137,14 @@ let generateDirectionPointLightsAndCubeWDB = () => LightMaterialEngineService.create(engineState); let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (geometry, lightMaterial), editorState, engineState, ); let (editorState, engineState, directionLight) = - PrimitiveEngineService.createDirectionLight(editorState, engineState); + PrimitiveLogicService.createDirectionLight(editorState, engineState); let (editorState, engineState, pointLight) = _createPointLight(editorState, engineState); @@ -182,14 +182,14 @@ let generateSceneWDB = () => LightMaterialEngineService.create(engineState); let (editorState, engineState, cube1) = - PrimitiveEngineService.createCube( + PrimitiveLogicService.createCube( (geometry, lightMaterial), editorState, engineState, ); let (editorState, engineState, camera) = - CameraEngineService.createCamera(editorState, engineState); + CameraLogicService.createCamera(editorState, engineState); let (engineState, arcballCameraController) = ArcballCameraEngineService.create(engineState); @@ -235,7 +235,7 @@ let generateSceneWDB = () => ); let (editorState, engineState, directionLight) = - PrimitiveEngineService.createDirectionLight(editorState, engineState); + PrimitiveLogicService.createDirectionLight(editorState, engineState); /* let (editorState, engineState, pointLight) = _createPointLight(editorState, engineState); */ diff --git a/test/unit/tool/SettingTool.re b/test/unit/tool/SettingTool.re index 551f4890e..7601ea26d 100755 --- a/test/unit/tool/SettingTool.re +++ b/test/unit/tool/SettingTool.re @@ -7,6 +7,13 @@ let initSetting = editorState => { debug: Some({isDebug: true, showMessage: true}), redoUndo: Some({maxStackSize: 50}), + hotKeys: + Some({ + redo: [|"ctrl+y"|], + undo: [|"ctrl+z"|], + duplicate: [|"ctrl+d"|], + delete: [|"delete"|], + }), }, editorState, );