From 951375611e3ed4f3aa5f55c79067ee904b35c28f Mon Sep 17 00:00:00 2001
From: Peter Kaiser <peter.kaiser@kit.edu>
Date: Fri, 10 Jun 2016 14:40:31 +0200
Subject: [PATCH] DebugDrawer: Fixed layer-based deselectAll

---
 .../components/DebugDrawer/DebugDrawerComponent.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp
index f41d962b9..cdc6c7222 100644
--- a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp
+++ b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp
@@ -148,7 +148,18 @@ namespace armarx
         }
         else if (layers.find(layerName) != layers.end())
         {
-            selectionNode->deselect(layers.at(layerName).mainNode);
+            for (int i = 0; i < selectionNode->getNumSelected(); i++)
+            {
+                SoPath* path = selectionNode->getPath(i);
+                if (path->containsNode(layers.at(layerName).mainNode))
+                {
+                    selectionNode->deselect(path);
+                }
+            }
+        }
+        else
+        {
+            ARMARX_WARNING << "Could not find layer '" << layerName << "' to clear";
         }
     }
 
-- 
GitLab