From 02b685cd818000b5a21e979b2a0e2fda707dc533 Mon Sep 17 00:00:00 2001 From: Andrey Yashkin Date: Sun, 3 Dec 2023 18:32:27 +0700 Subject: [PATCH] feat(entity): Move hide and is_hidden methods to Entity closes #1014 --- blenderproc/python/types/EntityUtility.py | 14 ++++++++++++++ blenderproc/python/types/MeshObjectUtility.py | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/blenderproc/python/types/EntityUtility.py b/blenderproc/python/types/EntityUtility.py index 3fd730cf6..ea37891a3 100644 --- a/blenderproc/python/types/EntityUtility.py +++ b/blenderproc/python/types/EntityUtility.py @@ -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 " diff --git a/blenderproc/python/types/MeshObjectUtility.py b/blenderproc/python/types/MeshObjectUtility.py index 84dbda6ba..0c06b5635 100644 --- a/blenderproc/python/types/MeshObjectUtility.py +++ b/blenderproc/python/types/MeshObjectUtility.py @@ -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():