git clone https://git.lucas.co/hou-control.git
hc: fix AttributeError in HCCam by replacing centroid() with boundingBox().center()
python3.11libs/hc/hccam.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/python3.11libs/hc/hccam.py b/python3.11libs/hc/hccam.py
index e156b7c..899778a 100644
--- a/python3.11libs/hc/hccam.py
+++ b/python3.11libs/hc/hccam.py
@@ -36,19 +36,22 @@ class HCCam:
""" Movement """
def center(self):
- centroid = self.scene_viewer.geo().centroid()
+ geo = self.scene_viewer.geo()
+ centroid = geo.boundingBox().center() if geo else hou.Vector3(0, 0, 0)
self.t = hou.Vector3(centroid)
self.p = hou.Vector3(centroid)
def frame(self):
- centroid = self.geo().centroid()
+ geo = self.geo()
+ centroid = geo.boundingBox().center() if geo else hou.Vector3(0, 0, 0)
self.t = hou.Vector3(centroid)
self.p = hou.Vector3(centroid)
# self.ow = 10
self.setZoom(10)
def home(self):
- centroid = self.geo().centroid()
+ geo = self.geo()
+ centroid = geo.boundingBox().center() if geo else hou.Vector3(0, 0, 0)
self.t = centroid
self.p = centroid
# self.ow = 10