Setup 3D canvas for Footprint Chooser previews.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17910
This commit is contained in:
parent
6f0a1ade01
commit
3be6d5c5de
|
@ -143,6 +143,9 @@ DIALOG_FOOTPRINT_CHOOSER::DIALOG_FOOTPRINT_CHOOSER( PCB_BASE_FRAME* aParent,
|
|||
|
||||
DIALOG_FOOTPRINT_CHOOSER::~DIALOG_FOOTPRINT_CHOOSER()
|
||||
{
|
||||
if( m_boardAdapter.m_Cfg )
|
||||
m_boardAdapter.m_Cfg->m_Render = m_initialRender;
|
||||
|
||||
// Disconnect Events
|
||||
m_grButton3DView->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
wxCommandEventHandler( DIALOG_FOOTPRINT_CHOOSER::on3DviewReq ), NULL, this );
|
||||
|
@ -166,8 +169,6 @@ void DIALOG_FOOTPRINT_CHOOSER::build3DCanvas()
|
|||
m_boardAdapter.SetBoard( m_dummyBoard );
|
||||
m_boardAdapter.m_IsBoardView = false;
|
||||
m_boardAdapter.m_IsPreviewer = true; // Force display 3D models, regardless the 3D viewer options
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
|
||||
m_boardAdapter.m_Cfg = cfg;
|
||||
|
||||
// Build the 3D canvas
|
||||
|
||||
|
@ -176,6 +177,37 @@ void DIALOG_FOOTPRINT_CHOOSER::build3DCanvas()
|
|||
m_boardAdapter, m_currentCamera,
|
||||
PROJECT_PCB::Get3DCacheManager( &m_parent->Prj() ) );
|
||||
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
||||
m_preview3DCanvas->SetScaleFactor( dpi.GetScaleFactor() );
|
||||
|
||||
// TODO(JE) use all control options
|
||||
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
||||
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
// Save the 3D viewer render settings, to restore it after closing the preview
|
||||
m_initialRender = cfg->m_Render;
|
||||
|
||||
m_boardAdapter.m_Cfg = cfg;
|
||||
|
||||
m_preview3DCanvas->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
|
||||
m_preview3DCanvas->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
|
||||
m_preview3DCanvas->SetProjectionMode( cfg->m_Camera.projection_mode );
|
||||
|
||||
// Ensure the board body is always shown, and do not use the settings of the 3D viewer
|
||||
cfg->m_Render.show_copper_top = true;
|
||||
cfg->m_Render.show_copper_bottom = true;
|
||||
cfg->m_Render.show_soldermask_top = true;
|
||||
cfg->m_Render.show_soldermask_bottom = true;
|
||||
cfg->m_Render.show_solderpaste = true;
|
||||
cfg->m_Render.show_zones = true;
|
||||
cfg->m_Render.show_board_body = true;
|
||||
}
|
||||
|
||||
m_chooserPanel->m_RightPanelSizer->Add( m_preview3DCanvas, 1, wxEXPAND, 5 );
|
||||
m_chooserPanel->m_RightPanel->Layout();
|
||||
|
||||
|
|
|
@ -74,6 +74,9 @@ private:
|
|||
BOARD* m_dummyBoard;
|
||||
BITMAP_BUTTON* m_grButtonFpView;
|
||||
BITMAP_BUTTON* m_grButton3DView;
|
||||
|
||||
/// The 3d viewer Render initial settings (must be saved and restored)
|
||||
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender;
|
||||
};
|
||||
|
||||
#endif /* DIALOG_FOOTPRINT_CHOOSER_H */
|
||||
|
|
Loading…
Reference in New Issue