3d_viewer: Added Animation Speed option

ADDED: Option to set the speed of and enable/disable 3d viewer animations
This commit is contained in:
Emery Burhan 2020-04-24 23:58:50 +00:00 committed by Ian McInerney
parent 5a4e4aea67
commit e20e45fa54
10 changed files with 4030 additions and 3651 deletions

View File

@ -117,6 +117,8 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList, BOARD*
m_camera_is_moving = false;
m_render_pivot = false;
m_camera_moving_speed = 1.0f;
m_animation_enabled = true;
m_moving_speed_multiplier = 3;
m_strtime_camera_movement = 0;
@ -756,6 +758,19 @@ void EDA_3D_CANVAS::request_start_moving_camera( float aMovingSpeed, bool aRende
{
wxASSERT( aMovingSpeed > FLT_EPSILON );
// Fast forward the animation if the animation is disabled
if( !m_animation_enabled )
{
m_camera.Interpolate( 1.0f );
DisplayStatus();
Request_refresh();
return;
}
// Map speed multipler option to actual multiplier value
// [1,2,3,4,5] -> [0.25, 0.5, 1, 2, 4]
aMovingSpeed *= ( 1 << m_moving_speed_multiplier ) / 8.0f;
m_render_pivot = aRenderPivot;
m_camera_moving_speed = aMovingSpeed;

View File

@ -102,6 +102,30 @@ class EDA_3D_CANVAS : public HIDPI_GL_CANVAS
*/
bool SetView3D( int aKeycode );
/**
* @brief AnimationEnabledSet - Enable or disable camera animation when switching to a pre-defined view
* @param aAnimationEnabled: Animation enabled state to set
*/
void AnimationEnabledSet( bool aAnimationEnabled ) { m_animation_enabled = aAnimationEnabled; }
/**
* @brief AnimationEnabledGet - Returns whether camera animation is enabled when switching to a pre-defined view
* @return true if animation is enabled
*/
bool AnimationEnabledGet() const { return m_animation_enabled; }
/**
* @brief MovingSpeedMultiplierSet - Set the camera animation moving speed multiplier option
* @param aMovingSpeedMultiplier: One of the possible integer options: [1,2,3,4,5]
*/
void MovingSpeedMultiplierSet( int aMovingSpeedMultiplier ) { m_moving_speed_multiplier = aMovingSpeedMultiplier; }
/**
* @brief MovingSpeedMultiplierGet - Return the current camera animation moving speed multiplier option
* @return current moving speed multiplier option, one of [1,2,3,4,5]
*/
int MovingSpeedMultiplierGet() const { return m_moving_speed_multiplier; }
/**
* @brief RenderEngineChanged - Notify that the render engine was changed
*/
@ -208,6 +232,8 @@ private:
bool m_render_pivot; // Render the pivot while camera moving
float m_camera_moving_speed; // 1.0f will be 1:1
unsigned m_strtime_camera_movement; // Ticktime of camera movement start
bool m_animation_enabled; // Camera animation enabled
int m_moving_speed_multiplier; // Camera animation speed multiplier option
BOARD_ADAPTER& m_boardAdapter; // Pre-computed 3D info and settings
CCAMERA& m_camera;

View File

@ -110,6 +110,12 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "render.show_zones", &m_Render.show_zones, true ) );
m_params.emplace_back( new PARAM<bool>( "render.subtract_mask_from_silk",
&m_Render.subtract_mask_from_silk, false ) );
m_params.emplace_back( new PARAM<bool>( "camera.animation_enabled",
&m_Camera.animation_enabled, true ) );
m_params.emplace_back( new PARAM<int>( "camera.moving_speed_multiplier",
&m_Camera.moving_speed_multiplier, 3 ) );
}

View File

@ -64,6 +64,12 @@ public:
bool subtract_mask_from_silk;
};
struct CAMERA_SETTINGS
{
bool animation_enabled;
int moving_speed_multiplier;
};
EDA_3D_VIEWER_SETTINGS();
virtual ~EDA_3D_VIEWER_SETTINGS() {}
@ -71,6 +77,7 @@ public:
virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
RENDER_SETTINGS m_Render;
CAMERA_SETTINGS m_Camera;
protected:

View File

