forked from qt-creator/qt-creator
QmlDesigner: Adjust imported 3D assets path
Path changed from GeneratedComponents/QtQuick3DComponents to GeneratedComponents/QtQuick3D to avoid repeating Components unnecessarily. Fixes: QDS-12502 Change-Id: Ife81acddcd5ade7a23d2388b55416e2688a6828a Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -105,8 +105,8 @@ bool selectionIsImported3DAsset(const SelectionContext &selectionState)
|
||||
// Node is not a file component, so we have to check if the current doc itself is
|
||||
fileName = node.model()->fileUrl().toLocalFile();
|
||||
}
|
||||
if (fileName.contains(Constants::OLD_QUICK_3D_ASSETS_FOLDER)
|
||||
|| fileName.contains(Constants::QUICK_3D_COMPONENTS_FOLDER)) {
|
||||
if (QmlDesignerPlugin::instance()->documentManager()
|
||||
.generatedComponentUtils().isImport3dPath(fileName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -80,7 +80,8 @@ Utils::FilePath GeneratedComponentUtils::import3dBasePath() const
|
||||
bool GeneratedComponentUtils::isImport3dPath(const QString &path) const
|
||||
{
|
||||
return path.contains('/' + QLatin1String(Constants::OLD_QUICK_3D_ASSETS_FOLDER))
|
||||
|| path.contains('/' + QLatin1String(Constants::QUICK_3D_COMPONENTS_FOLDER));
|
||||
|| path.contains(QLatin1String(Constants::GENERATED_COMPONENTS_FOLDER) + '/'
|
||||
+ QLatin1String(Constants::QUICK_3D_COMPONENTS_FOLDER));
|
||||
}
|
||||
|
||||
bool GeneratedComponentUtils::isComposedEffectPath(const QString &path) const
|
||||
@@ -108,14 +109,11 @@ QString GeneratedComponentUtils::import3dTypePrefix() const
|
||||
return Constants::OLD_QUICK_3D_ASSETS_FOLDER;
|
||||
}
|
||||
|
||||
QString GeneratedComponentUtils::import3dSimplifiedTypePrefix() const
|
||||
QString GeneratedComponentUtils::import3dTypePath() const
|
||||
{
|
||||
QString basePrefix = generatedComponentTypePrefix();
|
||||
|
||||
if (basePrefix.endsWith(Constants::QUICK_3D_COMPONENTS_FOLDER))
|
||||
return Constants::QUICK_3D_COMPONENTS_FOLDER;
|
||||
|
||||
return Constants::OLD_QUICK_3D_ASSETS_FOLDER;
|
||||
QString prefix = import3dTypePrefix();
|
||||
prefix.replace('.', '/');
|
||||
return prefix;
|
||||
}
|
||||
|
||||
QString GeneratedComponentUtils::componentBundlesTypePrefix() const
|
||||
|
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
QString generatedComponentTypePrefix() const;
|
||||
QString import3dTypePrefix() const;
|
||||
QString import3dSimplifiedTypePrefix() const;
|
||||
QString import3dTypePath() const;
|
||||
QString componentBundlesTypePrefix() const;
|
||||
QString composedEffectsTypePrefix() const;
|
||||
|
||||
|
@@ -461,8 +461,7 @@ QStringList SubComponentManager::quick3DAssetPaths() const
|
||||
const auto impPaths = importPaths();
|
||||
QStringList retPaths;
|
||||
for (const auto &impPath : impPaths) {
|
||||
QString path3d = m_componentUtils.import3dTypePrefix();
|
||||
path3d.replace('.', '/');
|
||||
QString path3d = m_componentUtils.import3dTypePath();
|
||||
const QString assetPath = impPath + '/' + path3d;
|
||||
if (QFileInfo::exists(assetPath))
|
||||
retPaths << assetPath;
|
||||
@@ -523,7 +522,7 @@ void SubComponentManager::update(const QUrl &filePath, const Imports &imports)
|
||||
|
||||
// Remove old watched asset paths
|
||||
const QStringList watchPaths = m_watcher.directories();
|
||||
const QString &quick3DAssetFolder = m_componentUtils.import3dSimplifiedTypePrefix();
|
||||
const QString &quick3DAssetFolder = m_componentUtils.import3dTypePath();
|
||||
for (const auto &watchPath : watchPaths) {
|
||||
if (watchPath.endsWith(quick3DAssetFolder))
|
||||
m_watcher.removePath(watchPath);
|
||||
|
@@ -82,7 +82,7 @@ inline constexpr char COMPONENT_BUNDLES_TYPE[] = "ComponentBundles";
|
||||
inline constexpr char GENERATED_COMPONENTS_FOLDER[] = "GeneratedComponents";
|
||||
inline constexpr char COMPONENT_BUNDLES_ASSET_REF_FILE[] = "_asset_ref.json";
|
||||
inline constexpr char OLD_QUICK_3D_ASSETS_FOLDER[] = "Quick3DAssets";
|
||||
inline constexpr char QUICK_3D_COMPONENTS_FOLDER[] = "QtQuick3DComponents";
|
||||
inline constexpr char QUICK_3D_COMPONENTS_FOLDER[] = "QtQuick3D";
|
||||
inline constexpr char QUICK_3D_ASSET_LIBRARY_ICON_SUFFIX[] = "_libicon";
|
||||
inline constexpr char QUICK_3D_ASSET_IMPORT_DATA_NAME[] = "_importdata.json";
|
||||
inline constexpr char QUICK_3D_ASSET_IMPORT_DATA_OPTIONS_KEY[] = "import_options";
|
||||
|
Reference in New Issue
Block a user