summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2019-06-27 13:13:42 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2019-06-28 16:48:17 +0300
commit50a696826e2e1295f0cbb8c516146f781b463b59 (patch)
tree9745f078ccba275c5d2e775313e36eb7b8a0c4ff
parent86f94b5c836244e1c0c74f34c92efd28fba9f03f (diff)
Make changes to basic material images visible in editor immediately
Task-number: QT3DS-2935 Change-Id: Ic8e10962880646fe544e993501077f4367694c41 Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
-rw-r--r--src/Authoring/Client/Code/Core/Doc/DocumentBufferCache.cpp9
-rw-r--r--src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp31
-rw-r--r--src/Authoring/Client/Code/Core/Doc/IDocumentBufferCache.h2
3 files changed, 31 insertions, 11 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentBufferCache.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentBufferCache.cpp
index 1ff4bd5a..a22a1376 100644
--- a/src/Authoring/Client/Code/Core/Doc/DocumentBufferCache.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/DocumentBufferCache.cpp
@@ -135,6 +135,15 @@ struct SDocBufferCache : public IDocumentBufferCache
}
}
+ void reloadImageSet(const QSet<QString> &imageSet) override
+ {
+ auto bufMan = GetBufferManager();
+ if (bufMan) {
+ bufMan->unloadSet(imageSet);
+ bufMan->loadSet(imageSet);
+ }
+ }
+
// Names are declared in the same order as the primitives
// offset by the empty primitive
const wchar_t **GetPrimitiveNames() override
diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
index bc405586..a5d846a7 100644
--- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
@@ -434,7 +434,7 @@ public:
for (size_t idx = 0, end = existing.size(); idx < end; ++idx) {
Qt3DSDMInstanceHandle theAsset(existing[idx]);
- if (checkMaterialContainers && m_Bridge.isInsideMaterialContainer(theAsset))
+ if (!checkMaterialContainers && m_Bridge.isInsideMaterialContainer(theAsset))
continue;
thePaths.clear();
@@ -468,7 +468,7 @@ public:
void GetImportPathToInstanceMap(TCharPtrToSlideInstanceMap &outInstanceMap) const override
{
SComposerObjectDefinitions &theDefinitions(m_Bridge.GetObjectDefinitions());
- GetPathToInstanceMap(outInstanceMap, theDefinitions.m_Asset.m_ImportFile, true, false);
+ GetPathToInstanceMap(outInstanceMap, theDefinitions.m_Asset.m_ImportFile, false, false);
}
bool CanPropertyBeLinked(TInstanceHandle inInstance, TPropertyHandle inProperty) const override
@@ -5219,17 +5219,18 @@ public:
TInstanceHandleList theParents;
SComposerObjectDefinitions &theDefinitions(m_Bridge.GetObjectDefinitions());
+ QSet<QString> imageLoadSet;
+
for (size_t fileIdx = 0, fileEnd = inList.size(); fileIdx < fileEnd; ++fileIdx) {
const SFileModificationRecord &theRecord(inList[fileIdx]);
- CString theExtension = theRecord.m_File.GetExtension();
- bool isImport = theExtension.Compare(L"import", CString::ENDOFSTRING, false);
+ QString theExtension = theRecord.m_File.GetExtension().toQString().toLower();
+ bool isImport = theExtension == QLatin1String("import");
CFilePath theRelativePath(m_Doc.GetRelativePathToDoc(theRecord.m_File));
const wchar_t *theString(
m_DataCore.GetStringTable().RegisterStr(theRelativePath.toCString()));
- if ((theExtension.CompareNoCase(L"ttf")
- || theExtension.CompareNoCase(L"otf")) // should use CDialogs::IsFontFileExtension
+ if (CDialogs::fontExtensions().contains(theExtension)
&& m_Doc.GetSceneGraph() && m_Doc.GetSceneGraph()->GetTextRenderer()) {
m_Doc.GetSceneGraph()->GetTextRenderer()->ReloadFonts();
CFilePath thePath = m_Doc.GetDocumentDirectory();
@@ -5286,7 +5287,7 @@ public:
if (theInsertResult.second == false)
theInsertResult.first->second = theDAERelativePath;
}
- } else if (theExtension.Compare(L"qml", CString::ENDOFSTRING, false)
+ } else if (CDialogs::behaviorExtensions().contains(theExtension)
&& theRecord.m_ModificationType != FileModificationType::Created
&& theInstances.empty() == false) {
// First, refresh the parent behavior.
@@ -5331,7 +5332,7 @@ public:
}
}
}
- } else if (theExtension.Compare(L"effect", CString::ENDOFSTRING, false)
+ } else if (CDialogs::effectExtensions().contains(theExtension)
&& theRecord.m_ModificationType != FileModificationType::Created
&& theInstances.empty() == false) {
CString theNameStr = GetName(theInstances[0].second);
@@ -5350,13 +5351,21 @@ public:
theDispatch.FireReloadEffectInstance(theInstances[i].second);
theDispatch.FireImmediateRefreshInstance(theInstances[i].second);
}
+ } else if (CDialogs::mapExtensions().contains(theExtension)
+ && theRecord.m_ModificationType != FileModificationType::Created
+ && theInstances.empty() == false) {
+ imageLoadSet.insert(theRecord.m_File.toQString());
}
// There used to be an extension here for meshes
// but that causes the product to delete materials in some cases which loses work.
- // so that experiment failed and we will just have to let the users manually updated
- // their
- // meshes through the dropdown if they need them updated.
+ // so that experiment failed and we will just have to let the users manually update
+ // their meshes through the dropdown if they need them updated.
}
+
+
+ if (!imageLoadSet.isEmpty())
+ m_Doc.GetBufferCache().reloadImageSet(imageLoadSet);
+
if (hasProgressFired)
theDispatch.FireOnProgressEnd();
if (requestRender && m_Doc.GetSceneGraph())
diff --git a/src/Authoring/Client/Code/Core/Doc/IDocumentBufferCache.h b/src/Authoring/Client/Code/Core/Doc/IDocumentBufferCache.h
index 674de9f4..54e320e9 100644
--- a/src/Authoring/Client/Code/Core/Doc/IDocumentBufferCache.h
+++ b/src/Authoring/Client/Code/Core/Doc/IDocumentBufferCache.h
@@ -96,6 +96,8 @@ public:
// Takes a *relative* path from the document
virtual void InvalidateBuffer(const CFilePath &inSourcePath) = 0;
+ virtual void reloadImageSet(const QSet<QString> &imageSet) = 0;
+
// Don't send events but just clear everything out. Used on document::close
virtual void Clear() = 0;