]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Revert "fix invert selection logic", as that fix made other cases worse xonotic-v0.5.0
authorRudolf Polzer <divVerent@xonotic.org>
Fri, 19 Aug 2011 13:53:30 +0000 (15:53 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Fri, 19 Aug 2011 13:53:30 +0000 (15:53 +0200)
This reverts commit 4cd61dfa7d9363082c8161823634f497b82d8f98.

radiant/select.cpp

index f4e8b7f9d6f0af3bcda2389513448424448eea6a..c232da200caa8faff9a710e274ac8785580cf77b 100644 (file)
@@ -290,16 +290,13 @@ void Select_Delete (void)
 class InvertSelectionWalker : public scene::Graph::Walker
 {
   SelectionSystem::EMode m_mode;
+  mutable Selectable* m_selectable;
 public:
   InvertSelectionWalker(SelectionSystem::EMode mode)
-    : m_mode(mode)
+    : m_mode(mode), m_selectable(0)
   {
   }
   bool pre(const scene::Path& path, scene::Instance& instance) const
-  {
-    return true;
-  }
-  void post(const scene::Path& path, scene::Instance& instance) const
   {
     Selectable* selectable = Instance_getSelectable(instance);
     if(selectable)
@@ -308,17 +305,26 @@ public:
       {
       case SelectionSystem::eEntity:
         if(Node_isEntity(path.top()) != 0)
-          if(path.top().get().visible())
-            selectable->setSelected(!selectable->isSelected());
+        {
+          m_selectable = path.top().get().visible() ? selectable : 0;
+        }
         break;
       case SelectionSystem::ePrimitive:
-        if(path.top().get().visible())
-          selectable->setSelected(!selectable->isSelected());
+        m_selectable = path.top().get().visible() ? selectable : 0;
         break;
       case SelectionSystem::eComponent:
         break;
       }
     }
+    return true;
+  }
+  void post(const scene::Path& path, scene::Instance& instance) const
+  {
+    if(m_selectable != 0)
+    {
+      m_selectable->setSelected(!m_selectable->isSelected());
+      m_selectable = 0;
+    }
   }
 };