@ -34,9 +34,12 @@ public:
private:
BOARD_ADAPTER& m_settings;
EDA_3D_CANVAS* m_canvas;
void initDialog();
void OnCheckEnableAnimation( wxCommandEvent& WXUNUSED( event ) ) override;
/// Automatically called when clicking on the OK button
bool TransferDataFromWindow() override;
@ -58,7 +61,8 @@ void EDA_3D_VIEWER::Install3DViewOptionDialog( wxCommandEvent& event )
DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_VIEWER* aParent ) :
DIALOG_3D_VIEW_OPTIONS_BASE( aParent ),
m_settings( aParent->GetAdapter() )
m_settings( aParent->GetAdapter() ),
m_canvas( aParent->GetCanvas() )
{
initDialog();
@ -88,6 +92,11 @@ void DIALOG_3D_VIEW_OPTIONS::initDialog()
m_bitmapSubtractMaskFromSilk->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
}
void DIALOG_3D_VIEW_OPTIONS::OnCheckEnableAnimation( wxCommandEvent& event )
{
m_staticAnimationSpeed->Enable( m_checkBoxEnableAnimation->GetValue() );
m_sliderAnimationSpeed->Enable( m_checkBoxEnableAnimation->GetValue() );
}
bool DIALOG_3D_VIEW_OPTIONS::TransferDataToWindow()
{
@ -126,6 +135,12 @@ bool DIALOG_3D_VIEW_OPTIONS::TransferDataToWindow()
m_checkBoxRaytracing_antiAliasing->SetValue( m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING ) );
m_checkBoxRaytracing_proceduralTextures->SetValue( m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) );
// Camera Options
m_checkBoxEnableAnimation->SetValue( m_canvas->AnimationEnabledGet() );
m_sliderAnimationSpeed->SetValue( m_canvas->MovingSpeedMultiplierGet() );
m_staticAnimationSpeed->Enable( m_canvas->AnimationEnabledGet() );
m_sliderAnimationSpeed->Enable( m_canvas->AnimationEnabledGet() );
return true;
}
@ -171,5 +186,9 @@ bool DIALOG_3D_VIEW_OPTIONS::TransferDataFromWindow()
m_settings.SetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING, m_checkBoxRaytracing_antiAliasing->GetValue() );
m_settings.SetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, m_checkBoxRaytracing_proceduralTextures->GetValue() );
// Camera Options
m_canvas->AnimationEnabledSet( m_checkBoxEnableAnimation->GetValue() );
m_canvas->MovingSpeedMultiplierSet( m_sliderAnimationSpeed->GetValue() );
return true;
}

View File

