本页内容

SceneLoader QML Type

提供加载现有场景的功能。更多...

Import Statement: import Qt3D.Render 2.12
In C++: QSceneLoader
Inherits:

Component

Status: Deprecated

此类型已弃用。我们强烈建议不要在新代码中使用它。

属性

方法

详细说明

给定一个 3D 源文件,SceneLoader 将尝试解析该文件,并构建一个包含适当GeometryRenderer 、Transform 和 Material 组件的 Entity 对象树。

加载器将根据模型文件的属性尝试确定最佳材质。若需使用自定义材质,则必须遍历该树,并将默认关联的材质替换为您的自定义材质。

顾名思义,SceneLoader 加载的是完整的场景子树。如果您只想加载单个几何体,则应改用 Mesh。

SceneLoader 内部依赖于插件来支持多种 3D 文件格式。以下是Qt3D 支持的格式列表。

注意:此 组件不应在多个 Entity 实例之间共享。否则将导致未定义的行为。

另请参阅 Mesh 和GeometryRenderer 。

属性文档

source : url

保存待加载源的网址。

status : enumeration [read-only]

保存场景加载状态。

另请参阅 Qt3DRender::QSceneLoader::Status 。

方法文档

Entity component(string entityName, enumeration componentType)

返回一个与已加载实体的componentType 匹配、且objectName与 entityName 匹配的组件。如果该实体有多个匹配的组件,则返回该实体组件列表中的第一个匹配项。如果没有匹配项,则返回一个未定义项。

  • SceneLoader.UnknownComponent 未知组件类型
  • SceneLoader.GeometryRendererComponent Qt3DRender::QGeometryRenderer 组件
  • SceneLoader.TransformComponent Qt3DCore::QTransform 组件
  • SceneLoader.MaterialComponent Qt3DRender::QMaterial 组件
  • SceneLoader.LightComponent Qt3DRender::QAbstractLight 组件
  • SceneLoader.CameraLensComponent Qt3DRender::QCameraLens 组件

另请参见 Qt3DRender::QSceneLoader::ComponentType 。

Entity entity(string entityName)

返回一个已加载的实体,其objectName 与entityName 参数匹配。如果多个实体名称相同,则无法确定返回的是其中哪一个,但返回的始终是同一个实体。

list entityNames()

返回已加载实体的objectNames 列表。

© 2026 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.