Skip to content

Commit

Permalink
Merge pull request #1015 from AndreyYashkin/move_hide_to_entity
Browse files Browse the repository at this point in the history
feat(entity): Move hide and is_hidden methods to Entity
  • Loading branch information
cornerfarmer authored Dec 12, 2023
2 parents 8e6dd3e + 9863096 commit 7b2daf7
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 7b2daf7

Please sign in to comment.