Skip to content

Commit

Permalink
feat(imgCanvas): create import wdb/gltf file material snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyOrz committed Apr 10, 2019
1 parent 2b71dfc commit 1c75f35
Showing 1 changed file with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,18 +493,43 @@ module AssetTree = {
editorState,
);

/* TODO extract gltf/wdb material file, create material snapshot to store in imageDataMap */
(editorState, StateInspectorEngineService.unsafeGetState())
|> InspectorEngineGameObjectLogicService.disposeInspectorEngineContainerGameObjectAllChildren
|> JobEngineService.execDisposeJob
|> MaterialInspectorEngineUtils.createMaterialSphereIntoInspectorCanvas(
MaterialDataAssetType.LightMaterial,
material,
(editorState, engineState),
)
|> StateLogicService.refreshInspectorEngineState;

/* TODO need test */
let editorState =
MaterialNodeAssetEditorService.addMaterialNodeToAssetTree(
folderNode,
MaterialNodeAssetService.buildNode(
~nodeId=newNodeId,
~type_=MaterialDataAssetType.LightMaterial,
~materialComponent=material,
~imageDataIndex=newImageDataIndex,
),
editorState,
);
editorState
|> MaterialNodeAssetEditorService.addMaterialNodeToAssetTree(
folderNode,
MaterialNodeAssetService.buildNode(
~nodeId=newNodeId,
~type_=MaterialDataAssetType.LightMaterial,
~materialComponent=material,
~imageDataIndex=newImageDataIndex,
),
)
|> ImageDataMapAssetEditorService.setData(
newImageDataIndex,
ImageDataMapAssetService.buildData(
~base64=None,
~uint8Array=None,
~name=materialName,
~mimeType="image/png",
(),
),
)
|> ImgCanvasUtils.clipTargetCanvasToCreateImgCanvasSnapshot(
DomHelper.getElementById("inspector-canvas"),
DomHelper.getElementById("img-canvas"),
newNodeId,
);

(editorState, engineState);
},
Expand Down

0 comments on commit 1c75f35

Please sign in to comment.