Check camera timestamp (#431)

check camera timestamp
This commit is contained in:
Matthew Tancik authored and GitHub committed 2022-09-14 00:09:47 -07:00
1 parent cdb68aef60
commit 587e641884
3 files changed
+11 -2

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "viewer",
"homepage": ".",
"version": "22-09-13-0",
"version": "22-09-14-0",
"private": true,
"dependencies": {
"@emotion/react": "^11.10.4",
@@ -152,10 +152,12 @@ export default function ViewerWindow(props) {
if (websocket.readyState === WebSocket.OPEN) {
const cmd = 'write';
const path = 'renderingState/camera';
const data_packet = sceneTree.metadata.camera.toJSON();
data_packet.object.timestamp = +new Date();
const data = {
type: cmd,
path,
data: sceneTree.metadata.camera.toJSON(),
data: data_packet,
};
const message = msgpack.encode(data);
websocket.send(message);
+7
View File
@@ -235,6 +235,7 @@ class VisualizerState:
self.static_fps = 1
self.moving_fps = 24
self.camera_moving = False
self.prev_camera_timestamp = 0
self.outputs_set = False
@@ -525,6 +526,12 @@ class VisualizerState:
Args:
graph: current checkpoint of model
"""
# Check that timestamp is newer than the last one
if int(camera_object["timestamp"]) < self.prev_camera_timestamp:
return
self.prev_camera_timestamp = int(camera_object["timestamp"])
# check and perform output type updates
output_type = self.vis["renderingState/output_choice"].read()
output_type = OutputTypes.INIT if output_type is None else output_type