Skip to content

Commit

Permalink
toggle visibility by groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Licini committed Jun 26, 2024
1 parent 99832cf commit fdba8ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/compas_viewer/renderer/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def paint(self):
viewworld = self.camera.viewworld()
self.update_projection()
# Object categorization
tag_objs, vector_objs, mesh_objs = self.sort_objects_from_category((obj for obj in self.viewer.scene.objects if obj.show))
tag_objs, vector_objs, mesh_objs = self.sort_objects_from_category(self.viewer.scene.visiable_objects)

# Draw model objects in the scene
self.shader_model.bind()
Expand Down
14 changes: 10 additions & 4 deletions src/compas_viewer/scene/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,19 @@ class ViewerScene(Scene):

def __init__(self, name: str = "ViewerScene", context: str = "Viewer"):
super().__init__(name=name, context=context)

# Primitive
self.objects: list[ViewerSceneObject]
# Selection
self.instance_colors: dict[tuple[int, int, int], ViewerSceneObject] = {}
self._instance_colors_generator = instance_colors_generator()

@property
def visiable_objects(self) -> list[ViewerSceneObject]:
def traverse(obj):
for child in obj.children:
if child.show:
yield child
yield from traverse(child)

return traverse(self.root)

@property
def viewer(self):
from compas_viewer import Viewer
Expand Down

0 comments on commit fdba8ee

Please sign in to comment.