From c366c04fccd9a46da2dc5becc0f37c607e4389fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Mon, 20 Nov 2017 14:50:13 +0100 Subject: [PATCH] #2058 Context command. Minor fix --- .../RicToggleItemsOnOthersOffFeature.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ApplicationCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp b/ApplicationCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp index 519e8fb321..f076ebc17a 100644 --- a/ApplicationCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp +++ b/ApplicationCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp @@ -55,18 +55,16 @@ void RicToggleItemsOnOthersOffFeature::onActionTriggered(bool isChecked) std::vector selectedObjects; caf::SelectionManager::instance()->objectsByType(&selectedObjects); + // First toggle off all siblings caf::PdmFieldHandle* commonParent = commonParentForAllSelections(selectedObjects); - if (commonParent) + for (caf::PdmObjectHandle* child : childObjects(commonParent)) { - for (caf::PdmObjectHandle* child : childObjects(commonParent)) - { - caf::PdmField* field = objectToggleField(child); + caf::PdmField* field = objectToggleField(child); - if (field) - { - field->setValueWithFieldChanged(false); - } + if (field) + { + field->setValueWithFieldChanged(false); } }