Qt 3D studio的使用

我使用的组合为:Qt5.12.9 + Qt 3D studio2.8.0

其中
qt可以从这里下载:
https://download.qt.io/official_releases/qt/

studio可以从这里下载:
https://download.qt.io/official_releases/qt3dstudio/2.8/

studio的官方文档地址为:
https://doc.qt.io/archives/qt3dstudio/

安装好Qt以及studio之后,按照这里配置。
https://blog.csdn.net/chen_227/article/details/107021696
主要是:复制dll、复制头文件、复制pri、设置path

假如不把studio的bin加到系统变量的path中的话,
会出现这个问题:

QQmlApplicationEngine failed to load component
qrc:/main.qml:5 plugin cannot be loaded for module "QtStudio3D.OpenGL": ????????D:\Qt\Qt5.12.9\5.12.9\msvc2017_64\qml\QtStudio3D\OpenGL\declarative_qtstudio3dopengl.dll??????????????顣

在这里插入图片描述

---------------------------------------------------分割线----------------------------------------------------
假如想要通过Element去访问场景中的物体以及属性的话,可以这样子:

        Studio3D {
             id: studio3D
             anchors.fill: parent
             anchors.margins: 20

             Button{
                 anchors.left: parent.left
                 anchors.top: parent.top
             }

             Presentation {
                 source: "file:///D:/MyDesktop/SampleProject/SampleProject.uia"
                 SceneElement {
                     id: scene
                     elementPath: "Scene"
                     currentSlideIndex: 0
                 }
                 Element {
                     id: car
                     elementPath: "Scene.Road3D.Car"
                 }
             }
             ViewerSettings {
//                 showRenderStats: true
                 showRenderStats: false
             }
             onRunningChanged: {
                 console.log("Presentation ready!");
             }
        MouseArea{
            anchors.fill: parent
            onClicked: {
                car.setAttribute("scale.x", 2)
            }
        }
        
     }

其中element的path可以在studio中,在对象右键点击,选择copy object path得到:
在这里插入图片描述
attribute的话,只支持下面网址所列举的属性:
https://doc.qt.io/archives/qt3dstudio/runtime/qt3d-runtime-attribute-names.html

官方不太建议使用这种节点的方式访问、设置属性,说会增加耦合性,不利于程序与界面设计的分离。建议使用DataInput

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值