@@ -73,11 +73,12 @@ def show_visual(self, value: bool):
73
73
if value == self ._show_visual :
74
74
return
75
75
self ._show_visual = value
76
+ parent = self
76
77
for i , visual_object in enumerate (self .visual_objects ):
77
78
if value :
78
- parent = self
79
- if i > 0 :
80
- parent = self .visual_objects [i - 1 ]
79
+ # NOTE: This is a workaround to avoid double transformation issue with latest version of `compas_viewer`.
80
+ # if i > 0:
81
+ # parent = self.visual_objects[i - 1]
81
82
self .scene .add (visual_object , parent )
82
83
self .scene .instance_colors [visual_object .instance_color .rgb255 ] = visual_object
83
84
else :
@@ -91,12 +92,13 @@ def show_collision(self):
91
92
def show_collision (self , value : bool ):
92
93
if value == self ._show_collision :
93
94
return
95
+ parent = self
94
96
self ._show_collision = value
95
97
for i , collision_object in enumerate (self .collision_objects ):
96
98
if value :
97
- parent = self
98
- if i > 0 :
99
- parent = self .visual_objects [i - 1 ]
99
+ # NOTE: This is a workaround to avoid double transformation issue with latest version of `compas_viewer`.
100
+ # if i > 0:
101
+ # parent = self.visual_objects[i - 1]
100
102
self .scene .add (collision_object , parent )
101
103
self .scene .instance_colors [collision_object .instance_color .rgb255 ] = collision_object
102
104
else :
@@ -113,8 +115,9 @@ def add_objects(objects, show_flag):
113
115
for i , obj in enumerate (objects ):
114
116
obj .init ()
115
117
if show_flag :
116
- if i > 0 :
117
- parent = objects [i - 1 ]
118
+ # NOTE: This is a workaround to avoid double transformation issue with latest version of `compas_viewer`.
119
+ # if i > 0:
120
+ # parent = objects[i - 1]
118
121
self .viewer .scene .add (obj , parent )
119
122
self .viewer .scene .instance_colors [obj .instance_color .rgb255 ] = obj
120
123
@@ -160,10 +163,10 @@ def update_joints(self, joint_state: Configuration):
160
163
161
164
if self .show_visual :
162
165
for obj in self .visual_objects :
163
- obj ._update_matrix ()
166
+ obj .update ()
164
167
165
168
if self .show_collision :
166
169
for obj in self .collision_objects :
167
- obj ._update_matrix ()
170
+ obj .update ()
168
171
169
172
self .viewer .renderer .update ()
0 commit comments