diff --git a/libs/dragplanes.h b/libs/dragplanes.h index 312c83f9..bc7e54ff 100644 --- a/libs/dragplanes.h +++ b/libs/dragplanes.h @@ -153,6 +153,8 @@ void selectPlanes( const AABB& aabb, Selector& selector, SelectionTest& test, co } } } + if( test.getVolume().GetViewMatrix().xw() != 0 || test.getVolume().GetViewMatrix().yw() != 0 ) // select only plane in camera + selectable2 = 0; for ( std::size_t i = 0; i < 6; ++i ) if( &m_selectables[i] == selectable || &m_selectables[i] == selectable2 ){ Selector_add( selector, m_selectables[i] ); diff --git a/radiant/brush.h b/radiant/brush.h index dbb90b60..be0a0847 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -3580,9 +3580,12 @@ void selectPlanes( Selector& selector, SelectionTest& test, const PlaneCallback& FaceInstances_ptrs bestInstances; selectPlanes( test, bestInstances ); + const bool cam = test.getVolume().GetViewMatrix().xw() != 0 || test.getVolume().GetViewMatrix().yw() != 0; for ( FaceInstances_ptrs::iterator i = bestInstances.begin(); i != bestInstances.end(); ++i ){ ( *i )->addSelectable( selector ); selectedPlaneCallback( ( *i )->getFace().plane3() ); + if( cam ) + return; // select only plane in camera } } void selectReversedPlanes( Selector& selector, const SelectedPlanes& selectedPlanes ){ @@ -3597,9 +3600,11 @@ void selectVerticesOnPlanes( SelectionTest& test ){ FaceInstances_ptrs bestInstances; selectPlanes( test, bestInstances ); - for ( VertexInstances::iterator i = m_vertexInstances.begin(); i != m_vertexInstances.end(); ++i ){ + if( ( test.getVolume().GetViewMatrix().xw() != 0 || test.getVolume().GetViewMatrix().yw() != 0 ) && !bestInstances.empty() ) // select only plane in camera + for( FaceInstances_ptrs::iterator i = bestInstances.end() - 1; i != bestInstances.begin(); --i ) + bestInstances.pop_back(); + for ( VertexInstances::iterator i = m_vertexInstances.begin(); i != m_vertexInstances.end(); ++i ) ( *i ).selectVerticesOnFaces( bestInstances ); - } } void selectVerticesOnTestedFaces( SelectionTest& test ){ diff --git a/radiant/selection.cpp b/radiant/selection.cpp index 3fe9ddfb..690a32e3 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -2372,6 +2372,8 @@ public: } } } + if( view.GetViewMatrix().xw() != 0 || view.GetViewMatrix().yw() != 0 ) // select only plane in camera + selectable2 = 0; if( selectable ){ Vector3 origin = m_bounds.origin; for ( int i = 0; i < 3; ++i )