From 3ec33465b13ce35100e1557b499ffc335cd6e22c Mon Sep 17 00:00:00 2001 From: Garux Date: Wed, 2 Aug 2017 08:43:59 +0300 Subject: [PATCH] Radiant: misc... * fix: deselecting particular primitives, invert selection work for expanded group entity selection (these are deselecting parent node) * do not render entities selection in components mode; fixes 'invisible components for expanded group entity selection' --- libs/scenelib.h | 4 ++++ radiant/brush.h | 5 +++++ radiant/patch.h | 5 +++++ radiant/renderer.h | 5 ++++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/libs/scenelib.h b/libs/scenelib.h index 08566259..0785baec 100644 --- a/libs/scenelib.h +++ b/libs/scenelib.h @@ -739,6 +739,10 @@ bool parentSelected() const { } return m_parentSelected; } +Instance* parent() const +{ + return m_parent; +} }; } diff --git a/radiant/brush.h b/radiant/brush.h index 0fb6ffe2..93b3f636 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -3197,6 +3197,11 @@ bool isSelected() const { } void setSelected( bool select ){ m_selectable.setSelected( select ); + if ( !select && parent() ){ + Selectable* sel_parent = Instance_getSelectable( *parent() ); + if ( sel_parent && sel_parent->isSelected() ) + sel_parent->setSelected( false ); + } } void update_selected() const { diff --git a/radiant/patch.h b/radiant/patch.h index b1a897be..66f53ef8 100644 --- a/radiant/patch.h +++ b/radiant/patch.h @@ -1422,6 +1422,11 @@ void allocate( std::size_t size ){ void setSelected( bool select ){ m_selectable.setSelected( select ); + if ( !select && parent() ){ + Selectable* sel_parent = Instance_getSelectable( *parent() ); + if ( sel_parent && sel_parent->isSelected() ) + sel_parent->setSelected( false ); + } } bool isSelected() const { return m_selectable.isSelected(); diff --git a/radiant/renderer.h b/radiant/renderer.h index 62674d46..eabafb72 100644 --- a/radiant/renderer.h +++ b/radiant/renderer.h @@ -149,7 +149,10 @@ bool pre( const scene::Path& path, scene::Instance& instance, VolumeIntersection else if ( renderable ) { renderable->renderComponents( m_renderer, m_volume ); } - m_renderer.Highlight( Renderer::ePrimitive ); + //if( !(GlobalSelectionSystem().Mode() == SelectionSystem::eComponent && path.size() == 2) ) + //if( !( GlobalSelectionSystem().Mode() == SelectionSystem::eComponent && node_is_group( path.top() ) ) ) + if( !( GlobalSelectionSystem().Mode() == SelectionSystem::eComponent && Node_isEntity( path.top() ) ) ) + m_renderer.Highlight( Renderer::ePrimitive ); } if ( renderable ) { -- 2.39.2