Skip to content

Commit 0d6f342

Browse files
committed
add recursive hide/unhide function
1 parent ec05f97 commit 0d6f342

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

loco-graphics-helper/frame.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
# Representation of a frame that is to be rendered
1515

1616

17+
def recursive_hide_children(object, hide, type = 'NONE'):
18+
object.hide_render = hide
19+
for child in object.children:
20+
if child.loco_graphics_helper_object_properties.object_type != 'NONE':
21+
if type != 'NONE':
22+
continue
23+
recursive_hide_children(child, hide)
24+
1725
class Frame:
1826
def __init__(self, frame_index, task, view_angle, bank_angle=0, vertical_angle=0, mid_angle=0):
1927
self.frame_index = frame_index
@@ -91,13 +99,9 @@ def prepare_scene(self):
9199
continue
92100
if o.loco_graphics_helper_object_properties.object_type == 'NONE':
93101
continue
94-
o.hide_render = True
95-
for c in o.children:
96-
c.hide_render = True
102+
recursive_hide_children(o,True)
97103

98-
self.target_object.hide_render = False
99-
for c in self.target_object.children:
100-
c.hide_render = False
104+
recursive_hide_children(self.target_object,False, self.target_object.loco_graphics_helper_object_properties.object_type)
101105

102106
object.location = self.target_object.matrix_world.translation
103107

0 commit comments

Comments
 (0)