Skip to content

Commit

Permalink
feat(entity): Move hide and is_hidden methods to Entity
Browse files Browse the repository at this point in the history
closes #1014
  • Loading branch information
AndreyYashkin committed Dec 3, 2023
1 parent f2e77c0 commit 02b685c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 14 additions & 0 deletions blenderproc/python/types/EntityUtility.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,20 @@ def is_empty(self) -> bool:
"""
return self.blender_obj.type == "EMPTY"

def hide(self, hide_object: bool = True):
""" Sets the visibility of the object.
:param hide_object: Determines whether the object should be hidden in rendering.
"""
self.blender_obj.hide_render = hide_object

def is_hidden(self) -> bool:
""" Returns whether the object is hidden in rendering.
:return: True, if it is hidden.
"""
return self.blender_obj.hide_render

def __setattr__(self, key, value):
if key != "blender_obj":
raise RuntimeError("The entity class does not allow setting any attribute. Use the corresponding "
Expand Down
14 changes: 0 additions & 14 deletions blenderproc/python/types/MeshObjectUtility.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,20 +270,6 @@ def build_convex_decomposition_collision_shape(self, vhacd_path: str, temp_dir:
part.enable_rigidbody(True, "CONVEX_HULL")
part.hide()

def hide(self, hide_object: bool = True):
""" Sets the visibility of the object.
:param hide_object: Determines whether the object should be hidden in rendering.
"""
self.blender_obj.hide_render = hide_object

def is_hidden(self) -> bool:
""" Returns whether the object is hidden in rendering.
:return: True, if it is hidden.
"""
return self.blender_obj.hide_render

def disable_rigidbody(self):
""" Disables the rigidbody element of the object """
if self.has_rigidbody_enabled():
Expand Down

0 comments on commit 02b685c

Please sign in to comment.