@ -25,7 +25,7 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
bSizeLeft = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("Render options") ), wxVERTICAL );
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("Render Options") ), wxVERTICAL );
wxFlexGridSizer* fgSizerRenderOptions;
fgSizerRenderOptions = new wxFlexGridSizer( 0, 3, 0, 0 );
@ -80,10 +80,10 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
sbSizer1->Add( fgSizerRenderOptions, 0, wxEXPAND|wxBOTTOM, 5 );
bSizeLeft->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 );
bSizeLeft->Add( sbSizer1, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("3D model visibility") ), wxVERTICAL );
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("3D Model Visibility") ), wxVERTICAL );
wxFlexGridSizer* fgSizer3DVisibility;
fgSizer3DVisibility = new wxFlexGridSizer( 0, 3, 0, 0 );
@ -133,7 +133,7 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
bSizerRight = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer3;
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("Board layers") ), wxVERTICAL );
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("Board Layers") ), wxVERTICAL );
wxFlexGridSizer* fgSizerShowBrdLayersOpts;
fgSizerShowBrdLayersOpts = new wxFlexGridSizer( 0, 3, 0, 0 );
@ -180,10 +180,10 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
sbSizer3->Add( fgSizerShowBrdLayersOpts, 0, wxEXPAND, 5 );
bSizerRight->Add( sbSizer3, 1, wxALL|wxEXPAND, 5 );
bSizerRight->Add( sbSizer3, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer4;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("User layers (not shown in realistic mode)") ), wxVERTICAL );
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("User Layers (not shown in realistic mode)") ), wxVERTICAL );
wxFlexGridSizer* fgSizerShowUserLayersOpts;
fgSizerShowUserLayersOpts = new wxFlexGridSizer( 0, 3, 0, 0 );
@ -212,10 +212,46 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
sbSizer4->Add( fgSizerShowUserLayersOpts, 0, wxEXPAND, 5 );
bSizerRight->Add( sbSizer4, 1, wxALL|wxEXPAND, 5 );
bSizerRight->Add( sbSizer4, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer41;
sbSizer41 = new wxStaticBoxSizer( new wxStaticBox( m_panelDspOpt, wxID_ANY, _("Camera Options") ), wxVERTICAL );
wxFlexGridSizer* fgSizerCameraOpts;
fgSizerCameraOpts = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizerCameraOpts->SetFlexibleDirection( wxBOTH );
fgSizerCameraOpts->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
bSizerDisplayOptions->Add( bSizerRight, 1, wxALL|wxEXPAND, 5 );
fgSizerCameraOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_checkBoxEnableAnimation = new wxCheckBox( sbSizer41->GetStaticBox(), wxID_ANY, _("Enable animation"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerCameraOpts->Add( m_checkBoxEnableAnimation, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerCameraOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
m_staticAnimationSpeed = new wxStaticText( sbSizer41->GetStaticBox(), wxID_ANY, _("Animation speed:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticAnimationSpeed->Wrap( -1 );
bSizer9->Add( m_staticAnimationSpeed, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_sliderAnimationSpeed = new wxSlider( sbSizer41->GetStaticBox(), wxID_ANY, 3, 1, 5, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_MIN_MAX_LABELS );
bSizer9->Add( m_sliderAnimationSpeed, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
fgSizerCameraOpts->Add( bSizer9, 1, wxEXPAND, 5 );
sbSizer41->Add( fgSizerCameraOpts, 0, wxEXPAND, 5 );
bSizerRight->Add( sbSizer41, 1, wxALL|wxEXPAND, 5 );
bSizerDisplayOptions->Add( bSizerRight, 0, wxALL|wxEXPAND, 5 );
m_panelDspOpt->SetSizer( bSizerDisplayOptions );
@ -230,7 +266,7 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
bSizer7 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerOpenGLRenderoptions;
sbSizerOpenGLRenderoptions = new wxStaticBoxSizer( new wxStaticBox( m_panelOpenGL, wxID_ANY, _("OpenGL Render options") ), wxVERTICAL );
sbSizerOpenGLRenderoptions = new wxStaticBoxSizer( new wxStaticBox( m_panelOpenGL, wxID_ANY, _("OpenGL Render Options") ), wxVERTICAL );
wxFlexGridSizer* fgSizer6;
fgSizer6 = new wxFlexGridSizer( 2, 3, 0, 0 );
@ -340,7 +376,7 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
bSizer8 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerRaytracingRenderOptions;
sbSizerRaytracingRenderOptions = new wxStaticBoxSizer( new wxStaticBox( m_panelRaytracing, wxID_ANY, _("Raytracing Render options") ), wxVERTICAL );
sbSizerRaytracingRenderOptions = new wxStaticBoxSizer( new wxStaticBox( m_panelRaytracing, wxID_ANY, _("Raytracing Render Options") ), wxVERTICAL );
wxFlexGridSizer* fgSizer9;
fgSizer9 = new wxFlexGridSizer( 4, 4, 0, 0 );
@ -350,21 +386,21 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
fgSizer9->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 );
m_checkBoxRaytracing_renderShadows = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Render Shadows"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_renderShadows = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Shadows"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_renderShadows->SetValue(true);
fgSizer9->Add( m_checkBoxRaytracing_renderShadows, 0, wxALL, 5 );
fgSizer9->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 );
m_checkBoxRaytracing_proceduralTextures = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Procedural Textures"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_proceduralTextures = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Procedural textures"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_proceduralTextures->SetValue(true);
fgSizer9->Add( m_checkBoxRaytracing_proceduralTextures, 0, wxALL, 5 );
fgSizer9->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 );
m_checkBoxRaytracing_addFloor = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Add Floor"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_addFloor = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Add floor"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRaytracing_addFloor->SetValue(true);
fgSizer9->Add( m_checkBoxRaytracing_addFloor, 0, wxALL, 5 );
@ -428,17 +464,18 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH );
// Connect Events
m_checkBoxRealisticMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
m_checkBoxEnableAnimation->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckEnableAnimation ), NULL, this );
}
DIALOG_3D_VIEW_OPTIONS_BASE::~DIALOG_3D_VIEW_OPTIONS_BASE()
{
// Disconnect Events
m_checkBoxRealisticMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
m_checkBoxEnableAnimation->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckEnableAnimation ), NULL, this );
}

View File

