multi vertex select and manipulation

This commit is contained in:
Timothee Besset 2013-06-23 00:48:21 +01:00
parent 68a2a18ec8
commit 7c0f42e455
2 changed files with 45 additions and 18 deletions

View file

@ -131,11 +131,13 @@ void Drag_Setup( int x, int y, int buttons,
Undo_AddBrushList( &selected_brushes ); Undo_AddBrushList( &selected_brushes );
} }
return; return;
} } else {
else if ( g_qeglobals.d_select_mode == sel_vertex && ( buttons & MK_SHIFT ) != 0 ) {
{ Sys_Printf( "vertex mode: multi vertex select\n" );
} else {
g_qeglobals.d_num_move_points = 0; g_qeglobals.d_num_move_points = 0;
} }
}
if ( g_qeglobals.d_select_mode == sel_areatall ) { if ( g_qeglobals.d_select_mode == sel_areatall ) {
VectorCopy( origin, g_qeglobals.d_vAreaTL ); VectorCopy( origin, g_qeglobals.d_vAreaTL );
@ -324,7 +326,7 @@ void Drag_Begin( int x, int y, int buttons,
// shift-LBUTTON = select entire brush // shift-LBUTTON = select entire brush
// shift-alt-LBUTTON = drill select // shift-alt-LBUTTON = drill select
if ( buttons == ( MK_LBUTTON | MK_SHIFT ) && g_qeglobals.d_select_mode != sel_curvepoint ) { if ( buttons == ( MK_LBUTTON | MK_SHIFT ) && g_qeglobals.d_select_mode != sel_curvepoint && g_qeglobals.d_select_mode != sel_vertex ) {
nFlag = altdown ? SF_CYCLE : 0; nFlag = altdown ? SF_CYCLE : 0;
if ( sf_camera ) { if ( sf_camera ) {
nFlag |= SF_CAMERA; nFlag |= SF_CAMERA;
@ -529,7 +531,7 @@ void MoveSelection( vec3_t move ){
int i, success; int i, success;
brush_t *b; brush_t *b;
CString strStatus; CString strStatus;
vec3_t vTemp, vTemp2, end; vec3_t vTemp, vTemp2;
if ( !move[0] && !move[1] && !move[2] ) { if ( !move[0] && !move[1] && !move[2] ) {
return; return;
@ -614,26 +616,51 @@ void MoveSelection( vec3_t move ){
// but it touches the smallest amount of code this way // but it touches the smallest amount of code this way
// //
if ( g_qeglobals.d_num_move_points || g_qeglobals.d_select_mode == sel_vertex || g_qeglobals.d_select_mode == sel_area || g_qeglobals.d_select_mode == sel_areatall ) { if ( g_qeglobals.d_num_move_points || g_qeglobals.d_select_mode == sel_vertex || g_qeglobals.d_select_mode == sel_area || g_qeglobals.d_select_mode == sel_areatall ) {
//area selection // area selection
if ( g_qeglobals.d_select_mode == sel_area || g_qeglobals.d_select_mode == sel_areatall ) { if ( g_qeglobals.d_select_mode == sel_area || g_qeglobals.d_select_mode == sel_areatall ) {
VectorAdd( g_qeglobals.d_vAreaBR, move, g_qeglobals.d_vAreaBR ); VectorAdd( g_qeglobals.d_vAreaBR, move, g_qeglobals.d_vAreaBR );
return; return;
} }
//curve point selection // curve point selection
if ( g_qeglobals.d_select_mode == sel_curvepoint ) { if ( g_qeglobals.d_select_mode == sel_curvepoint ) {
Patch_UpdateSelected( move ); Patch_UpdateSelected( move );
return; return;
} }
//vertex selection // vertex selection
if ( g_qeglobals.d_select_mode == sel_vertex && g_PrefsDlg.m_bVertexSplit ) { if ( g_qeglobals.d_select_mode == sel_vertex && g_PrefsDlg.m_bVertexSplit ) {
if ( g_qeglobals.d_num_move_points ) { if ( g_qeglobals.d_num_move_points ) {
success = true; // Q: multiple brushes?
for ( b = selected_brushes.next; b != &selected_brushes; b = b->next ) // A: think terrain editing. select several brushes that have a vertex in common, drag .. will modify both brushes
{ // Q: multiple vertices?
success &= Brush_MoveVertex( b, g_qeglobals.d_move_points[0], move, end, true ); // A: sure! not the same results as edge drags
// Q: multiple vertices + multiple brushes?
// A: oh yeah, that too .. /me kills level designer
// Q: why does the code move the points after calling Brush_MoveVertex on everything?
// A: because in case of multi brush the second brush will fail since the point will have already moved
// NOTE: multi brush, multi vertex is iffy. at least it's not crashy.
// was initially looping brushes before points, but looping points then all brushes seems to work better
vec3_t ends[16];
if ( g_qeglobals.d_num_move_points > 16 ) {
Sys_Printf( "More than 16 vertexes select? Go home, you're drunk\n" );
return;
} }
if ( success ) {
VectorCopy( end, g_qeglobals.d_move_points[0] ); success = true;
int brush_count = 0;
for ( int i = 0; i < g_qeglobals.d_num_move_points; i++ ) {
for ( b = selected_brushes.next; b != &selected_brushes; b = b->next ) {
success &= Brush_MoveVertex( b, g_qeglobals.d_move_points[i], move, ends[i], true );
if ( !success ) {
Sys_Printf( "Brush_MoveVertex brush %d vertex %d failed\n", brush_count, i );
return;
}
brush_count++;
}
}
for ( int i = 0; i < g_qeglobals.d_num_move_points; i++ ) {
VectorCopy( ends[i], g_qeglobals.d_move_points[i] );
} }
} }
return; return;

View file

@ -1304,7 +1304,7 @@ void CGameDialog::Init(){
g_strGameToolsPath = g_pGameDescription->mGameToolsPath; g_strGameToolsPath = g_pGameDescription->mGameToolsPath;
// Add the per-user game path on all platforms // Add the per-user game path on all platforms
if (m_pCurrentGameDescription->mUserPathPrefix.GetLength()) { if ( m_pCurrentGameDescription->mUserPathPrefix.GetLength() ) {
#if defined ( __linux__ ) || defined ( __APPLE__ ) #if defined ( __linux__ ) || defined ( __APPLE__ )
g_qeglobals.m_strHomeGame = g_get_home_dir(); g_qeglobals.m_strHomeGame = g_get_home_dir();
g_qeglobals.m_strHomeGame += "/"; g_qeglobals.m_strHomeGame += "/";