Revert "fix invert selection logic", as that fix made other cases worse

This reverts commit 4cd61dfa7d.
This commit is contained in:
Rudolf Polzer 2011-08-19 15:53:30 +02:00
parent db1787bbfa
commit b25aa8735d

View File

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