@ -45,7 +45,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_3D_VIEW_OPTIONS_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">659,475</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">3D Display Options</property>
@ -179,7 +179,7 @@
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizeLeft</property>
<property name="orient">wxVERTICAL</property>
@ -187,10 +187,10 @@
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0">
<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="name">sbSizer1</property>
<property name="orient">wxVERTICAL</property>
@ -769,7 +769,7 @@
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="0">
<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="name">sbSizer2</property>
<property name="orient">wxVERTICAL</property>
@ -1254,19 +1254,19 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0">
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerRight</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0">
<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="name">sbSizer3</property>
<property name="orient">wxVERTICAL</property>
@ -1820,23 +1820,23 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="0">
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<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="name">sbSizer4</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="0">
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
@ -2116,6 +2116,260 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Camera Options</property>
<property name="minimum_size"></property>
<property name="name">sbSizer41</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">fgSizerCameraOpts</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="0">
<property name="border">10</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<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="checked">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">Enable animation</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_checkBoxEnableAnimation</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"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">OnCheckEnableAnimation</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">10</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<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">bSizer9</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|wxALIGN_RIGHT|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">Animation speed:</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_staticAnimationSpeed</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="wxSlider" 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="maxValue">5</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minValue">1</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_sliderAnimationSpeed</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">wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_MIN_MAX_LABELS</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">3</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
@ -2125,7 +2379,7 @@
<property name="bitmap"></property>
<property name="label">OpenGL</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<object class="wxPanel" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -2176,12 +2430,12 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizerOpenGL</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
@ -2196,7 +2450,7 @@
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property>
<property name="label">OpenGL Render options</property>
<property name="label">OpenGL Render Options</property>
<property name="minimum_size"></property>
<property name="name">sbSizerOpenGLRenderoptions</property>
<property name="orient">wxVERTICAL</property>
@ -2929,7 +3183,7 @@
<property name="bitmap"></property>
<property name="label">Raytracing</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<object class="wxPanel" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -2980,27 +3234,27 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizerRaytracing</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer8</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property>
<property name="label">Raytracing Render options</property>
<property name="label">Raytracing Render Options</property>
<property name="minimum_size"></property>
<property name="name">sbSizerRaytracingRenderOptions</property>
<property name="orient">wxVERTICAL</property>
@ -3065,7 +3319,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Render Shadows</property>
<property name="label">Shadows</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -3139,7 +3393,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Procedural Textures</property>
<property name="label">Procedural textures</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -3213,7 +3467,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Add Floor</property>
<property name="label">Add floor</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>

View File

@ -24,6 +24,8 @@
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/slider.h>
#include <wx/panel.h>
#include <wx/choice.h>
#include <wx/notebook.h>
@ -70,6 +72,9 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_checkBoxComments;
wxStaticBitmap* m_bitmapECO;
wxCheckBox* m_checkBoxECO;
wxCheckBox* m_checkBoxEnableAnimation;
wxStaticText* m_staticAnimationSpeed;
wxSlider* m_sliderAnimationSpeed;
wxPanel* m_panelOpenGL;
wxStaticBitmap* m_bitmapBoundingBoxes;
wxCheckBox* m_checkBoxBoundingBoxes;
@ -95,11 +100,12 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual void OnCheckRealisticMode( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCheckEnableAnimation( wxCommandEvent& event ) { event.Skip(); }
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( -1,-1 ), 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,475 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_3D_VIEW_OPTIONS_BASE();
};

View File

@ -102,8 +102,6 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxSt
icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
SetIcon( icon );
auto config = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
LoadSettings( config );
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
// Create the status line
@ -119,6 +117,9 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxSt
if( m_canvas )
m_canvas->SetStatusBar( status_bar );
auto config = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
LoadSettings( config );
// Some settings need the canvas
loadCommonSettings();
@ -450,6 +451,9 @@ void EDA_3D_VIEWER::LoadSettings( APP_SETTINGS_BASE *aCfg )
m_boardAdapter.MaterialModeSet( static_cast<MATERIAL_MODE>( cfg->m_Render.material_mode ) );
m_canvas->AnimationEnabledSet( cfg->m_Camera.animation_enabled );
m_canvas->MovingSpeedMultiplierSet( cfg->m_Camera.moving_speed_multiplier );
#undef TRANSFER_SETTING
}
}
@ -492,6 +496,9 @@ void EDA_3D_VIEWER::SaveSettings( APP_SETTINGS_BASE *aCfg )
cfg->m_Render.material_mode = static_cast<int>( m_boardAdapter.MaterialModeGet() );
cfg->m_Render.opengl_AA_mode = static_cast<int>( m_boardAdapter.AntiAliasingGet() );
cfg->m_Camera.animation_enabled = m_canvas->AnimationEnabledGet();
cfg->m_Camera.moving_speed_multiplier = m_canvas->MovingSpeedMultiplierGet();
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_show_model_bbox, FL_RENDER_OPENGL_SHOW_MODEL_BBOX );

View File

@ -105,6 +105,8 @@ class EDA_3D_VIEWER : public EDA_3D_BOARD_HOLDER, public KIWAY_PLAYER
BOARD_ADAPTER& GetAdapter() override { return m_boardAdapter; }
CCAMERA& GetCurrentCamera() override { return m_currentCamera; }
EDA_3D_CANVAS* GetCanvas() { return m_canvas; }
/**
* Get a SFVEC3D from a wx colour dialog
* @param aColor is the SFVEC3D to change