* fix crashy assertions on vertices/edges selection (also = during vertex manipulations)

by removing not needed anymore update_move_planepts_vertex code
	* disable points snapping to .125 grid during edge manipulation (already disabled for vertex mode)
This commit is contained in:
Garux 2018-12-21 14:45:12 +03:00
parent 048b4a50f2
commit 2f867c99d9

View File

@ -72,6 +72,7 @@ const unsigned int BRUSH_DETAIL_MASK = ( 1 << BRUSH_DETAIL_FLAG );
#define BRUSH_CONNECTIVITY_DEBUG 0
#define BRUSH_DEGENERATE_DEBUG 0
#define Update_move_planepts_vertex 0
inline bool texdef_sane( const texdef_t& texdef ){
return fabs( texdef.shift[0] ) < ( 1 << 16 )
@ -1138,6 +1139,7 @@ void freezeTransform(){
}
void update_move_planepts_vertex( std::size_t index, PlanePoints planePoints ){
if( contributes() ){
std::size_t numpoints = getWinding().numpoints;
ASSERT_MESSAGE( index < numpoints, "update_move_planepts_vertex: invalid index" );
@ -1147,7 +1149,8 @@ void update_move_planepts_vertex( std::size_t index, PlanePoints planePoints ){
planePoints[1] = getWinding()[index].vertex;
planePoints[2] = getWinding()[adjacent].vertex;
// winding points are very inaccurate, so they must be quantised before using them to generate the face-plane
planepts_quantise( planePoints, GRID_MIN );
// planepts_quantise( planePoints, GRID_MIN );
}
}
void snapto( float snap ){
@ -2142,7 +2145,7 @@ void windingForClipPlane( Winding& winding, const Plane3& plane ) const {
}
if( buffer[swap].points.empty() ){
//globalErrorStream() << "windingForClipPlane: about to feed empty winding\n";
//globalErrorStream() << "windingForClipPlane: about to feed empty winding to Winding_Clip\n";
break;
}
@ -2855,10 +2858,12 @@ void snapComponents( float snap ){
m_face->freezeTransform();
}
}
#if Update_move_planepts_vertex
void update_move_planepts_vertex( std::size_t index ){
m_face->update_move_planepts_vertex( index, m_face->m_move_planepts );
}
void update_move_planepts_vertex2( std::size_t index, std::size_t other ){
if( m_face->contributes() ){
const std::size_t numpoints = m_face->getWinding().numpoints;
ASSERT_MESSAGE( index < numpoints, "select_vertex: invalid index" );
@ -2868,6 +2873,7 @@ void update_move_planepts_vertex2( std::size_t index, std::size_t other ){
std::swap( index, other );
}
///! this actually happens with ON_EPSILON 1.0 / ( 1 << 8 )
ASSERT_MESSAGE(
triangles_same_winding(
m_face->getWinding()[opposite].vertex,
@ -2885,6 +2891,8 @@ void update_move_planepts_vertex2( std::size_t index, std::size_t other ){
m_face->m_move_planepts[2] = m_face->getWinding()[other].vertex;
planepts_quantise( m_face->m_move_planepts, GRID_MIN ); // winding points are very inaccurate
}
}
#endif
void update_selection_vertex(){
if ( m_vertexSelection.size() == 0 ) {
m_selectableVertices.setSelected( false );
@ -2892,7 +2900,7 @@ void update_selection_vertex(){
else
{
m_selectableVertices.setSelected( true );
#if Update_move_planepts_vertex
if ( m_vertexSelection.size() == 1 ) {
std::size_t index = Winding_FindAdjacent( getFace().getWinding(), *m_vertexSelection.begin() );
@ -2909,6 +2917,7 @@ void update_selection_vertex(){
update_move_planepts_vertex2( index, other );
}
}
#endif
}
}
void select_vertex( std::size_t index, bool select ){
@ -2929,6 +2938,7 @@ bool selected_vertex( std::size_t index ) const {
}
void update_move_planepts_edge( std::size_t index ){
if( m_face->contributes() ){
std::size_t numpoints = m_face->getWinding().numpoints;
ASSERT_MESSAGE( index < numpoints, "select_edge: invalid index" );
@ -2937,7 +2947,8 @@ void update_move_planepts_edge( std::size_t index ){
m_face->m_move_planepts[0] = m_face->getWinding()[index].vertex;
m_face->m_move_planepts[1] = m_face->getWinding()[adjacent].vertex;
m_face->m_move_planepts[2] = m_face->getWinding()[opposite].vertex;
planepts_quantise( m_face->m_move_planepts, GRID_MIN ); // winding points are very inaccurate
// planepts_quantise( m_face->m_move_planepts, GRID_MIN ); // winding points are very inaccurate
}
}
void update_selection_edge(){
if ( m_edgeSelection.size() == 0 ) {