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 );

View File

@ -14,7 +14,6 @@
<property name="file">dialog_3D_view_option_base</property> <property name="file">dialog_3D_view_option_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property> <property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">dialog_3D_view_option_base</property> <property name="name">dialog_3D_view_option_base</property>
@ -26,7 +25,6 @@
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property> <property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property> <property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
@ -47,7 +45,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DIALOG_3D_VIEW_OPTIONS_BASE</property> <property name="name">DIALOG_3D_VIEW_OPTIONS_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">659,485</property> <property name="size">659,567</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">3D Display Options</property> <property name="title">3D Display Options</property>
@ -186,11 +184,11 @@
<property name="name">bSizeLeft</property> <property name="name">bSizeLeft</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Render Options</property> <property name="label">Render Options</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -765,11 +763,11 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">3D Model Visibility</property> <property name="label">3D Model Visibility</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -1266,19 +1264,19 @@
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Board Layers</property> <property name="label">Board Layers</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">sbSizer3</property> <property name="name">sbBoardLayers</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="0"> <object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property> <property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property> <property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property> <property name="growablecols"></property>
@ -1830,7 +1828,7 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">User Layers (not shown in realistic mode)</property> <property name="label">User Layers (not shown in realistic mode)</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">sbSizer4</property> <property name="name">sbUserLayers</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
@ -2126,10 +2124,265 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Camera Options</property> <property name="label">Camera Options</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">sbSizerAnimation</property> <property name="name">sbCameraOptions</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerRotAngle</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Rotation Increment:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextRotAngle</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxSpinCtrlDouble" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="digits">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="inc">1</property>
<property name="initial">10</property>
<property name="max">359</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_spinCtrlRotationAngle</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxSP_ARROW_KEYS</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">deg</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextRotAngleUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline3</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL</property> <property name="flag">wxALL</property>

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