forked from qt-creator/qt-creator
QmlDesigner: Hide material bundle if QtQuick3D version too low
Most materials in the material bundle require at least QtQuick3D 6.3, so we hide the bundle materials from material browser when the detected module version is less than 6.3. Fixes: QDS-8100 Change-Id: I9f50b507c3c3c50f821fa6a902995b999da24464 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -94,7 +94,7 @@ QHash<int, QByteArray> MaterialBrowserBundleModel::roleNames() const
|
||||
|
||||
void MaterialBrowserBundleModel::loadMaterialBundle()
|
||||
{
|
||||
if (m_matBundleExists || m_probeMatBundleDir)
|
||||
if (m_matBundleLoaded || m_probeMatBundleDir)
|
||||
return;
|
||||
|
||||
QDir matBundleDir(qEnvironmentVariable("MATERIAL_BUNDLE_PATH"));
|
||||
@@ -130,7 +130,7 @@ void MaterialBrowserBundleModel::loadMaterialBundle()
|
||||
}
|
||||
}
|
||||
|
||||
m_matBundleExists = true;
|
||||
m_matBundleLoaded = true;
|
||||
|
||||
QString bundleId = m_matBundleObj.value("id").toString();
|
||||
|
||||
@@ -184,20 +184,6 @@ void MaterialBrowserBundleModel::loadMaterialBundle()
|
||||
});
|
||||
}
|
||||
|
||||
bool MaterialBrowserBundleModel::hasQuick3DImport() const
|
||||
{
|
||||
return m_hasQuick3DImport;
|
||||
}
|
||||
|
||||
void MaterialBrowserBundleModel::setHasQuick3DImport(bool b)
|
||||
{
|
||||
if (b == m_hasQuick3DImport)
|
||||
return;
|
||||
|
||||
m_hasQuick3DImport = b;
|
||||
emit hasQuick3DImportChanged();
|
||||
}
|
||||
|
||||
bool MaterialBrowserBundleModel::hasMaterialRoot() const
|
||||
{
|
||||
return m_hasMaterialRoot;
|
||||
@@ -212,6 +198,11 @@ void MaterialBrowserBundleModel::setHasMaterialRoot(bool b)
|
||||
emit hasMaterialRootChanged();
|
||||
}
|
||||
|
||||
bool MaterialBrowserBundleModel::matBundleExists() const
|
||||
{
|
||||
return m_matBundleLoaded && m_quick3dMajorVersion == 6 && m_quick3dMinorVersion >= 3;
|
||||
}
|
||||
|
||||
Internal::BundleImporter *MaterialBrowserBundleModel::bundleImporter() const
|
||||
{
|
||||
return m_importer;
|
||||
@@ -253,6 +244,17 @@ void MaterialBrowserBundleModel::updateImportedState(const QStringList &imported
|
||||
resetModel();
|
||||
}
|
||||
|
||||
void MaterialBrowserBundleModel::setQuick3DImportVersion(int major, int minor)
|
||||
{
|
||||
bool bundleExisted = matBundleExists();
|
||||
|
||||
m_quick3dMajorVersion = major;
|
||||
m_quick3dMinorVersion = minor;
|
||||
|
||||
if (bundleExisted != matBundleExists())
|
||||
emit matBundleExistsChanged();
|
||||
}
|
||||
|
||||
void MaterialBrowserBundleModel::resetModel()
|
||||
{
|
||||
beginResetModel();
|
||||
|
||||
Reference in New Issue
Block a user