From: Rudolf Polzer Date: Thu, 30 Jun 2011 11:34:23 +0000 (+0200) Subject: fix invert selection logic X-Git-Tag: xonotic-v0.5.0~6 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=commitdiff_plain;h=4cd61dfa7d9363082c8161823634f497b82d8f98 fix invert selection logic --- diff --git a/radiant/select.cpp b/radiant/select.cpp index c232da20..f4e8b7f9 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -290,13 +290,16 @@ 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_selectable(0) + : m_mode(mode) { } 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) @@ -305,26 +308,17 @@ public: { case SelectionSystem::eEntity: if(Node_isEntity(path.top()) != 0) - { - m_selectable = path.top().get().visible() ? selectable : 0; - } + if(path.top().get().visible()) + selectable->setSelected(!selectable->isSelected()); break; case SelectionSystem::ePrimitive: - m_selectable = path.top().get().visible() ? selectable : 0; + if(path.top().get().visible()) + selectable->setSelected(!selectable->isSelected()); 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; - } } };