diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 26293f1086..5bb39f57fd 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -167,15 +167,28 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxS } +wxWindow* findQuasiModalDialog( wxWindow* aParent ) +{ + for( wxWindow* child : aParent->GetChildren() ) + { + if( DIALOG_SHIM* dlg = dynamic_cast( child ) ) + { + if( dlg->IsQuasiModal() ) + return dlg; + + if( wxWindow* nestedDlg = findQuasiModalDialog( child ) ) + return nestedDlg; + } + } + + return nullptr; +} + + wxWindow* EDA_BASE_FRAME::findQuasiModalDialog() { - for( wxWindow* iter : GetChildren() ) - { - DIALOG_SHIM* dlg = dynamic_cast( iter ); - - if( dlg && dlg->IsQuasiModal() ) - return dlg; - } + if( wxWindow* dlg = ::findQuasiModalDialog( this ) ) + return dlg; // FIXME: CvPcb is currently implemented on top of KIWAY_PLAYER rather than DIALOG_SHIM, // so we have to look for it separately. diff --git a/pcbnew/dialogs/panel_fp_properties_3d_model.cpp b/pcbnew/dialogs/panel_fp_properties_3d_model.cpp index db58f5438f..4e20eaaa27 100644 --- a/pcbnew/dialogs/panel_fp_properties_3d_model.cpp +++ b/pcbnew/dialogs/panel_fp_properties_3d_model.cpp @@ -308,7 +308,7 @@ void PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DModel( wxCommandEvent& ) filter = (int) tmp; } - if( !S3D::Select3DModel( this, m_frame->Prj().Get3DCacheManager(), initialpath, filter, &model ) + if( !S3D::Select3DModel( m_parentDialog, m_frame->Prj().Get3DCacheManager(), initialpath, filter, &model ) || model.m_Filename.empty() ) { select3DModel( selected );