Make the 3d viewer rotation increment configurable

ADDED: Setting for the 3d viewer rotation increment

Fixes https://gitlab.com/kicad/code/kicad/issues/4618
This commit is contained in:
Ian McInerney 2020-06-07 11:42:28 +01:00
parent 27c80e8a2e
commit 6083c0849f
9 changed files with 4222 additions and 3899 deletions

View File

@ -117,6 +117,8 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS()
&m_Camera.animation_enabled, true ) ); &m_Camera.animation_enabled, true ) );
m_params.emplace_back( new PARAM<int>( "camera.moving_speed_multiplier", m_params.emplace_back( new PARAM<int>( "camera.moving_speed_multiplier",
&m_Camera.moving_speed_multiplier, 3 ) ); &m_Camera.moving_speed_multiplier, 3 ) );
m_params.emplace_back( new PARAM<double>( "camera.rotation_increment",
&m_Camera.rotation_increment, 10.0 ) );
} }

View File

@ -66,8 +66,9 @@ public:
struct CAMERA_SETTINGS struct CAMERA_SETTINGS
{ {
bool animation_enabled; bool animation_enabled;
int moving_speed_multiplier; int moving_speed_multiplier;
double rotation_increment;
}; };
EDA_3D_VIEWER_SETTINGS(); EDA_3D_VIEWER_SETTINGS();

View File

