diff --git a/ApplicationCode/ProjectDataModel/RimResultSlot.cpp b/ApplicationCode/ProjectDataModel/RimResultSlot.cpp index 6163f5b5e7..90a990291f 100644 --- a/ApplicationCode/ProjectDataModel/RimResultSlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimResultSlot.cpp @@ -66,11 +66,14 @@ RimResultSlot::~RimResultSlot() //-------------------------------------------------------------------------------------------------- void RimResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { - if (changedField == &m_resultVariable) + RimResultDefinition::fieldChangedByUi(changedField, oldValue, newValue); + + // Update of legend config must happen after RimResultDefinition::fieldChangedByUi(), as this function modifies this->resultVariable() + if (changedField == &m_resultVariableUiField) { if (oldValue != newValue) { - changeLegendConfig(this->resultVariable()); + changeLegendConfig(this->resultVariable()); } if (newValue != RimDefines::undefinedResultName()) @@ -79,8 +82,6 @@ void RimResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, co } } - RimResultDefinition::fieldChangedByUi(changedField, oldValue, newValue); - if (m_reservoirView) m_reservoirView->createDisplayModelAndRedraw(); } diff --git a/cafUserInterface/cafUiTreeModelPdm.cpp b/cafUserInterface/cafUiTreeModelPdm.cpp index 22d6205be4..8b6b193ed7 100644 --- a/cafUserInterface/cafUiTreeModelPdm.cpp +++ b/cafUserInterface/cafUiTreeModelPdm.cpp @@ -552,6 +552,14 @@ PdmUiTreeItem* UiTreeItemBuilderPdm::buildViewItems(PdmUiTreeItem* parentTreeIte { caf::PdmFieldHandle* field = *it; + // Fix for hidden legend definitions. There is only one visible legend definition, the others reside in a hidden container + // Todo: This is a Hack. Must be rewritten when a more general ui tree building method is in place. + // See comment at top of this method. + if (field->isUiHidden()) + { + continue; + } + std::vector children; field->childObjects(&children); size_t i;