diff options
3 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp index 26747d359cd..dd032a6d1fa 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp @@ -40,7 +40,10 @@ ContentLibraryMaterialsModel::ContentLibraryMaterialsModel(ContentLibraryWidget qmlRegisterType<QmlDesigner::FileDownloader>("WebFetcher", 1, 0, "FileDownloader"); qmlRegisterType<QmlDesigner::MultiFileDownloader>("WebFetcher", 1, 0, "MultiFileDownloader"); +} +void ContentLibraryMaterialsModel::loadBundle() +{ QDir bundleDir{m_downloadPath}; if (fetchBundleMetadata(bundleDir) && fetchBundleIcons(bundleDir)) loadMaterialBundle(bundleDir); diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h index 21bd3741375..a2c2e90ce1e 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h @@ -51,6 +51,7 @@ public: void resetModel(); void updateIsEmpty(); + void loadBundle(); Internal::ContentLibraryBundleImporter *bundleImporter() const; diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp index 1e0b69099be..9cbc0f73393 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp @@ -290,7 +290,6 @@ void ContentLibraryView::modelAttached(Model *model) m_hasQuick3DImport = model->hasImport("QtQuick3D"); updateBundlesQuick3DVersion(); - updateBundleMaterialsImportedState(); const bool hasLibrary = Utils3D::materialLibraryNode(this).isValid(); m_widget->setHasMaterialLibrary(hasLibrary); @@ -302,11 +301,16 @@ void ContentLibraryView::modelAttached(Model *model) m_widget->setHasActive3DScene(m_sceneId != -1); m_widget->clearSearchFilter(); + // bundles loading has to happen here, otherwise project path is not ready which will + // cause bundle items types to resolve incorrectly + m_widget->materialsModel()->loadBundle(); m_widget->effectsModel()->loadBundle(); - updateBundleEffectsImportedState(); - m_widget->userModel()->loadMaterialBundle(); m_widget->userModel()->loadTextureBundle(); + + updateBundleMaterialsImportedState(); + updateBundleEffectsImportedState(); + updateBundleUserMaterialsImportedState(); } void ContentLibraryView::modelAboutToBeDetached(Model *model) |