3D viewer flip action

This commit is contained in:
Electro707 2020-06-08 21:35:40 +00:00 committed by Jon Evans
parent f8967550a8
commit 4a3743e7dd
7 changed files with 27 additions and 0 deletions

5
.gitignore vendored
View File

@ -104,3 +104,8 @@ CMakeSettings.json
# Sublime Text # Sublime Text
*.sublime-* *.sublime-*
# KDevelop
.kdev4/
*.kdev4

View File

@ -948,6 +948,13 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
request_start_moving_camera( glm::min( glm::max( m_camera.ZoomGet(), 0.5f ), 1.125f ) ); request_start_moving_camera( glm::min( glm::max( m_camera.ZoomGet(), 0.5f ), 1.125f ) );
return true; return true;
case ID_VIEW3D_FLIP:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.RotateY_T1( glm::radians( 179.999f ) );
request_start_moving_camera();
return true;
default: default:
return false; return false;
} }

View File

@ -87,6 +87,9 @@ void EDA_3D_VIEWER::ReCreateMainToolbar()
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCW ); m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCW );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCCW ); m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCCW );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->Add( EDA_3D_ACTIONS::flipView );
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->Add( EDA_3D_ACTIONS::moveLeft ); m_mainToolBar->Add( EDA_3D_ACTIONS::moveLeft );
m_mainToolBar->Add( EDA_3D_ACTIONS::moveRight ); m_mainToolBar->Add( EDA_3D_ACTIONS::moveRight );

View File

@ -109,6 +109,12 @@ TOOL_ACTION EDA_3D_ACTIONS::resetView( "3DViewer.Control.resetView",
_( "Reset view" ), _( "Reset view" ), _( "Reset view" ), _( "Reset view" ),
nullptr, AF_NONE, (void*) ID_VIEW3D_RESET ); nullptr, AF_NONE, (void*) ID_VIEW3D_RESET );
TOOL_ACTION EDA_3D_ACTIONS::flipView( "3DViewer.Control.flipView",
AS_ACTIVE,
0, "",
_( "Flip Board" ), _( "Flip the board view" ),
reload2_xpm, AF_NONE, (void*) ID_VIEW3D_FLIP );
TOOL_ACTION EDA_3D_ACTIONS::toggleOrtho( "3DViewer.Control.toggleOrtho", TOOL_ACTION EDA_3D_ACTIONS::toggleOrtho( "3DViewer.Control.toggleOrtho",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",
_( "Toggle orthographic projection" ), _( "Enable/disable orthographic projection" ), _( "Toggle orthographic projection" ), _( "Enable/disable orthographic projection" ),

View File

@ -56,6 +56,7 @@ public:
static TOOL_ACTION moveDown; static TOOL_ACTION moveDown;
static TOOL_ACTION homeView; static TOOL_ACTION homeView;
static TOOL_ACTION resetView; static TOOL_ACTION resetView;
static TOOL_ACTION flipView;
static TOOL_ACTION toggleOrtho; static TOOL_ACTION toggleOrtho;
static TOOL_ACTION viewFront; static TOOL_ACTION viewFront;

View File

@ -51,6 +51,9 @@ bool EDA_3D_CONTROLLER::Init()
ctxMenu.AddItem( EDA_3D_ACTIONS::viewFront, SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddItem( EDA_3D_ACTIONS::viewFront, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EDA_3D_ACTIONS::viewBack, SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddItem( EDA_3D_ACTIONS::viewBack, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddSeparator();
ctxMenu.AddItem( EDA_3D_ACTIONS::flipView, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddSeparator(); ctxMenu.AddSeparator();
ctxMenu.AddItem( EDA_3D_ACTIONS::moveLeft, SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddItem( EDA_3D_ACTIONS::moveLeft, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EDA_3D_ACTIONS::moveRight, SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddItem( EDA_3D_ACTIONS::moveRight, SELECTION_CONDITIONS::ShowAlways );
@ -295,6 +298,7 @@ void EDA_3D_CONTROLLER::setTransitions()
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::pivotCenter.MakeEvent() ); Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::pivotCenter.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::homeView.MakeEvent() ); Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::homeView.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::resetView.MakeEvent() ); Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::resetView.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::flipView.MakeEvent() );
Go( &EDA_3D_CONTROLLER::RotateView, EDA_3D_ACTIONS::rotateXCW.MakeEvent() ); Go( &EDA_3D_CONTROLLER::RotateView, EDA_3D_ACTIONS::rotateXCW.MakeEvent() );
Go( &EDA_3D_CONTROLLER::RotateView, EDA_3D_ACTIONS::rotateXCCW.MakeEvent() ); Go( &EDA_3D_CONTROLLER::RotateView, EDA_3D_ACTIONS::rotateXCCW.MakeEvent() );
Go( &EDA_3D_CONTROLLER::RotateView, EDA_3D_ACTIONS::rotateYCW.MakeEvent() ); Go( &EDA_3D_CONTROLLER::RotateView, EDA_3D_ACTIONS::rotateYCW.MakeEvent() );

View File

@ -31,6 +31,7 @@ enum id_3dview_frm
ID_VIEW3D_FRONT, ID_VIEW3D_FRONT,
ID_VIEW3D_BACK, ID_VIEW3D_BACK,
ID_VIEW3D_RESET, ID_VIEW3D_RESET,
ID_VIEW3D_FLIP,
ID_TOOL_SCREENCOPY_TOCLIBBOARD, ID_TOOL_SCREENCOPY_TOCLIBBOARD,
ID_MENU3D_COLOR, ID_MENU3D_COLOR,
ID_MENU3D_BGCOLOR, ID_MENU3D_BGCOLOR,