From 2a7844480b47dca91bef28a9057effaef2b32f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 1 Oct 2024 16:35:20 +0200 Subject: [PATCH] [qt6][components] Update Scene3DHelper and TrackballController Call the `QGeometry` objects from the correct module, and initialize correctly the Camera object upon the construction of the TrackballController object. --- meshroom/ui/components/scene3D.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/meshroom/ui/components/scene3D.py b/meshroom/ui/components/scene3D.py index 7187110a..58890fea 100644 --- a/meshroom/ui/components/scene3D.py +++ b/meshroom/ui/components/scene3D.py @@ -41,14 +41,14 @@ class Scene3DHelper(QObject): def faceCount(self, entity): """ Returns face count based on children QGeometry buffers size.""" count = 0 - for geo in entity.findChildren(Qt3DRender.QGeometry): + for geo in entity.findChildren(Qt3DCore.QGeometry): count += sum([attr.count() for attr in geo.attributes() if attr.name() == "vertexPosition"]) return count / 3 @Slot(Qt3DCore.QEntity, result=int) def vertexColorCount(self, entity): count = 0 - for geo in entity.findChildren(Qt3DRender.QGeometry): + for geo in entity.findChildren(Qt3DCore.QGeometry): count += sum([attr.count() for attr in geo.attributes() if attr.name() == "vertexColor"]) return count @@ -59,10 +59,12 @@ class TrackballController(QObject): Based on the C++ version from https://github.com/cjmdaixi/Qt3DTrackball """ - _windowSize = QSize() - _camera = None - _trackballSize = 1.0 - _rotationSpeed = 5.0 + def __init__(self, parent=None): + super().__init__(parent) + self._windowSize = QSize() + self._camera = None + self._trackballSize = 1.0 + self._rotationSpeed = 5.0 def projectToTrackball(self, screenCoords): sx = screenCoords.x() @@ -98,7 +100,7 @@ class TrackballController(QObject): windowSizeChanged = Signal() windowSize = makeProperty(QSize, '_windowSize', windowSizeChanged) cameraChanged = Signal() - camera = makeProperty(Qt3DRender.QCamera, '_camera', cameraChanged) + camera = makeProperty(QObject, '_camera', cameraChanged) trackballSizeChanged = Signal() trackballSize = makeProperty(float, '_trackballSize', trackballSizeChanged) rotationSpeedChanged = Signal()