Skip to content
Permalink
Browse files

feat(wdb): add WDBInspector.re and refactor didMount and willunMount

  • Loading branch information...
AmyOrz
AmyOrz committed Apr 16, 2019
1 parent e47cf9d commit 29ddbeffec1b1a003a2cd7632b4441ac610bacd0
@@ -68,8 +68,7 @@ module CustomEventHandler = {
);

(editorState, inspectorEngineState)
|> InspectorEngineGameObjectLogicService.disposeInspectorEngineContainerGameObjectAllChildren
|> JobEngineService.execDisposeJob
|> AssetTreeInspectorUtils.disposeContainerGameObjectAllChildren
|> StateInspectorEngineService.setState
|> ignore;

@@ -29,8 +29,7 @@ let _createAllMaterialSnapshot =
) => {
let inspectorEngineState =
(editorState, inspectorEngineState)
|> InspectorEngineGameObjectLogicService.disposeInspectorEngineContainerGameObjectAllChildren
|> JobEngineService.execDisposeJob
|> AssetTreeInspectorUtils.disposeContainerGameObjectAllChildren
|> MaterialInspectorEngineUtils.createMaterialSphereIntoInspectorCanvas(
MaterialDataAssetType.LightMaterial,
material,
@@ -644,8 +644,7 @@ module AssetTree = {
);

(editorState, StateInspectorEngineService.unsafeGetState())
|> InspectorEngineGameObjectLogicService.disposeInspectorEngineContainerGameObjectAllChildren
|> JobEngineService.execDisposeJob
|> AssetTreeInspectorUtils.disposeContainerGameObjectAllChildren
|> MaterialInspectorEngineUtils.createMaterialSphereIntoInspectorCanvas(
MaterialDataAssetType.LightMaterial,
material,
@@ -686,8 +685,7 @@ module AssetTree = {
);

(editorState, StateInspectorEngineService.unsafeGetState())
|> InspectorEngineGameObjectLogicService.disposeInspectorEngineContainerGameObjectAllChildren
|> JobEngineService.execDisposeJob
|> AssetTreeInspectorUtils.disposeContainerGameObjectAllChildren
|> StateInspectorEngineService.setState
|> ignore;

@@ -7,10 +7,7 @@ module Method = {
let changeMaterialType = InspectorChangeMaterialTypeEventHandler.MakeEventHandler.pushUndoStackWithNoCopyEngineState;

let didMount = (type_, materialComponent) => {
DomHelper.setDomDisplay(
DomHelper.getElementById("inspectorCanvasParent"),
true,
);
AssetTreeInspectorUtils.showInspectorCanvas();

StateInspectorEngineService.unsafeGetState()
|> MaterialInspectorEngineUtils.createMaterialSphereIntoInspectorCanvas(
@@ -21,21 +18,7 @@ module Method = {
|> StateLogicService.refreshInspectorEngineState;
};

let willUnmount = () => {
DomHelper.setDomDisplay(
DomHelper.getElementById("inspectorCanvasParent"),
false,
);

(
StateEditorService.getState(),
StateInspectorEngineService.unsafeGetState(),
)
|> InspectorEngineGameObjectLogicService.disposeInspectorEngineContainerGameObjectAllChildren
|> JobEngineService.execDisposeJob
|> StateInspectorEngineService.setState
|> ignore;
};
let willUnmount = AssetTreeInspectorUtils.hideInspectorCanvasAndDisposeContainerGameObjectAllChildren;
};

let component = ReasonReact.reducerComponent("MaterialInspector");
@@ -1,16 +1,7 @@
module Method = {
let didMount = () => {
DomHelper.setDomDisplay(
DomHelper.getElementById("inspectorCanvasParent"),
true,
);

/* WDBInspectorEngineUtils */

};

let willUnmount = MaterialInspector.Method.willUnmount;
let didMount = () => AssetTreeInspectorUtils.showInspectorCanvas();

let willUnmount = AssetTreeInspectorUtils.hideInspectorCanvasAndDisposeContainerGameObjectAllChildren;
};

let component = ReasonReact.statelessComponent("WDBInspector");
@@ -38,11 +29,6 @@ let render = (name, (onChangeFunc, onBlurFunc), _self) =>
let make = (~name, ~onChangeFunc, ~onBlurFunc, _children) => {
...component,
render: _self => render(name, (onChangeFunc, onBlurFunc), _self),
/* didMount: _self =>
MaterialInspectorEngineUtils.createMaterialSphereInToInspectorCanvas(
type_,
materialComponent,
), */
didMount: _self => Js.log("fdccck"),
didMount: _self => Method.didMount(),
willUnmount: _self => Method.willUnmount(),
};
@@ -132,7 +132,13 @@ module Method = {
}
/>;

let buildWDBComponent = (state, send, _, _) =>
let buildWDBComponent =
(
(uiState, dispatchFunc),
(state, send),
currentNodeId,
{name, wdbGameObject},
) =>
<WDBInspector
name={state.inputValue}
onChangeFunc={_e => send(change(_e))}
@@ -154,7 +160,7 @@ module Method = {
buildScriptEventFunctionComponent(reduxTuple, state),
~scriptAttributeNodeFunc=
buildScriptAttributeComponent(reduxTuple, state),
~wdbNodeFunc=buildWDBComponent(state, send),
~wdbNodeFunc=buildWDBComponent(reduxTuple, (state, send)),
~folderNodeFunc=buildFolderComponent(state, send, languageType),
);

@@ -0,0 +1,29 @@
let showInspectorCanvas = () =>
DomHelper.setDomDisplay(
DomHelper.getElementById("inspectorCanvasParent"),
true,
);

let hideInspectorCanvas = () =>
DomHelper.setDomDisplay(
DomHelper.getElementById("inspectorCanvasParent"),
false,
);

let disposeContainerGameObjectAllChildren =
((editorState, inspectorEngineState)) =>
(editorState, inspectorEngineState)
|> InspectorEngineGameObjectLogicService.disposeInspectorEngineContainerGameObjectAllChildren
|> JobEngineService.execDisposeJob;

let hideInspectorCanvasAndDisposeContainerGameObjectAllChildren = () => {
hideInspectorCanvas();

(
StateEditorService.getState(),
StateInspectorEngineService.unsafeGetState(),
)
|> disposeContainerGameObjectAllChildren
|> StateInspectorEngineService.setState
|> ignore;
};
@@ -30,10 +30,7 @@ module Method = {
ResizeUtils.resizeMainCanvasScreen();
ResizeUtils.resizeInspectorCanvasScreen();

DomHelper.setDomDisplay(
DomHelper.getElementById("inspectorCanvasParent"),
false,
);
AssetTreeInspectorUtils.hideInspectorCanvas();
},
);

0 comments on commit 29ddbef

Please sign in to comment.
You can’t perform that action at this time.