From: Garux Date: Wed, 2 Aug 2017 06:14:33 +0000 (+0300) Subject: Radiant: X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=commitdiff_plain;h=2455e50d724c988a300fe30b8bc66f01bb05dd42 Radiant: misc... * fix: mixed up 'Up' & 'Forward' mouse strafe options * mouse strafe options: old 'both' one with inverted forward, None fix: QE tool: alt + m1 + ctrl drag : verts weren't snapped (since not component mode) fix: QE tool face drag + ctrl: no snap fix: ctrl snap on drag + shift constrain to axis: excess snap on not dragged axis //some coord e-17 --- diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 01a7f491..fdad03e1 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -90,7 +90,7 @@ struct camwindow_globals_private_t m_bCamDiscrete( true ), m_bCubicClipping( false ), m_showStats( true ), - m_nStrafeMode( 0 ){ + m_nStrafeMode( 3 ){ } }; @@ -142,6 +142,7 @@ struct camera_t bool m_strafe; // true when in strafemode toggled by the ctrl-key bool m_strafe_forward; // true when in strafemode by ctrl-key and shift is pressed for forward strafing + bool m_strafe_forward_invert; //silly option to invert forward strafing to support old fegs unsigned int movementflags; // movement flags Timer m_keycontrol_timer; @@ -280,7 +281,7 @@ void Camera_FreeMove( camera_t& camera, int dx, int dy ){ camera.origin -= camera.vright * strafespeed * dx; if ( camera.m_strafe_forward ) { - camera.origin -= camera.vpn * strafespeed * dy; + camera.origin += camera.m_strafe_forward_invert ? ( camera.vpn * strafespeed * dy ) : ( -camera.vpn * strafespeed * dy ); } else{ camera.origin += camera.vup * strafespeed * dy; @@ -629,16 +630,12 @@ void Camera_motionDelta( int x, int y, unsigned int state, void* data ){ cam->m_mouseMove.motion_delta( x, y, state ); + cam->m_strafe_forward_invert = false; + switch ( g_camwindow_globals_private.m_nStrafeMode ) { case 0: - cam->m_strafe = ( state & GDK_CONTROL_MASK ) != 0; - if ( cam->m_strafe ) { - cam->m_strafe_forward = ( state & GDK_SHIFT_MASK ) != 0; - } - else{ - cam->m_strafe_forward = false; - } + cam->m_strafe = false; break; case 1: cam->m_strafe = ( state & GDK_CONTROL_MASK ) != 0 && ( state & GDK_SHIFT_MASK ) == 0; @@ -648,9 +645,24 @@ void Camera_motionDelta( int x, int y, unsigned int state, void* data ){ cam->m_strafe = ( state & GDK_CONTROL_MASK ) != 0 && ( state & GDK_SHIFT_MASK ) == 0; cam->m_strafe_forward = cam->m_strafe; break; + case 4: + cam->m_strafe_forward_invert = true; + default: + cam->m_strafe = ( state & GDK_CONTROL_MASK ) != 0; + if ( cam->m_strafe ) { + cam->m_strafe_forward = ( state & GDK_SHIFT_MASK ) != 0; + } + else{ + cam->m_strafe_forward = false; + } + break; } } + + + + class CamWnd { View m_view; @@ -1912,7 +1924,7 @@ void Camera_constructPreferences( PreferencesPage& page ){ ); } - const char* strafe_mode[] = { "Both", "Forward", "Up" }; + const char* strafe_mode[] = { "None", "Up", "Forward", "Both", "Both Inverted" }; page.appendCombo( "Strafe Mode", diff --git a/radiant/selection.cpp b/radiant/selection.cpp index 4e0c67e9..96cde65b 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -378,9 +378,9 @@ void Transform( const Matrix4& manip2object, const Matrix4& device2manip, const float grid = GetSnapGridSize(); Vector3 maxs( m_bounds.origin + m_bounds.extents ); Vector3 mins( m_bounds.origin - m_bounds.extents ); -// globalOutputStream() << "current: " << current << "\n"; + //globalOutputStream() << "current: " << current << "\n"; for( std::size_t i = 0; i < 3; ++i ){ - if( current[i] != 0.f ){ + if( fabs( current[i] ) > 0.000001f ){ float snapto1 = float_snapped( maxs[i] + current[i] , grid ); float snapto2 = float_snapped( mins[i] + current[i] , grid ); @@ -2639,6 +2639,7 @@ std::list& best(){ }; bool g_bAltDragManipulatorResize = false; +bool g_bTmpComponentMode = false; class DragManipulator : public Manipulator { @@ -2725,6 +2726,7 @@ void testSelect( const View& view, const Matrix4& pivot2world ){ { ( *i ).second->setSelected( true ); } + g_bTmpComponentMode = m_selected; } void setSelected( bool select ){ @@ -3677,6 +3679,7 @@ void RadiantSelectionSystem::endMove(){ if ( Mode() == ePrimitive ) { if ( ManipulatorMode() == eDrag ) { + g_bTmpComponentMode = false; if( g_bAltDragManipulatorResize ){ Scene_SelectAll_Component( false, SelectionSystem::eVertex ); } @@ -3923,7 +3926,7 @@ void RadiantSelectionSystem::setCustomPivotOrigin( Vector3& point ) const { AABB RadiantSelectionSystem::getSelectionAABB() const { AABB bounds; if ( !nothingSelected() ) { - if ( Mode() == eComponent ) { + if ( Mode() == eComponent || g_bTmpComponentMode ) { Scene_BoundsSelectedComponent( GlobalSceneGraph(), bounds ); } else