Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Import mesh with FileDialog
Qt 6.11 is out! See what's new in the release blog

Import mesh with FileDialog

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 223 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MaverickHunterX93
    wrote on last edited by
    #1

    Hello everyone,

    I'm facing an issue while trying to load a mesh using the Mesh component within a Scene3D element in Qt 5.15.2. The mesh doesn't load, and I receive the following error messages:

    Qt3D.Renderer.SceneLoaders: class Qt3DCore::QEntity *__cdecl Qt3DRender::Render::LoadSceneJob::tryLoadScene(enum Qt3DRender::QSceneLoader::Status &,const class QStringList &,const class std::function<void __cdecl(class Qt3DRender::QSceneImporter *)> &) Found no suitable importer plugin for QUrl("file:///")
    Qt3D.Renderer.Jobs: class Qt3DRender::QGeometry *__cdecl Qt3DRender::MeshLoaderFunctor::operator ()(void) Mesh is empty, nothing to load
    
    

    Interestingly, when I replace the Mesh component with SceneLoader and use the same file, the mesh loads successfully. I'm using the following code:

    import Qt3D.Core 2.15
    import Qt3D.Extras 2.0
    import Qt3D.Input 2.0
    import Qt3D.Render 2.15
    import QtQml.Models 2.15
    import QtQuick 2.5
    import QtQuick.Controls 2.15
    import QtQuick.Layouts 1.3
    import QtQuick.Scene3D 2.0
    import QtQuick.Window 2.11
    import QtQuick.Dialogs 1.3
    import PreemieScanner.Measurement 1.0
    import MeshviewerTrackball 1.0
    
    Item {
        width: 640
        height: 480
    
        ColumnLayout {
            anchors.fill: parent
    
            ToolBar {
                RowLayout {
                    ToolButton {
                        id: exitBtn
                        text: "Exit"
                        onClicked: Qt.quit()
                    }
    
                    ToolButton {
                        id: loadModelBtn
                        text: "Load Model"
                        onClicked: fileDialog.open()
                    }
                }
            }
    
            FileDialog {
                id: fileDialog
                onAccepted: mesh.source = fileDialog.fileUrl
            }
    
            Scene3D {
                Layout.fillWidth: true
                Layout.fillHeight: true
                aspects: ["input", "logic"]
                cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
    
                Entity {
                    id: sceneRoot
    
                    Camera {
                        id: camera
                        projectionType: CameraLens.PerspectiveProjection
                        fieldOfView: 30
                        aspectRatio: 16/9
                        nearPlane: 0.1
                        farPlane: 1000.0
                        position: Qt.vector3d(20.0, 0.0, 0.0)
                        upVector: Qt.vector3d(0.0, 1.0, 0.0)
                        viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
                    }
    
                    OrbitCameraController {
                        camera: camera
                    }
    
                    components: [
                        RenderSettings {
                            activeFrameGraph: ForwardRenderer {
                        clearColor: "transparent"
                                camera: camera
                            }
                        },
                        InputSettings {}
                    ]
    
                    Entity {
                        components: [
                            Mesh{
                                id: mesh
                            },
                            Material {
                                id: material
                                parameters: [
                                    Parameter { name: "color"; value: "green" }
                                ]
                            }
                        ]
                    }
                }
            }
        }
    }
    

    Is there anything specific I need to configure when using the Mesh component, or could this be a bug in Qt 5.15.2 and should I just update?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved