-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(camera): if change arcballCameraController's gameObject's parent,…
… should update the component description if change arcballCameraController's gameObject's parent or change its parent's transform, should update the component in update_camera job. reason solution rewrite update_camera job in editor: update all arc camera controllers; update wonder.js version
- Loading branch information
Showing
5 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
let updateJob = (_, engineState) => | ||
engineState | ||
|> Wonderjs.UpdatePerspectiveCameraProjectionMainService.update | ||
|> Wonderjs.UpdateArcballCameraControllerMainService.updateAll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
open Wonderjs; | ||
|
||
open Wonder_jest; | ||
|
||
open Expect; | ||
|
||
open Expect.Operators; | ||
|
||
open Sinon; | ||
|
||
let _ = | ||
describe("update camera job", () => { | ||
let sandbox = getSandboxDefaultVal(); | ||
|
||
let _prepareState = () => { | ||
MainEditorSceneTool.initStateWithJob( | ||
~sandbox, | ||
~isInitJob=false, | ||
~noWorkerJobRecord= | ||
NoWorkerJobConfigToolEngine.buildNoWorkerJobConfig( | ||
~loopPipelines= | ||
{| | ||
[ | ||
{ | ||
"name": "default", | ||
"jobs": [ | ||
{"name": "update_camera" } | ||
] | ||
} | ||
] | ||
|}, | ||
(), | ||
), | ||
(), | ||
); | ||
|
||
MainEditorSceneTool.createDefaultScene( | ||
sandbox, | ||
MainEditorSceneTool.setFirstCubeToBeCurrentSceneTreeNode, | ||
); | ||
}; | ||
|
||
beforeEach(() => sandbox := createSandbox()); | ||
afterEach(() => restoreSandbox(refJsObjToSandbox(sandbox^))); | ||
|
||
describe("update all arcballCameraControllers", () => | ||
test("update undirty ones", () => { | ||
_prepareState(); | ||
StateLogicService.getAndSetEngineState(MainUtils._handleEngineState); | ||
|
||
MainEditorInspectorAddComponentTool.addArcballCameraControllerComponent(); | ||
|
||
ArcballCameraControllerToolEngine.clearDirtyArray | ||
|> StateLogicService.getAndSetEngineState; | ||
|
||
let pos = (0., 0., 0.); | ||
TransformGameObjectEngineService.setLocalPosition( | ||
GameObjectTool.getCurrentSceneTreeNodeTransform(), | ||
pos, | ||
) | ||
|> StateLogicService.getAndSetEngineState; | ||
|
||
StateLogicService.getAndSetEngineState( | ||
DirectorToolEngine.runWithDefaultTime, | ||
); | ||
|
||
TransformGameObjectEngineService.getLocalPosition( | ||
GameObjectTool.getCurrentSceneTreeNodeTransform(), | ||
) | ||
|> StateLogicService.getEngineStateToGetData | ||
|> expect != (0., 0., 0.); | ||
}) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters