diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp
index de78bc4b1b..153bb37ca2 100644
--- a/common/eda_base_frame.cpp
+++ b/common/eda_base_frame.cpp
@@ -168,15 +168,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<DIALOG_SHIM*>( 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<DIALOG_SHIM*>( 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 );