@ -23,15 +23,22 @@
*/ */
#include "dialog_3D_view_option_base.h" #include "dialog_3D_view_option_base.h"
#include <3d_viewer/eda_3d_viewer.h>
#include <3d_canvas/board_adapter.h> #include <3d_canvas/board_adapter.h>
#include <3d_viewer/eda_3d_viewer.h>
#include <3d_viewer/tools/3d_controller.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <tool/tool_manager.h>
class DIALOG_3D_VIEW_OPTIONS : public DIALOG_3D_VIEW_OPTIONS_BASE class DIALOG_3D_VIEW_OPTIONS : public DIALOG_3D_VIEW_OPTIONS_BASE
{ {
public: public:
explicit DIALOG_3D_VIEW_OPTIONS( EDA_3D_VIEWER* aParent ); explicit DIALOG_3D_VIEW_OPTIONS( EDA_3D_VIEWER* aParent );
EDA_3D_VIEWER* GetParent()
{
return static_cast<EDA_3D_VIEWER*>( DIALOG_SHIM::GetParent() );
}
private: private:
BOARD_ADAPTER& m_settings; BOARD_ADAPTER& m_settings;
EDA_3D_CANVAS* m_canvas; EDA_3D_CANVAS* m_canvas;
@ -141,6 +148,9 @@ bool DIALOG_3D_VIEW_OPTIONS::TransferDataToWindow()
m_staticAnimationSpeed->Enable( m_canvas->AnimationEnabledGet() ); m_staticAnimationSpeed->Enable( m_canvas->AnimationEnabledGet() );
m_sliderAnimationSpeed->Enable( m_canvas->AnimationEnabledGet() ); m_sliderAnimationSpeed->Enable( m_canvas->AnimationEnabledGet() );
EDA_3D_CONTROLLER* ctrlTool = GetParent()->GetToolManager()->GetTool<EDA_3D_CONTROLLER>();
m_spinCtrlRotationAngle->SetValue( ctrlTool->GetRotationIncrement() );
return true; return true;
} }
@ -190,5 +200,8 @@ bool DIALOG_3D_VIEW_OPTIONS::TransferDataFromWindow()
m_canvas->AnimationEnabledSet( m_checkBoxEnableAnimation->GetValue() ); m_canvas->AnimationEnabledSet( m_checkBoxEnableAnimation->GetValue() );
m_canvas->MovingSpeedMultiplierSet( m_sliderAnimationSpeed->GetValue() ); m_canvas->MovingSpeedMultiplierSet( m_sliderAnimationSpeed->GetValue() );
EDA_3D_CONTROLLER* ctrlTool = GetParent()->GetToolManager()->GetTool<EDA_3D_CONTROLLER>();
ctrlTool->SetRotationIncrement( m_spinCtrlRotationAngle->GetValue() );
return true; return true;
} }

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 10 2019) // C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -132,8 +132,8 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
wxBoxSizer* bSizerRight; wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL ); bSizerRight = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer3; wxStaticBoxSizer* sbBoardLayers;
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("Board Layers") ), wxVERTICAL ); sbBoardLayers = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("Board Layers") ), wxVERTICAL );
wxFlexGridSizer* fgSizerShowBrdLayersOpts; wxFlexGridSizer* fgSizerShowBrdLayersOpts;
fgSizerShowBrdLayersOpts = new wxFlexGridSizer( 0, 3, 0, 0 ); fgSizerShowBrdLayersOpts = new wxFlexGridSizer( 0, 3, 0, 0 );
@ -143,47 +143,47 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 ); fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapSilkscreen = new wxStaticBitmap( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapSilkscreen = new wxStaticBitmap( sbBoardLayers->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapSilkscreen, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); fgSizerShowBrdLayersOpts->Add( m_bitmapSilkscreen, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxSilkscreen = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Show silkscreen layers"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxSilkscreen = new wxCheckBox( sbBoardLayers->GetStaticBox(), wxID_ANY, _("Show silkscreen layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxSilkscreen, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); fgSizerShowBrdLayersOpts->Add( m_checkBoxSilkscreen, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 ); fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapSolderMask = new wxStaticBitmap( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapSolderMask = new wxStaticBitmap( sbBoardLayers->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapSolderMask, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); fgSizerShowBrdLayersOpts->Add( m_bitmapSolderMask, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxSolderMask = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Show solder mask layers"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxSolderMask = new wxCheckBox( sbBoardLayers->GetStaticBox(), wxID_ANY, _("Show solder mask layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxSolderMask, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); fgSizerShowBrdLayersOpts->Add( m_checkBoxSolderMask, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 ); fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapSolderPaste = new wxStaticBitmap( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapSolderPaste = new wxStaticBitmap( sbBoardLayers->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapSolderPaste, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); fgSizerShowBrdLayersOpts->Add( m_bitmapSolderPaste, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxSolderpaste = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Show solder paste layers"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxSolderpaste = new wxCheckBox( sbBoardLayers->GetStaticBox(), wxID_ANY, _("Show solder paste layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxSolderpaste, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); fgSizerShowBrdLayersOpts->Add( m_checkBoxSolderpaste, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 ); fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapAdhesive = new wxStaticBitmap( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapAdhesive = new wxStaticBitmap( sbBoardLayers->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapAdhesive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); fgSizerShowBrdLayersOpts->Add( m_bitmapAdhesive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxAdhesive = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Show adhesive layers"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxAdhesive = new wxCheckBox( sbBoardLayers->GetStaticBox(), wxID_ANY, _("Show adhesive layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxAdhesive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); fgSizerShowBrdLayersOpts->Add( m_checkBoxAdhesive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
sbSizer3->Add( fgSizerShowBrdLayersOpts, 0, wxEXPAND, 5 ); sbBoardLayers->Add( fgSizerShowBrdLayersOpts, 0, wxEXPAND, 5 );
bSizerRight->Add( sbSizer3, 0, wxALL|wxEXPAND, 5 ); bSizerRight->Add( sbBoardLayers, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer4; wxStaticBoxSizer* sbUserLayers;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("User Layers (not shown in realistic mode)") ), wxVERTICAL ); sbUserLayers = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("User Layers (not shown in realistic mode)") ), wxVERTICAL );
wxFlexGridSizer* fgSizerShowUserLayersOpts; wxFlexGridSizer* fgSizerShowUserLayersOpts;
fgSizerShowUserLayersOpts = new wxFlexGridSizer( 0, 3, 0, 0 ); fgSizerShowUserLayersOpts = new wxFlexGridSizer( 0, 3, 0, 0 );
@ -193,51 +193,72 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
fgSizerShowUserLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 ); fgSizerShowUserLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapComments = new wxStaticBitmap( sbSizer4->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapComments = new wxStaticBitmap( sbUserLayers->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_bitmapComments, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); fgSizerShowUserLayersOpts->Add( m_bitmapComments, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxComments = new wxCheckBox( sbSizer4->GetStaticBox(), wxID_ANY, _("Show comments and drawings layers"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxComments = new wxCheckBox( sbUserLayers->GetStaticBox(), wxID_ANY, _("Show comments and drawings layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_checkBoxComments, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); fgSizerShowUserLayersOpts->Add( m_checkBoxComments, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerShowUserLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 ); fgSizerShowUserLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapECO = new wxStaticBitmap( sbSizer4->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapECO = new wxStaticBitmap( sbUserLayers->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_bitmapECO, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); fgSizerShowUserLayersOpts->Add( m_bitmapECO, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxECO = new wxCheckBox( sbSizer4->GetStaticBox(), wxID_ANY, _("Show ECO layers"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxECO = new wxCheckBox( sbUserLayers->GetStaticBox(), wxID_ANY, _("Show ECO layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_checkBoxECO, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); fgSizerShowUserLayersOpts->Add( m_checkBoxECO, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
sbSizer4->Add( fgSizerShowUserLayersOpts, 0, wxEXPAND, 5 ); sbUserLayers->Add( fgSizerShowUserLayersOpts, 0, wxEXPAND, 5 );
bSizerRight->Add( sbSizer4, 0, wxALL|wxEXPAND, 5 ); bSizerRight->Add( sbUserLayers, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerAnimation; wxStaticBoxSizer* sbCameraOptions;
sbSizerAnimation = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("Camera Options") ), wxVERTICAL ); sbCameraOptions = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("Camera Options") ), wxVERTICAL );
m_checkBoxEnableAnimation = new wxCheckBox( sbSizerAnimation->GetStaticBox(), wxID_ANY, _("Enable animation"), wxDefaultPosition, wxDefaultSize, 0 ); wxBoxSizer* bSizerRotAngle;
bSizerRotAngle = new wxBoxSizer( wxHORIZONTAL );
m_staticTextRotAngle = new wxStaticText( sbCameraOptions->GetStaticBox(), wxID_ANY, _("Rotation Increment:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRotAngle->Wrap( -1 );
bSizerRotAngle->Add( m_staticTextRotAngle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_spinCtrlRotationAngle = new wxSpinCtrlDouble( sbCameraOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 359, 10, 1 );
m_spinCtrlRotationAngle->SetDigits( 0 );
bSizerRotAngle->Add( m_spinCtrlRotationAngle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_staticTextRotAngleUnits = new wxStaticText( sbCameraOptions->GetStaticBox(), wxID_ANY, _("deg"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRotAngleUnits->Wrap( -1 );
bSizerRotAngle->Add( m_staticTextRotAngleUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
sbCameraOptions->Add( bSizerRotAngle, 1, wxEXPAND, 5 );
m_staticline3 = new wxStaticLine( sbCameraOptions->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
sbCameraOptions->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );
m_checkBoxEnableAnimation = new wxCheckBox( sbCameraOptions->GetStaticBox(), wxID_ANY, _("Enable animation"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxEnableAnimation->SetValue(true); m_checkBoxEnableAnimation->SetValue(true);
sbSizerAnimation->Add( m_checkBoxEnableAnimation, 0, wxALL, 5 ); sbCameraOptions->Add( m_checkBoxEnableAnimation, 0, wxALL, 5 );
wxBoxSizer* bSizerSlider; wxBoxSizer* bSizerSlider;
bSizerSlider = new wxBoxSizer( wxHORIZONTAL ); bSizerSlider = new wxBoxSizer( wxHORIZONTAL );
m_staticAnimationSpeed = new wxStaticText( sbSizerAnimation->GetStaticBox(), wxID_ANY, _("Animation speed:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticAnimationSpeed = new wxStaticText( sbCameraOptions->GetStaticBox(), wxID_ANY, _("Animation speed:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticAnimationSpeed->Wrap( -1 ); m_staticAnimationSpeed->Wrap( -1 );
bSizerSlider->Add( m_staticAnimationSpeed, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bSizerSlider->Add( m_staticAnimationSpeed, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_sliderAnimationSpeed = new wxSlider( sbSizerAnimation->GetStaticBox(), wxID_ANY, 3, 1, 5, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS ); m_sliderAnimationSpeed = new wxSlider( sbCameraOptions->GetStaticBox(), wxID_ANY, 3, 1, 5, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS );
m_sliderAnimationSpeed->SetMinSize( wxSize( 100,-1 ) ); m_sliderAnimationSpeed->SetMinSize( wxSize( 100,-1 ) );
bSizerSlider->Add( m_sliderAnimationSpeed, 1, wxALL|wxEXPAND, 5 ); bSizerSlider->Add( m_sliderAnimationSpeed, 1, wxALL|wxEXPAND, 5 );
sbSizerAnimation->Add( bSizerSlider, 1, wxEXPAND, 5 ); sbCameraOptions->Add( bSizerSlider, 1, wxEXPAND, 5 );
bSizerRight->Add( sbSizerAnimation, 0, wxALL|wxEXPAND, 5 ); bSizerRight->Add( sbCameraOptions, 0, wxALL|wxEXPAND, 5 );
bSizerDisplayOptions->Add( bSizerRight, 0, wxALL|wxEXPAND, 5 ); bSizerDisplayOptions->Add( bSizerRight, 0, wxALL|wxEXPAND, 5 );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 10 2019) // C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -25,6 +25,7 @@
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/spinctrl.h>
#include <wx/slider.h> #include <wx/slider.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/choice.h> #include <wx/choice.h>
@ -72,6 +73,10 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_checkBoxComments; wxCheckBox* m_checkBoxComments;
wxStaticBitmap* m_bitmapECO; wxStaticBitmap* m_bitmapECO;
wxCheckBox* m_checkBoxECO; wxCheckBox* m_checkBoxECO;
wxStaticText* m_staticTextRotAngle;
wxSpinCtrlDouble* m_spinCtrlRotationAngle;
wxStaticText* m_staticTextRotAngleUnits;
wxStaticLine* m_staticline3;
wxCheckBox* m_checkBoxEnableAnimation; wxCheckBox* m_checkBoxEnableAnimation;
wxStaticText* m_staticAnimationSpeed; wxStaticText* m_staticAnimationSpeed;
wxSlider* m_sliderAnimationSpeed; wxSlider* m_sliderAnimationSpeed;
@ -105,7 +110,7 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
public: public:
DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 659,485 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 659,567 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_3D_VIEW_OPTIONS_BASE(); ~DIALOG_3D_VIEW_OPTIONS_BASE();
}; };

View File

@ -132,6 +132,9 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxSt
m_toolManager->RegisterTool( new EDA_3D_CONTROLLER ); m_toolManager->RegisterTool( new EDA_3D_CONTROLLER );
m_toolManager->InitTools(); m_toolManager->InitTools();
if( EDA_3D_CONTROLLER* ctrlTool = GetToolManager()->GetTool<EDA_3D_CONTROLLER>() )
ctrlTool->SetRotationIncrement( config->m_Camera.rotation_increment );
// Run the viewer control tool, it is supposed to be always active // Run the viewer control tool, it is supposed to be always active
m_toolManager->InvokeTool( "3DViewer.Control" ); m_toolManager->InvokeTool( "3DViewer.Control" );
@ -520,6 +523,9 @@ void EDA_3D_VIEWER::SaveSettings( APP_SETTINGS_BASE *aCfg )
cfg->m_Camera.animation_enabled = m_canvas->AnimationEnabledGet(); cfg->m_Camera.animation_enabled = m_canvas->AnimationEnabledGet();
cfg->m_Camera.moving_speed_multiplier = m_canvas->MovingSpeedMultiplierGet(); cfg->m_Camera.moving_speed_multiplier = m_canvas->MovingSpeedMultiplierGet();
if( EDA_3D_CONTROLLER* ctrlTool = GetToolManager()->GetTool<EDA_3D_CONTROLLER>() )
cfg->m_Camera.rotation_increment = ctrlTool->GetRotationIncrement();
TRANSFER_SETTING( opengl_AA_disableOnMove, FL_RENDER_OPENGL_AA_DISABLE_ON_MOVE ); TRANSFER_SETTING( opengl_AA_disableOnMove, FL_RENDER_OPENGL_AA_DISABLE_ON_MOVE );
TRANSFER_SETTING( opengl_copper_thickness, FL_RENDER_OPENGL_COPPER_THICKNESS ); TRANSFER_SETTING( opengl_copper_thickness, FL_RENDER_OPENGL_COPPER_THICKNESS );
TRANSFER_SETTING( opengl_show_model_bbox, FL_RENDER_OPENGL_SHOW_MODEL_BBOX ); TRANSFER_SETTING( opengl_show_model_bbox, FL_RENDER_OPENGL_SHOW_MODEL_BBOX );

View File

@ -143,19 +143,19 @@ int EDA_3D_CONTROLLER::PanControl( const TOOL_EVENT& aEvent )
} }
#define ROT_ANGLE 10.0
int EDA_3D_CONTROLLER::RotateView( const TOOL_EVENT& aEvent ) int EDA_3D_CONTROLLER::RotateView( const TOOL_EVENT& aEvent )
{ {
double rotIncrement = glm::radians( m_rotationIncrement );
switch( aEvent.Parameter<intptr_t>() ) switch( aEvent.Parameter<intptr_t>() )
{ {
case ID_ROTATE3D_X_NEG: m_camera->RotateX( -glm::radians( ROT_ANGLE ) ); break; case ID_ROTATE3D_X_NEG: m_camera->RotateX( -rotIncrement ); break;
case ID_ROTATE3D_X_POS: m_camera->RotateX( glm::radians( ROT_ANGLE ) ); break; case ID_ROTATE3D_X_POS: m_camera->RotateX( rotIncrement ); break;
case ID_ROTATE3D_Y_NEG: m_camera->RotateY( -glm::radians( ROT_ANGLE ) ); break; case ID_ROTATE3D_Y_NEG: m_camera->RotateY( -rotIncrement ); break;
case ID_ROTATE3D_Y_POS: m_camera->RotateY( glm::radians( ROT_ANGLE ) ); break; case ID_ROTATE3D_Y_POS: m_camera->RotateY( rotIncrement ); break;
case ID_ROTATE3D_Z_NEG: m_camera->RotateZ( -glm::radians( ROT_ANGLE ) ); break; case ID_ROTATE3D_Z_NEG: m_camera->RotateZ( -rotIncrement ); break;
case ID_ROTATE3D_Z_POS: m_camera->RotateZ( glm::radians( ROT_ANGLE ) ); break; case ID_ROTATE3D_Z_POS: m_camera->RotateZ( rotIncrement ); break;
default: wxFAIL; break; default: wxFAIL; break;
} }
if( m_boardAdapter->RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY ) if( m_boardAdapter->RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )

View File

@ -39,11 +39,12 @@ class BOARD_ADAPTER;
class EDA_3D_CONTROLLER : public TOOL_INTERACTIVE class EDA_3D_CONTROLLER : public TOOL_INTERACTIVE
{ {
public: public:
EDA_3D_CONTROLLER() : EDA_3D_CONTROLLER()
TOOL_INTERACTIVE( "3DViewer.Control" ), : TOOL_INTERACTIVE( "3DViewer.Control" ),
m_canvas( nullptr ), m_canvas( nullptr ),
m_boardAdapter( nullptr ), m_boardAdapter( nullptr ),
m_camera( nullptr ) m_camera( nullptr ),
m_rotationIncrement( 10.0 )
{ } { }
~EDA_3D_CONTROLLER() override { } ~EDA_3D_CONTROLLER() override { }
@ -58,6 +59,26 @@ public:
int Main( const TOOL_EVENT& aEvent ); int Main( const TOOL_EVENT& aEvent );
/**
* Set the increment used by the RotateView actions.
*
* @param aRotIncrement is the rotation increment in degrees
*/
void SetRotationIncrement( double aRotIncrement )
{
m_rotationIncrement = aRotIncrement;
}
/**
* Get the increment used by the RotateView actions.
*
* @return the rotation increment in degrees
*/
double GetRotationIncrement()
{
return m_rotationIncrement;
}
// View controls // View controls
int ZoomRedraw( const TOOL_EVENT& aEvent ); int ZoomRedraw( const TOOL_EVENT& aEvent );
int ZoomInOut( const TOOL_EVENT& aEvent ); int ZoomInOut( const TOOL_EVENT& aEvent );
@ -83,6 +104,7 @@ private:
EDA_3D_CANVAS* m_canvas; EDA_3D_CANVAS* m_canvas;
BOARD_ADAPTER* m_boardAdapter; BOARD_ADAPTER* m_boardAdapter;
CCAMERA* m_camera; CCAMERA* m_camera;
double m_rotationIncrement; ///< Rotation increment for the rotate actions (degrees)
}; };
#endif #endif