diff --git a/radiant/csg.cpp b/radiant/csg.cpp index c797b3d0..929cd4db 100644 --- a/radiant/csg.cpp +++ b/radiant/csg.cpp @@ -379,7 +379,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { if ( path.top().get().visible() ) { Brush* brush = Node_getBrush( path.top() ); if ( brush != 0 - && Instance_getSelectable( instance )->isSelected() ) { + && Instance_isSelected( instance ) ) { m_brushlist.push_back( brush ); } } @@ -397,7 +397,7 @@ void post( const scene::Path& path, scene::Instance& instance ) const { if ( path.top().get().visible() ) { Brush* brush = Node_getBrush( path.top() ); if ( brush != 0 - && Instance_getSelectable( instance )->isSelected() + && Instance_isSelected( instance ) && path.size() > 1 ) { Path_deleteTop( path ); } @@ -424,7 +424,7 @@ void post( const scene::Path& path, scene::Instance& instance ) const { if ( path.top().get().visible() ) { Brush* brush = Node_getBrush( path.top() ); if ( brush != 0 - && Instance_getSelectable( instance )->isSelected() + && Instance_isSelected( instance ) && path.size() > 1 && path.top().get_pointer() != m_keepNode ) { scene::Node& parent = path.parent(); @@ -622,7 +622,7 @@ void post( const scene::Path& path, scene::Instance& instance ) const { if ( path.top().get().visible() ) { Brush* brush = Node_getBrush( path.top() ); if ( brush != 0 - && !Instance_getSelectable( instance )->isSelected() ) { + && !Instance_isSelected( instance ) ) { brush_vector_t buffer[2]; bool swap = false; Brush* original = new Brush( *brush ); @@ -734,7 +734,7 @@ void post( const scene::Path& path, scene::Instance& instance ) const { if ( path.top().get().visible() ) { Brush* brush = Node_getBrush( path.top() ); if ( brush != 0 - && Instance_getSelectable( instance )->isSelected() ) { + && Instance_isSelected( instance ) ) { const brushsplit_t split = Brush_classifyPlane( *brush, m_plane ); if ( split.counts[ePlaneBack] && split.counts[ePlaneFront] ) { // the plane intersects this brush diff --git a/radiant/entity.cpp b/radiant/entity.cpp index b0b17a8d..bb15d9e8 100644 --- a/radiant/entity.cpp +++ b/radiant/entity.cpp @@ -75,7 +75,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { void post( const scene::Path& path, scene::Instance& instance ) const { Entity* entity = Node_getEntity( path.top() ); if ( entity != 0 - && ( instance.childSelected() || Instance_getSelectable( instance )->isSelected() ) ) { + && ( instance.childSelected() || Instance_isSelected( instance ) ) ) { entity->setKeyValue( m_key, m_value ); } } @@ -95,7 +95,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { } void post( const scene::Path& path, scene::Instance& instance ) const { Entity* entity = Node_getEntity( path.top() ); - if ( entity != 0 && ( instance.childSelected() || Instance_getSelectable( instance )->isSelected() ) ) { + if ( entity != 0 && ( instance.childSelected() || Instance_isSelected( instance ) ) ) { if( path.top().get_pointer() == m_world ){ /* do not want to convert whole worldspawn entity */ if( instance.childSelected() && !m_2world ){ /* create an entity from world brushes instead */ EntityClass* entityClass = GlobalEntityClassManager().findOrInsert( m_classname, true ); @@ -230,7 +230,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { void post( const scene::Path& path, scene::Instance& instance ) const { Entity* entity = Node_getEntity( path.top() ); if ( entity != 0 - && Instance_getSelectable( instance )->isSelected() + && Instance_isSelected( instance ) && node_is_group( path.top() ) && !groupPath ) { groupPath = &path; @@ -251,8 +251,7 @@ 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 && selectable->isSelected() ) { + if ( Instance_isSelected( instance ) ) { Entity* entity = Node_getEntity( path.top() ); if ( entity == 0 && Node_isPrimitive( path.top() ) ) { NodeSmartReference child( path.top().get() ); diff --git a/radiant/entitylist.cpp b/radiant/entitylist.cpp index bbb45095..5c02d6e1 100644 --- a/radiant/entitylist.cpp +++ b/radiant/entitylist.cpp @@ -340,22 +340,19 @@ gboolean searchEntryScroll( GtkWidget* widget, GdkEventScroll* event, gpointer u if( node ){ scene::Instance* instance; gtk_tree_model_get_pointer( model, &iter, 1, &instance ); - Selectable* selectable = Instance_getSelectable( *instance ); - if( selectable ){ - if( selectable->isSelected() || instance->childSelected() ){ - if( iter_first.stamp == 0 ){ - iter_first = iter; - } - if( iter_found.stamp != 0 ){ - iter_next = iter; - break; - } - if( node == getEntityList().m_search_focus_node ){ - iter_found = iter; - } - else{ - iter_prev = iter; - } + if( Instance_isSelected( *instance ) || instance->childSelected() ){ + if( iter_first.stamp == 0 ){ + iter_first = iter; + } + if( iter_found.stamp != 0 ){ + iter_next = iter; + break; + } + if( node == getEntityList().m_search_focus_node ){ + iter_found = iter; + } + else{ + iter_prev = iter; } } } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 368681d8..7d471d93 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -1246,9 +1246,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { } if ( !path.top().get().isRoot() ) { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 - && selectable->isSelected() ) { + if ( Instance_isSelected( instance ) ) { return false; } if( m_makeUnique && instance.childSelected() ){ /* clone group entity primitives to new group entity */ @@ -1271,9 +1269,7 @@ void post( const scene::Path& path, scene::Instance& instance ) const { } if ( !path.top().get().isRoot() ) { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 - && selectable->isSelected() ) { + if ( Instance_isSelected( instance ) ) { NodeSmartReference clone( Node_Clone( path.top() ) ); Map_gatherNamespaced( clone ); Node_getTraversable( path.parent().get() )->insert( clone ); @@ -1748,7 +1744,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { if ( path.top().get().visible() ) { Snappable* snappable = Node_getSnappable( path.top() ); if ( snappable != 0 - && Instance_getSelectable( instance )->isSelected() ) { + && Instance_isSelected( instance ) ) { snappable->snapto( m_snap ); } } @@ -1771,7 +1767,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { if ( path.top().get().visible() ) { ComponentSnappable* componentSnappable = Instance_getComponentSnappable( instance ); if ( componentSnappable != 0 - && Instance_getSelectable( instance )->isSelected() ) { + && Instance_isSelected( instance ) ) { componentSnappable->snapComponents( m_snap ); } } diff --git a/radiant/map.cpp b/radiant/map.cpp index f679ab18..5558bc6d 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -1219,9 +1219,7 @@ AnyInstanceSelected( bool& selected ) : m_selected( selected ){ m_selected = false; } void visit( scene::Instance& instance ) const { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 - && selectable->isSelected() ) { + if ( Instance_isSelected( instance ) ) { m_selected = true; } } @@ -1819,8 +1817,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { } void post( const scene::Path& path, scene::Instance& instance ) const { if ( Node_isPrimitive( path.top() ) ){ - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable && selectable->isSelected() ){ + if ( Instance_isSelected( instance ) ){ NodeSmartReference node( path.top().get() ); scene::Traversable* parent_traversable = Node_getTraversable( path.parent() ); parent_traversable->erase( node ); @@ -1856,9 +1853,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { if ( ++m_depth != 1 && path.top().get().isRoot() ) { return false; } - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 - && selectable->isSelected() + if ( Instance_isSelected( instance ) && Node_isPrimitive( path.top() ) ) { ++m_count; } diff --git a/radiant/patch.h b/radiant/patch.h index aae960cb..d1622cda 100644 --- a/radiant/patch.h +++ b/radiant/patch.h @@ -1881,7 +1881,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { if ( path.top().get().visible() ) { Patch* patch = Node_getPatch( path.top() ); if ( patch != 0 - && Instance_getSelectable( instance )->isSelected() ) { + && Instance_isSelected( instance ) ) { m_functor( *patch ); } } diff --git a/radiant/renderer.h b/radiant/renderer.h index eabafb72..f100fc4a 100644 --- a/radiant/renderer.h +++ b/radiant/renderer.h @@ -141,8 +141,7 @@ bool pre( const scene::Path& path, scene::Instance& instance, VolumeIntersection renderable->viewChanged(); } - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 && selectable->isSelected() ) { + if ( Instance_isSelected( instance ) ) { if ( GlobalSelectionSystem().Mode() != SelectionSystem::eComponent ) { m_renderer.Highlight( Renderer::eFace ); } diff --git a/radiant/select.cpp b/radiant/select.cpp index 19f7d61b..8863cbfc 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -80,9 +80,7 @@ void visit( scene::Instance& instance ) const { return; } - Selectable* selectable = Instance_getSelectable( instance ); - if ( ( selectable != 0 ) - && instance.isSelected() ) { + if ( Instance_isSelected( instance ) ) { // brushes only if ( Instance_getBrush( instance ) != 0 ) { m_bounds[m_count] = instance.worldAABB(); @@ -226,9 +224,7 @@ DeleteSelected() bool pre( const scene::Path& path, scene::Instance& instance ) const { m_removedChild = false; - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 - && selectable->isSelected() + if ( Instance_isSelected( instance ) && path.size() > 1 && !path.top().get().isRoot() ) { m_remove = true; @@ -782,8 +778,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { Entity* entity = Node_getEntity( path.top() ); if ( entity != 0 ){ if( path.top().get_pointer() != m_world ){ - Selectable* selectable = Instance_getSelectable( instance ); - if ( ( selectable != 0 && selectable->isSelected() ) || instance.childSelected() ) { + if ( Instance_isSelected( instance ) || instance.childSelected() ) { if ( !propertyvalues_contain( m_propertyvalues, entity->getKeyValue( m_prop ) ) ) { m_propertyvalues.push_back( entity->getKeyValue( m_prop ) ); } @@ -806,9 +801,7 @@ EntityGetSelectedPropertyValuesWalker( const char *prop, PropertyValues& propert : m_propertyvalues( propertyvalues ), m_prop( prop ), m_selected_children( false ), m_world( Map_FindWorldspawn( g_map ) ){ } bool pre( const scene::Path& path, scene::Instance& instance ) const { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 - && selectable->isSelected() ) { + if ( Instance_isSelected( instance ) ) { Entity* entity = Node_getEntity( path.top() ); if ( entity != 0 ) { if ( !propertyvalues_contain( m_propertyvalues, entity->getKeyValue( m_prop ) ) ) { @@ -931,9 +924,7 @@ HideSelectedWalker( bool hide ) : m_hide( hide ){ } bool pre( const scene::Path& path, scene::Instance& instance ) const { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 - && selectable->isSelected() ) { + if ( Instance_isSelected( instance ) ) { g_nodes_be_hidden = m_hide; hide_node( path.top(), m_hide ); } @@ -1491,8 +1482,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { Entity* entity = Node_getEntity( path.top() ); if ( entity != 0 ){ if( path.top().get_pointer() != m_world ){ - Selectable* selectable = Instance_getSelectable( instance ); - if ( ( selectable != 0 && selectable->isSelected() ) || instance.childSelected() ) { + if ( Instance_isSelected( instance ) || instance.childSelected() ) { const char* keyvalue = entity->getKeyValue( m_prop ); if ( !string_empty( keyvalue ) && !propertyvalues_contain( m_propertyvalues, keyvalue ) ) { m_propertyvalues.push_back( keyvalue ); diff --git a/radiant/selection.cpp b/radiant/selection.cpp index 9d87f1a4..d078a3f9 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -2678,13 +2678,10 @@ PlaneSelectableSelectPlanes( Selector& selector, SelectionTest& test, const Plan : m_selector( selector ), m_test( test ), m_selectedPlaneCallback( selectedPlaneCallback ){ } bool pre( const scene::Path& path, scene::Instance& instance ) const { - if ( path.top().get().visible() ) { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 && selectable->isSelected() ) { - PlaneSelectable* planeSelectable = Instance_getPlaneSelectable( instance ); - if ( planeSelectable != 0 ) { - planeSelectable->selectPlanes( m_selector, m_test, m_selectedPlaneCallback ); - } + if ( path.top().get().visible() && Instance_isSelected( instance ) ) { + PlaneSelectable* planeSelectable = Instance_getPlaneSelectable( instance ); + if ( planeSelectable != 0 ) { + planeSelectable->selectPlanes( m_selector, m_test, m_selectedPlaneCallback ); } } return true; @@ -2700,13 +2697,10 @@ PlaneSelectableSelectReversedPlanes( Selector& selector, const SelectedPlanes& s : m_selector( selector ), m_selectedPlanes( selectedPlanes ){ } bool pre( const scene::Path& path, scene::Instance& instance ) const { - if ( path.top().get().visible() ) { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 && selectable->isSelected() ) { - PlaneSelectable* planeSelectable = Instance_getPlaneSelectable( instance ); - if ( planeSelectable != 0 ) { - planeSelectable->selectReversedPlanes( m_selector, m_selectedPlanes ); - } + if ( path.top().get().visible() && Instance_isSelected( instance ) ) { + PlaneSelectable* planeSelectable = Instance_getPlaneSelectable( instance ); + if ( planeSelectable != 0 ) { + planeSelectable->selectReversedPlanes( m_selector, m_selectedPlanes ); } } return true; @@ -2809,13 +2803,10 @@ PlaneSelectable_bestPlaneDirect( SelectionTest& test, Plane3& plane ) : m_test( test ), m_plane( plane ), m_intersection(){ } bool pre( const scene::Path& path, scene::Instance& instance ) const { - if ( path.top().get().visible() ) { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 && selectable->isSelected() ) { - PlaneSelectable* planeSelectable = Instance_getPlaneSelectable( instance ); - if ( planeSelectable != 0 ) { - planeSelectable->bestPlaneDirect( m_test, m_plane, m_intersection ); - } + if ( path.top().get().visible() && Instance_isSelected( instance ) ) { + PlaneSelectable* planeSelectable = Instance_getPlaneSelectable( instance ); + if ( planeSelectable != 0 ) { + planeSelectable->bestPlaneDirect( m_test, m_plane, m_intersection ); } } return true; @@ -2832,13 +2823,10 @@ PlaneSelectable_bestPlaneIndirect( SelectionTest& test, Plane3& plane, Vector3& : m_test( test ), m_plane( plane ), m_intersection( intersection ), m_dist( FLT_MAX ){ } bool pre( const scene::Path& path, scene::Instance& instance ) const { - if ( path.top().get().visible() ) { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 && selectable->isSelected() ) { - PlaneSelectable* planeSelectable = Instance_getPlaneSelectable( instance ); - if ( planeSelectable != 0 ) { - planeSelectable->bestPlaneIndirect( m_test, m_plane, m_intersection, m_dist ); - } + if ( path.top().get().visible() && Instance_isSelected( instance ) ) { + PlaneSelectable* planeSelectable = Instance_getPlaneSelectable( instance ); + if ( planeSelectable != 0 ) { + planeSelectable->bestPlaneIndirect( m_test, m_plane, m_intersection, m_dist ); } } return true; @@ -2853,13 +2841,10 @@ PlaneSelectable_selectByPlane( const Plane3& plane ) : m_plane( plane ){ } bool pre( const scene::Path& path, scene::Instance& instance ) const { - if ( path.top().get().visible() ) { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 && selectable->isSelected() ) { - PlaneSelectable* planeSelectable = Instance_getPlaneSelectable( instance ); - if ( planeSelectable != 0 ) { - planeSelectable->selectByPlane( m_plane ); - } + if ( path.top().get().visible() && Instance_isSelected( instance ) ) { + PlaneSelectable* planeSelectable = Instance_getPlaneSelectable( instance ); + if ( planeSelectable != 0 ) { + planeSelectable->selectByPlane( m_plane ); } } return true; @@ -7386,8 +7371,7 @@ testselect_component_visible_selected( Selector& selector, SelectionTest& test, : m_selector( selector ), m_test( test ), m_mode( mode ){ } bool pre( const scene::Path& path, scene::Instance& instance ) const { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 && selectable->isSelected() ) { + if ( Instance_isSelected( instance ) ) { ComponentSelectionTestable* componentSelectionTestable = Instance_getComponentSelectionTestable( instance ); if ( componentSelectionTestable ) { componentSelectionTestable->testSelectComponents( m_selector, m_test, m_mode ); @@ -7551,9 +7535,7 @@ bounds_selected( AABB& bounds ) m_bounds = AABB(); } bool pre( const scene::Path& path, scene::Instance& instance ) const { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 - && selectable->isSelected() ) { + if ( Instance_isSelected( instance ) ) { aabb_extend_by_aabb_safe( m_bounds, Instance_getPivotBounds( instance ) ); } return true; @@ -7569,9 +7551,7 @@ bounds_selected_component( AABB& bounds ) m_bounds = AABB(); } bool pre( const scene::Path& path, scene::Instance& instance ) const { - Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 - && selectable->isSelected() ) { + if ( Instance_isSelected( instance ) ) { ComponentEditable* componentEditable = Instance_getComponentEditable( instance ); if ( componentEditable ) { aabb_extend_by_aabb_safe( m_bounds, aabb_for_oriented_aabb_safe( componentEditable->getSelectedComponentsBounds(), instance.localToWorld() ) );