Skip to content

Commit

Permalink
[viewer] Enable changing color for list visual mesh (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
iory authored Oct 31, 2023
1 parent 874ca16 commit fa467e7
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions skrobot/viewers/_trimesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,23 @@ def _add_link(self, link):
# TODO(someone) fix this at trimesh's scene.
if (isinstance(mesh, list) or isinstance(mesh, tuple)) \
and len(mesh) > 0:
mesh = trimesh.util.concatenate(mesh)
self.scene.add_geometry(
geometry=mesh,
node_name=link_id,
geom_name=link_id,
transform=transform,
)
self._links[link_id] = link
for m in mesh:
link_mesh_id = link_id + str(id(m))
self.scene.add_geometry(
geometry=m,
node_name=link_mesh_id,
geom_name=link_mesh_id,
transform=transform,
)
self._links[link_mesh_id] = link
else:
self.scene.add_geometry(
geometry=mesh,
node_name=link_id,
geom_name=link_id,
transform=transform,
)
self._links[link_id] = link

for child_link in link._child_links:
self._add_link(child_link)
Expand Down

0 comments on commit fa467e7

Please sign in to comment.