diff --git a/python/py_package/utils/viewer/entity_window.py b/python/py_package/utils/viewer/entity_window.py index 488b2452..b740f933 100644 --- a/python/py_package/utils/viewer/entity_window.py +++ b/python/py_package/utils/viewer/entity_window.py @@ -79,7 +79,9 @@ def enable_collision_visual(self, entity=None): vs = sapien.render.RenderShapePlane([1, 1e4, 1e4], blue_mat) elif isinstance(s, sapien.physx.PhysxCollisionShapeCylinder): - vs = sapien.render.RenderShapeCylinder(s.radius, s.half_length, green_mat) + vs = sapien.render.RenderShapeCylinder( + s.radius, s.half_length, green_mat + ) else: raise Exception( @@ -805,3 +807,6 @@ def get_ui_windows(self): if self.ui_window: return [self.ui_window] return [] + + def notify_scene_change(self): + self.reset() diff --git a/python/py_package/utils/viewer/render_window.py b/python/py_package/utils/viewer/render_window.py index 1f983ad2..d476d7e7 100644 --- a/python/py_package/utils/viewer/render_window.py +++ b/python/py_package/utils/viewer/render_window.py @@ -34,6 +34,11 @@ def set_shader(self, index): def reset(self): self.ui_window = None + self.shader_dir = None + self.shader_index = None + self.shader_list = None + self.shader_type = None + self.shader_types = None @property def is_rt(self): diff --git a/python/py_package/utils/viewer/transform_window.py b/python/py_package/utils/viewer/transform_window.py index 57e87b40..07c85fe0 100644 --- a/python/py_package/utils/viewer/transform_window.py +++ b/python/py_package/utils/viewer/transform_window.py @@ -14,15 +14,21 @@ def reset(self): self.gizmo = None self._gizmo_pose = sapien.Pose() self.ghost_objects = [] + self.ik_articulation = None - self.follow = False self.ik_enabled = True - self.display_ghosts = False - self.enabled = False + self.ik_errpr = None + self.ik_result = None + self.ik_success = False - # self.ui_move_group = None + self.follow = False + self.display_ghosts = False + self.enabled = False + self.ui_move_group = None self.move_group_joints = [] + self.move_group_selection = [] + self.pinocchio_model = None def close(self): self.reset() diff --git a/python/py_package/utils/viewer/viewer.py b/python/py_package/utils/viewer/viewer.py index 8a1aa062..d7ea280a 100644 --- a/python/py_package/utils/viewer/viewer.py +++ b/python/py_package/utils/viewer/viewer.py @@ -53,8 +53,6 @@ def __init__( if renderer is None: renderer = SapienRenderer() - self.renderer = renderer - self.renderer_context = renderer._internal_context if not shader_dir: @@ -125,7 +123,15 @@ def closed(self): return self.window is None def close(self): + for plugin in self.plugins: + plugin.close() + + self.selected_entity = None + self.scene = None + self.system = None self.window = None + self.plugins = None + self.renderer_context = None def set_camera_pose(self, pose): self.window.set_camera_pose(pose) @@ -140,8 +146,6 @@ def reset_notifications(self): def render(self): if self.window.should_close: - for plugin in self.plugins: - plugin.close() self.close() if self.closed: