From e5182dd74926d82101f0fafbc5f5d0304bb429e3 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 27 Oct 2022 11:34:11 +0200 Subject: [PATCH] Fixes in 3D viewer Fixes #12769 https://gitlab.com/kicad/code/kicad/issues/12769 Fixes #12765 https://gitlab.com/kicad/code/kicad/issues/12765 --- 3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp | 3 ++- 3d-viewer/3d_viewer/eda_3d_viewer_frame.h | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp index 5b608709d3..f755c280a1 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp @@ -470,7 +470,7 @@ void EDA_3D_VIEWER_FRAME::applyViewport( const wxString& aViewportName ) { int idx = m_cbViewports->FindString( aViewportName ); - if( idx >= 0 && m_cbViewports->GetSelection() != idx ) + if( idx >= 0 ) { m_cbViewports->SetSelection( idx ); m_lastSelectedViewport = static_cast( m_cbViewports->GetClientData( idx ) ); @@ -538,6 +538,7 @@ void EDA_3D_VIEWER_FRAME::onViewportChanged( wxCommandEvent& aEvent ) else { index = m_cbViewports->FindString( name ); + m_viewports[name].matrix = m_currentCamera.GetViewMatrix(); m_viewportMRU.Remove( name ); } diff --git a/3d-viewer/3d_viewer/eda_3d_viewer_frame.h b/3d-viewer/3d_viewer/eda_3d_viewer_frame.h index 9b85ad2884..ba7a110e61 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer_frame.h +++ b/3d-viewer/3d_viewer/eda_3d_viewer_frame.h @@ -125,6 +125,10 @@ protected: void handleIconizeEvent( wxIconizeEvent& aEvent ) override; + /** + * switch to a given predefined 3D viewport + * @param aViewportName is the name of the viewport to switch on + */ void applyViewport( const wxString& aViewportName ); private: