X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fselect.cpp;h=bca6f2ccddb7f249e7538212b8bb050f812ef99c;hb=667d3275589dac91b5bfe96f0244183007be6efd;hp=8e749542975c5d62dcab68f6f6784ab4a4dcc0cb;hpb=6a7a6b309311c16138981200f4539770755c243a;p=xonotic%2Fnetradiant.git diff --git a/radiant/select.cpp b/radiant/select.cpp index 8e749542..bca6f2cc 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -41,6 +41,7 @@ #include "gtkutil/widget.h" #include "brushmanip.h" #include "brush.h" +#include "patch.h" #include "patchmanip.h" #include "patchdialog.h" #include "selection.h" @@ -277,10 +278,11 @@ void Select_Delete( void ){ class InvertSelectionWalker : public scene::Graph::Walker { SelectionSystem::EMode m_mode; +SelectionSystem::EComponentMode m_compmode; mutable Selectable* m_selectable; public: -InvertSelectionWalker( SelectionSystem::EMode mode ) - : m_mode( mode ), m_selectable( 0 ){ +InvertSelectionWalker( SelectionSystem::EMode mode, SelectionSystem::EComponentMode compmode ) + : m_mode( mode ), m_compmode( compmode ), m_selectable( 0 ){ } bool pre( const scene::Path& path, scene::Instance& instance ) const { if( !path.top().get().visible() ){ @@ -300,6 +302,18 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { m_selectable = path.top().get().visible() ? selectable : 0; break; case SelectionSystem::eComponent: + BrushInstance* brushinstance = Instance_getBrush( instance ); + if( brushinstance != 0 ){ + if( brushinstance->isSelected() ) + brushinstance->invertComponentSelection( m_compmode ); + } + else{ + PatchInstance* patchinstance = Instance_getPatch( instance ); + if( patchinstance != 0 && m_compmode == SelectionSystem::eVertex ){ + if( patchinstance->isSelected() ) + patchinstance->invertComponentSelection(); + } + } break; } } @@ -314,7 +328,7 @@ void post( const scene::Path& path, scene::Instance& instance ) const { }; void Scene_Invert_Selection( scene::Graph& graph ){ - graph.traverse( InvertSelectionWalker( GlobalSelectionSystem().Mode() ) ); + graph.traverse( InvertSelectionWalker( GlobalSelectionSystem().Mode(), GlobalSelectionSystem().ComponentMode() ) ); } void Select_Invert(){