summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJere Tuliniemi <jere.tuliniemi@qt.io>2018-12-05 12:12:22 +0200
committerJere Tuliniemi <jere.tuliniemi@qt.io>2018-12-05 14:30:37 +0000
commita9215a64a39f9f0f29f39e76427d4a2ae6c90a8a (patch)
treee15c4e0506b1b11ac71525a8dab0de4f54528d26
parent36d0744de6d1a966af1d4d2b170fb53599894420 (diff)
Refresh inspector when reference material changes
Undoing a basic material change would still show the same material even after the undo. Task-number: QT3DS-2821 Change-Id: I37710afa1acb8aefbf6e53e94f2c3bd16e6bf2c2 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp6
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
index 03d5c060..3ee2a01c 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
@@ -997,13 +997,17 @@ void InspectorControlModel::updateAnimateToggleState(InspectorControlBase* inIte
}
}
-bool InspectorControlModel::isTreeRebuildRequired(CInspectableBase* inspectBase) const
+bool InspectorControlModel::isTreeRebuildRequired(CInspectableBase* inspectBase)
{
if (inspectBase != m_inspectableBase || !inspectBase)
return true;
long theCount = m_inspectableBase->GetGroupCount();
auto refMaterial = getReferenceMaterial(inspectBase);
+ if (refMaterial != m_refMaterial) {
+ m_refMaterial = refMaterial;
+ return true;
+ }
long refMaterialGroupCount = 0;
if (refMaterial.Valid())
refMaterialGroupCount = 1; // Only the last group of the refMaterial is used
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
index 89b3e26a..a3140b3e 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
@@ -188,6 +188,7 @@ private:
std::vector<MaterialEntry> m_materials;
std::vector<MaterialDataEntry> m_matDatas;
std::vector<Q3DStudio::CFilePath> m_cachedMatDatas;
+ qt3dsdm::Qt3DSDMInstanceHandle m_refMaterial;
Q3DStudio::CUpdateableDocumentEditor m_UpdatableEditor;
@@ -233,7 +234,7 @@ private:
int groupIndex);
QVector<GroupInspectorControl> computeTree(CInspectableBase *inspectBase);
- bool isTreeRebuildRequired(CInspectableBase *inspectBase) const;
+ bool isTreeRebuildRequired(CInspectableBase *inspectBase);
GroupInspectorControl computeGroup(CInspectableBase* inspectBase,
int theIndex, bool disableAnimation = false,