summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes
diff options
context:
space:
mode:
authorTomi Korpipaa <tomi.korpipaa@qt.io>2018-08-13 09:29:44 +0300
committerTomi Korpipää <tomi.korpipaa@qt.io>2018-08-15 08:06:04 +0000
commit4814571049c060c5c80fe2f59fc8a5f8e13d4079 (patch)
treeea5da86587c85f550fc451d2f6eb054bc98517e3 /src/Authoring/Studio/Palettes
parentf4b0c64ff5a9583b7352f0a6aec84698856752de (diff)
Fix effect map path
Note: Runtime 2 will be fixed in a separate commit. Task-number: QT3DS-2027 Change-Id: I3248d2e5c90009d7945edd39e58944b80c3ffe93 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes')
-rw-r--r--src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp b/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp
index 62919aef..b0ab81f2 100644
--- a/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp
+++ b/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp
@@ -140,8 +140,9 @@ void ProjectFileSystemModel::updateReferences(bool emitDataChanged)
const auto fontFileList = bridge->GetFontFileList();
const auto effectTextureList = bridge->GetDynamicObjectTextureList();
- QString rootPath = QDir::cleanPath(doc->GetDocumentDirectory().toQString());
- auto addFileReferences = [this, doc, &rootPath](const Q3DStudio::CString &str) {
+ // Handle source and font references
+ QString uipPath = QDir::cleanPath(doc->GetDocumentDirectory().toQString());
+ auto addFileReferencesUip = [this, doc, &uipPath](const Q3DStudio::CString &str) {
auto path = doc->GetResolvedPathToDoc(str).toQString();
path = QDir::cleanPath(path);
m_references.append(path);
@@ -152,16 +153,29 @@ void ProjectFileSystemModel::updateReferences(bool emitDataChanged)
path = parentPath;
parentPath = QFileInfo(path).path();
- } while (rootPath != path && parentPath != path);
- };
- std::for_each(sourcePathList.begin(), sourcePathList.end(), addFileReferences);
- std::for_each(fontFileList.begin(), fontFileList.end(), addFileReferences);
- std::for_each(effectTextureList.begin(), effectTextureList.end(), addFileReferences);
+ } while (uipPath != path && parentPath != path);
+ };
+ std::for_each(sourcePathList.begin(), sourcePathList.end(), addFileReferencesUip);
+ std::for_each(fontFileList.begin(), fontFileList.end(), addFileReferencesUip);
+
+ // Handle effect texture references
+ QString projectPath = QDir::cleanPath(doc->GetCore()->getProjectFile().getProjectPath());
+ auto addFileReferencesUia = [this, doc, &projectPath](const Q3DStudio::CString &str) {
+ auto path = doc->GetCore()->getProjectFile().getResolvedPathTo(str.toQString());
+ m_references.append(path);
+ QString parentPath = QFileInfo(path).path();
+ do {
+ if (!m_references.contains(parentPath))
+ m_references.append(parentPath);
+
+ path = parentPath;
+ parentPath = QFileInfo(path).path();
+ } while (projectPath != path && parentPath != path);
+ };
+ std::for_each(effectTextureList.begin(), effectTextureList.end(), addFileReferencesUia);
// add currently open presentation references
- Q3DStudio::CString documentPath = g_StudioApp.GetCore()->GetDoc()->GetDocumentPath().GetPath();
- documentPath.Replace("\\", "/");
- QString path = documentPath.toQString();
+ QString path = QDir::cleanPath(doc->GetDocumentPath().GetPath().toQString());
QString parentPath = QFileInfo(path).path();
m_references.append(path);
do {
@@ -170,7 +184,7 @@ void ProjectFileSystemModel::updateReferences(bool emitDataChanged)
path = parentPath;
parentPath = QFileInfo(path).path();
- } while (rootPath != path && parentPath != path);
+ } while (uipPath != path && parentPath != path);
if (emitDataChanged) {
Q_EMIT dataChanged(index(0, 0), index(rowCount() - 1, 0), {IsReferencedRole,