/* ================ MoveSelection ================ */ static void MoveSelection( const idVec3 &orgMove ) { int i, success; brush_t *b; CString strStatus; idVec3 vTemp, vTemp2, end, move; move = orgMove; if (!move[0] && !move[1] && !move[2]) { return; } move[0] = (g_nScaleHow & SCALE_X) ? 0 : move[0]; move[1] = (g_nScaleHow & SCALE_Y) ? 0 : move[1]; move[2] = (g_nScaleHow & SCALE_Z) ? 0 : move[2]; if (g_pParentWnd->ActiveXY()->RotateMode() || g_bPatchBendMode) { float fDeg = -move[2]; float fAdj = move[2]; int axis = 0; if (g_pParentWnd->ActiveXY()->GetViewType() == XY) { fDeg = -move[1]; fAdj = move[1]; axis = 2; } else if (g_pParentWnd->ActiveXY()->GetViewType() == XZ) { fDeg = move[2]; fAdj = move[2]; axis = 1; } g_pParentWnd->ActiveXY()->Rotation()[g_qeglobals.rotateAxis] += fAdj; strStatus.Format ( "%s x:: %.1f y:: %.1f z:: %.1f", (g_bPatchBendMode) ? "Bend angle" : "Rotation", g_pParentWnd->ActiveXY()->Rotation()[0], g_pParentWnd->ActiveXY()->Rotation()[1], g_pParentWnd->ActiveXY()->Rotation()[2] ); g_pParentWnd->SetStatusText(2, strStatus); if (g_bPatchBendMode) { Patch_SelectBendNormal(); Select_RotateAxis(axis, fDeg * 2, false, true); Patch_SelectBendAxis(); Select_RotateAxis(axis, fDeg, false, true); } else { Select_RotateAxis(g_qeglobals.rotateAxis, fDeg, false, true); } return; } if (g_pParentWnd->ActiveXY()->ScaleMode()) { idVec3 v; v[0] = v[1] = v[2] = 1.0f; for (int i = 0; i < 3; i++) { if ( move[i] > 0.0f ) { v[i] = 1.1f; } else if ( move[i] < 0.0f ) { v[i] = 0.9f; } } Select_Scale(v.x, v.y, v.z); Sys_UpdateWindows(W_ALL); return; } idVec3 vDistance; VectorSubtract(pressdelta, vPressStart, vDistance); strStatus.Format("Distance x: %.3f y: %.3f z: %.3f", vDistance[0], vDistance[1], vDistance[2]); g_pParentWnd->SetStatusText(3, strStatus); // dragging only a part of the selection if (UpdateActiveDragPoint(move)) { UpdateLightInspector(); return; } // // this is fairly crappy way to deal with curvepoint and area selection but it // touches the smallest amount of code this way // if (g_qeglobals.d_num_move_points || g_qeglobals.d_num_move_planes || g_qeglobals.d_select_mode == sel_area) { // area selection if (g_qeglobals.d_select_mode == sel_area) { VectorAdd(g_qeglobals.d_vAreaBR, move, g_qeglobals.d_vAreaBR); return; } // curve point selection if (g_qeglobals.d_select_mode == sel_curvepoint) { Patch_UpdateSelected(move); return; } // vertex selection if (g_qeglobals.d_select_mode == sel_vertex) { success = true; for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { success &= Brush_MoveVertex(selected_brushes.next, *g_qeglobals.d_move_points[0], move, end, true); } // if (success) VectorCopy(end, *g_qeglobals.d_move_points[0]); return; } // all other selection types for (i = 0; i < g_qeglobals.d_num_move_points; i++) { VectorAdd(*g_qeglobals.d_move_points[i], move, *g_qeglobals.d_move_points[i]); } if ( g_qeglobals.d_select_mode == sel_editpoint ) { g_Inspectors->entityDlg.UpdateEntityCurve(); } // // VectorScale(move, .5, move); for (i=0 ; i<g_qeglobals.d_num_move_points2 ; i++) // VectorAdd (g_qeglobals.d_move_points2[i], move, g_qeglobals.d_move_points2[i]); // for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { VectorCopy(b->maxs, vTemp); VectorSubtract(vTemp, b->mins, vTemp); Brush_Build(b); for (i = 0; i < 3; i++) { if ( b->mins[i] > b->maxs[i] || b->maxs[i] - b->mins[i] > MAX_WORLD_SIZE || b->maxs[i] - b->mins[i] == 0.0f ) { break; // dragged backwards or messed up } } if (i != 3) { break; } if (b->pPatch) { VectorCopy(b->maxs, vTemp2); VectorSubtract(vTemp2, b->mins, vTemp2); VectorSubtract(vTemp2, vTemp, vTemp2); // if (!Patch_DragScale(b->nPatchID, vTemp2, move)) if (!Patch_DragScale(b->pPatch, vTemp2, move)) { b = NULL; break; } } } // if any of the brushes were crushed out of existance calcel the entire move if (b != &selected_brushes) { Sys_Status("Brush dragged backwards, move canceled\n"); for (i = 0; i < g_qeglobals.d_num_move_points; i++) { VectorSubtract(*g_qeglobals.d_move_points[i], move, *g_qeglobals.d_move_points[i]); } for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { Brush_Build(b); } } } else { // // reset face originals from vertex edit mode this is dirty, but unfortunately // necessary because Brush_Build can remove windings // for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { Brush_ResetFaceOriginals(b); } Select_Move(move); } }
// //=========== //MoveSelection //=========== // void MoveSelection (vec3_t move) { int i, success; brush_t *b; CString strStatus; vec3_t vTemp, vTemp2, end; if (!move[0] && !move[1] && !move[2]) return; if (g_pParentWnd->ActiveXY()->RotateMode() || g_bPatchBendMode) { float fDeg = -move[2]; float fAdj = move[2]; int nAxis = 0; if (g_pParentWnd->ActiveXY()->GetViewType() == XY) { fDeg = -move[1]; fAdj = move[1]; nAxis = 2; } else if (g_pParentWnd->ActiveXY()->GetViewType() == XZ) { fDeg = move[2]; fAdj = move[2]; nAxis = 1; } else nAxis = 0; g_pParentWnd->ActiveXY()->Rotation()[nAxis] += fAdj; strStatus.Format("%s x:: %.1f y:: %.1f z:: %.1f", (g_bPatchBendMode) ? "Bend angle" : "Rotation", g_pParentWnd->ActiveXY()->Rotation()[0], g_pParentWnd->ActiveXY()->Rotation()[1], g_pParentWnd->ActiveXY()->Rotation()[2]); g_pParentWnd->SetStatusText(2, strStatus); if (g_bPatchBendMode) { Patch_SelectBendNormal(); Select_RotateAxis(nAxis, fDeg*2, false, true); Patch_SelectBendAxis(); Select_RotateAxis(nAxis, fDeg, false, true); } else { Select_RotateAxis(nAxis, fDeg, false, true); } return; } if (g_pParentWnd->ActiveXY()->ScaleMode()) { vec3_t v; v[0] = v[1] = v[2] = 1.0; if (move[1] > 0) { v[0] = 1.1; v[1] = 1.1; v[2] = 1.1; } else if (move[1] < 0) { v[0] = 0.9; v[1] = 0.9; v[2] = 0.9; } Select_Scale((g_nScaleHow & SCALE_X) ? v[0] : 1.0, (g_nScaleHow & SCALE_Y) ? v[1] : 1.0, (g_nScaleHow & SCALE_Z) ? v[2] : 1.0); Sys_UpdateWindows (W_ALL); return; } vec3_t vDistance; VectorSubtract(pressdelta, vPressStart, vDistance); strStatus.Format("Distance x: %.1f y: %.1f z: %.1f", vDistance[0], vDistance[1], vDistance[2]); g_pParentWnd->SetStatusText(3, strStatus); // // dragging only a part of the selection // // this is fairly crappy way to deal with curvepoint and area selection // but it touches the smallest amount of code this way // if (g_qeglobals.d_num_move_points || g_qeglobals.d_select_mode == sel_area) { //area selection if (g_qeglobals.d_select_mode == sel_area) { VectorAdd(g_qeglobals.d_vAreaBR, move, g_qeglobals.d_vAreaBR); return; } //curve point selection if (g_qeglobals.d_select_mode == sel_curvepoint) { Patch_UpdateSelected(move); return; } //vertex selection if (g_qeglobals.d_select_mode == sel_vertex && g_PrefsDlg.m_bVertexSplit) { success = true; for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { success &= Brush_MoveVertex(selected_brushes.next, g_qeglobals.d_move_points[0], move, end, true); } VectorCopy(end, g_qeglobals.d_move_points[0]); return; } //all other selection types (and old vertex editing mode) for (i=0 ; i<g_qeglobals.d_num_move_points ; i++) VectorAdd (g_qeglobals.d_move_points[i], move, g_qeglobals.d_move_points[i]); for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { VectorCopy(b->maxs, vTemp); VectorSubtract(vTemp, b->mins, vTemp); Brush_Build( b ); for (i=0 ; i<3 ; i++) if (b->mins[i] > b->maxs[i] || b->maxs[i] - b->mins[i] > MAX_BRUSH_SIZE) break; // dragged backwards or f****d up if (i != 3) break; if (b->patchBrush) { VectorCopy(b->maxs, vTemp2); VectorSubtract(vTemp2, b->mins, vTemp2); VectorSubtract(vTemp2, vTemp, vTemp2); //if (!Patch_DragScale(b->nPatchID, vTemp2, move)) if (!Patch_DragScale(b->pPatch, vTemp2, move)) { b = NULL; break; } } } // if any of the brushes were crushed out of existance // calcel the entire move if (b != &selected_brushes) { Sys_Printf ("Brush dragged backwards, move canceled\n"); for (i=0 ; i<g_qeglobals.d_num_move_points ; i++) VectorSubtract (g_qeglobals.d_move_points[i], move, g_qeglobals.d_move_points[i]); for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next) Brush_Build( b ); } } else { // reset face originals from vertex edit mode // this is dirty, but unfortunately necessary because Brush_Build // can remove windings for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { Brush_ResetFaceOriginals(b); } // // if there are lots of brushes selected, just translate instead // of rebuilding the brushes // if (drag_yvec[2] == 0 && selected_brushes.next->next != &selected_brushes) { Select_Move (move); //VectorAdd (g_qeglobals.d_select_translate, move, g_qeglobals.d_select_translate); } else { Select_Move (move); } } }