git.lucas.co / hou-control
git clone https://git.lucas.co/hou-control.git

commit90fe0e40b27dc8fd014321deac45e882f6e5274d
parentfac7d8decf
authorLucas Galante <lsgalante12@gmail.com>
date2026-04-17 09:55
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