We serialize the view from Visualize (camera information + visible nodes with their color and transform, if any). From its json, we want to be able to correctly reconstruct the view in HWV/Communicator.
Using the Visualize CameraKit (Canvas.GetAttachedLayout().GetAttachedView().GetSegmentKey().ShowCamera(out cameraKit)), we serialize the following camera information:
position (x, y, z)
target (x, y, z)
up vector (x, y, z)
field height, width
Is this sufficient to correctly set the camera and zoom in Communicator? The resulting camera in HWV is incorrect, the zoom does not match the one saved from Visualize. Are we missing something else or need additional information to get the zoom right? Perhaps the order a-d below we are using to recreate the view in HWV is incorrect?
a. Use the above information in Communicator.Camera.create() to create a camera and set it using this.hwv?.view.setCamera(). — PROBLEM
b. Isolate the visible nodes in the serialized view: this.hwv?.view.isolateNodes(visibleNodeIds)
c. Then set the custom color for nodes that have one: this.hwv?.model.setNodesColors(mapViewNodeIDColor)
d. Lastly, set the transforms for nodes that have one: this.hwv?.model.setNodeMatrix(nodeId, matrix) — PROBLEM
What is the correct mapping from the Visualize Projection settings Default and Stretched to the two Communicator Projection settings Perspective and Orthographic?
We are able to correctly set the visible nodes along with their colors in HWV. But the transforms are incorrect for some nodes. Do we need to somehow combine/change the transforms we get from Visualize before we set them in Communicator?