Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(entity): Move hide and is_hidden methods to Entity #1015

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading