diff options
author | Janne Kangas <janne.kangas@qt.io> | 2019-08-21 13:02:14 +0300 |
---|---|---|
committer | Janne Kangas <janne.kangas@qt.io> | 2019-10-15 07:03:01 +0300 |
commit | 4a32c1e5a56dd7cfb193cf63870b4c57b8e635df (patch) | |
tree | f35af550f4c7097e5d9c7ec4514d7311ddb7d2ff | |
parent | bcc438c1b268678c93f8fb6a1eea6392709677fe (diff) |
Create a completely new instance when material type changes
Do not reuse instance id when changing shader (and triggering
SetMaterialType). This avoids stale property handle references to
properties whose name matches with names of previous material instance
props.
Change-Id: I0df750ddd84881297921266901b49c6dc59ff92b
Task-id: QT3DS-3978
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp index 218cdcd7..f5dbe2f7 100644 --- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp +++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp @@ -1894,8 +1894,11 @@ public: theSlide, instance); } else { CFilePath thePath = m_Doc.GetResolvedPathToDoc(inRelativePathToMaterialFile); + // Reusing the instance handle for new material seems to cause issues with stale + // property handles being used, if custom property names match with the names of + // previous material properties. So we create an entirely new instance. newMaterial = LoadCustomMaterial(thePath, model, theSlide, - DocumentEditorInsertType::LastChild, 0, instance); + DocumentEditorInsertType::LastChild, 0); } if (newMaterial.Valid() && nextChild.Valid()) |