Object3D QML Type
所有 3D 节点和资源的抽象基本类型。更多
Import Statement: | import QtQuick3D |
In C++: | QQuick3DObject |
Inherits: | |
Inherited By: | 16 typesEffect, Geometry, InstanceListEntry, InstanceModel, InstanceRange, Instancing, Material, MorphTarget, Node, Particle3D, RenderExtension, ResourceLoader, SceneEnvironment, Skin, Texture, and TextureData |
属性
- children : list<Object3D>
- data : list<Object>
- parent : Object3D
- resources : list<Object>
- state : string
- states : list<State>
- transitions : list<Transition>
详细说明
Object3D 是所有Qt Quick 3D 类型的基类。其中包括
- 表示三维场景中对象的空间类型,通常具有位置和/或方向。例如,Model 、Camera 或Light 。此类类型继承自Node ,而 又继承自 Object3D。
- 资源类型本身并不代表三维世界中的对象,而是作为Node 子类的组件,提供某种数据。这包括Material,Geometry, 和Texture 等。
除上述类型外,Object3D 还可以作为 Qt Quick items以及任意QObject 实例的父类。有关在 3D 场景中添加 2D 项目的更多信息,请参阅Qt Quick 3D 场景与 2D 内容。
另请参阅 Node 。
属性文档
children 属性包含此对象的可视化子对象列表。resources 属性包含要通过名称引用的非可视资源。
在添加子对象或资源时,一般不需要引用这些属性,因为默认的data 属性会根据情况自动将子对象分配给children
和resources
属性。详情请参见QtQuick3D::Object3D::data 文档。
注意: 尽管名称如此,QtQuick3D::Object3D::resources 并不返回 3D 资源列表。该名称来自QQuickItem 的语义。3D 资源是 QQuickObjec3D 的子类,因此将在 QtQuick3D::Objec3D::children 的列表中返回。
data : list<Object> |
parent : Object3D |
state : string |
此属性包含此对象可能的状态列表。要更改此对象的状态,可将state 属性设置为这些状态之一,或将state 属性设置为空字符串,以将对象恢复为默认状态。
该属性以State 对象列表的形式指定。例如,下面是一个具有 "above_state "和 "below_state "状态的 QtQuick3D::Node 对象:
import QtQuick import QtQuick3D Node { id: root y: 0 states: [ State { name: "above_state" PropertyChanges { target: root; y: 100 } }, State { name: "below_state" PropertyChanges { target: root; y: -100 } } ] }
有关使用状态和转换的详细信息,请参阅Qt Quick StatesandAnimation and Transitions inQt Quick。
注意: 该属性的作用与 QtQuick::Item::states 相同,但由于 QtQuick3D::Object3D 不是 QtQuick::Item 子类,所以该属性是必要的。
transitions : list<Transition> |
此属性保存此对象的转换列表。这些定义了对象在改变其state 时要应用的转换。
该属性指定为Transition 对象的列表。例如
import QtQuick import QtQuick3D Node { transitions: [ Transition { //... }, Transition { //... } ] }
有关使用状态和转换的更多详情,请参阅Qt Quick StatesandAnimation and Transitions inQt Quick。
注意: 该属性的工作原理与 QtQuick::Item::transitions 相同,但由于 QtQuick3D::Object3D 不是 QtQuick::Item 子类,所以该属性是必要的。
另请参阅 QtQuick3D::Object3D::states 。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.