Skip to content

Commit bc62080

Browse files
authored
Merge pull request #75 from RussTedrake/zmq_cache
zmqserver can cache objects
2 parents c1a0702 + f9b43a2 commit bc62080

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/meshcat/servers/zmqserver.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,12 @@ def handle_zmq(self, frames):
250250
return
251251
path = list(filter(lambda x: len(x) > 0, frames[1].decode("utf-8").split("/")))
252252
data = frames[2]
253-
self.forward_to_websockets(frames)
253+
# Support caching of objects (note: even UUIDs have to match).
254+
cache_hit = (cmd == "set_object" and
255+
find_node(self.tree, path).object and
256+
find_node(self.tree, path).object == data)
257+
if not cache_hit:
258+
self.forward_to_websockets(frames)
254259
if cmd == "set_transform":
255260
find_node(self.tree, path).transform = data
256261
elif cmd == "set_object":

0 commit comments

Comments
 (0)