From a9215a64a39f9f0f29f39e76427d4a2ae6c90a8a Mon Sep 17 00:00:00 2001 From: Jere Tuliniemi Date: Wed, 5 Dec 2018 12:12:22 +0200 Subject: 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 --- src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp | 6 +++++- src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h | 3 ++- 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 m_materials; std::vector m_matDatas; std::vector m_cachedMatDatas; + qt3dsdm::Qt3DSDMInstanceHandle m_refMaterial; Q3DStudio::CUpdateableDocumentEditor m_UpdatableEditor; @@ -233,7 +234,7 @@ private: int groupIndex); QVector computeTree(CInspectableBase *inspectBase); - bool isTreeRebuildRequired(CInspectableBase *inspectBase) const; + bool isTreeRebuildRequired(CInspectableBase *inspectBase); GroupInspectorControl computeGroup(CInspectableBase* inspectBase, int theIndex, bool disableAnimation = false, -- cgit v1.2.3