I need to port this C++ project to python https://github.com/KDAB/qt3d-examples/tree/master/blended-skinned-animation
The original project uses Qt3DQuickWindow which doesn't exist in python so I'm using a QQuickView
class QuickWidget:
def __init__(self):
self.app = QApplication(sys.argv)
format = QSurfaceFormat()
if QOpenGLContext.openGLModuleType() == QOpenGLContext.LibGL:
format.setVersion(3, 2)
format.setProfile(QSurfaceFormat.CoreProfile)
format.setDepthBufferSize(24)
format.setStencilBufferSize(8)
format.setSamples(4)
self.controller = SceneController()
self.controllerWidget = ControllerWidget(self.controller)
self.controllerWidget.show()
self.view = QQuickView()
self.view.setFormat(format)
self.view.setResizeMode(QQuickView.SizeRootObjectToView)
self.view.rootContext().setContextProperty("_controller", self.controller)
self.view.setSource(QUrl("main_quick.qml"))
self.view.show()
self.app.exec_()
I wrapped the main qml class https://github.com/KDAB/qt3d-examples/blob/master/blended-skinned-animation/main.qml inside an Item and a View3D.
Item {
id: mainview
width: 1280
height: 768
visible: true
View3D {
anchors.fill: parent
DefaultSceneEntity {
/// code from the original project
}
}
}
I didn't change the other qml files.