Update 3D view immediately when user changes parameters.

The ray-tracer runs in the background so you can still change
other settings while it's redrawing.

Fixes: lp:1612419
* https://bugs.launchpad.net/kicad/+bug/1612419
This commit is contained in:
Jeff Young 2018-04-06 17:00:58 +01:00
parent e7ed415930
commit 0dc719ca1a
2 changed files with 30 additions and 33 deletions

View File

@ -54,9 +54,7 @@ void EDA_3D_VIEWER::Install3DViewOptionDialog( wxCommandEvent& event )
{ {
SetMenuBarOptionsState(); SetMenuBarOptionsState();
// Force immediate display redraw: NewDisplay( true );
ReloadRequest();
m_canvas->Request_refresh();
} }
} }

View File

@ -284,8 +284,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
break; break;
case ID_RELOAD3D_BOARD: case ID_RELOAD3D_BOARD:
ReloadRequest(); NewDisplay( true );
m_canvas->Request_refresh();
break; break;
case ID_ROTATE3D_X_POS: case ID_ROTATE3D_X_POS:
@ -351,7 +350,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY ) if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
m_canvas->Request_refresh(); m_canvas->Request_refresh();
else else
ReloadRequest(); NewDisplay( true );
} }
return; return;
@ -361,7 +360,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY ) if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
m_canvas->Request_refresh(); m_canvas->Request_refresh();
else else
ReloadRequest(); NewDisplay( true );
} }
return; return;
@ -392,27 +391,27 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
case ID_MENU3D_REALISTIC_MODE: case ID_MENU3D_REALISTIC_MODE:
m_settings.SetFlag( FL_USE_REALISTIC_MODE, isChecked ); m_settings.SetFlag( FL_USE_REALISTIC_MODE, isChecked );
SetMenuBarOptionsState(); SetMenuBarOptionsState();
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL: case ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL:
m_settings.MaterialModeSet( MATERIAL_MODE_NORMAL ); m_settings.MaterialModeSet( MATERIAL_MODE_NORMAL );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY: case ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY:
m_settings.MaterialModeSet( MATERIAL_MODE_DIFFUSE_ONLY ); m_settings.MaterialModeSet( MATERIAL_MODE_DIFFUSE_ONLY );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE: case ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE:
m_settings.MaterialModeSet( MATERIAL_MODE_CAD_MODE ); m_settings.MaterialModeSet( MATERIAL_MODE_CAD_MODE );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS: case ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS:
m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, isChecked ); m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, isChecked );
ReloadRequest(); NewDisplay( true );
return; return;
case ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX: case ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX:
@ -427,12 +426,12 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
case ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES: case ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES:
m_settings.SetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, isChecked ); m_settings.SetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_FL_RAYTRACING_BACKFLOOR: case ID_MENU3D_FL_RAYTRACING_BACKFLOOR:
m_settings.SetFlag( FL_RENDER_RAYTRACING_BACKFLOOR, isChecked ); m_settings.SetFlag( FL_RENDER_RAYTRACING_BACKFLOOR, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_FL_RAYTRACING_REFRACTIONS: case ID_MENU3D_FL_RAYTRACING_REFRACTIONS:
@ -447,7 +446,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
case ID_MENU3D_FL_RAYTRACING_POST_PROCESSING: case ID_MENU3D_FL_RAYTRACING_POST_PROCESSING:
m_settings.SetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING, isChecked ); m_settings.SetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING: case ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING:
@ -457,7 +456,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
case ID_MENU3D_SHOW_BOARD_BODY: case ID_MENU3D_SHOW_BOARD_BODY:
m_settings.SetFlag( FL_SHOW_BOARD_BODY, isChecked ); m_settings.SetFlag( FL_SHOW_BOARD_BODY, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_AXIS_ONOFF: case ID_MENU3D_AXIS_ONOFF:
@ -467,52 +466,52 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL: case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL:
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, isChecked ); m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL_INSERT: case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL_INSERT:
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, isChecked ); m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_VIRTUAL: case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_VIRTUAL:
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL, isChecked ); m_settings.SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_ZONE_ONOFF: case ID_MENU3D_ZONE_ONOFF:
m_settings.SetFlag( FL_ZONE, isChecked ); m_settings.SetFlag( FL_ZONE, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_ADHESIVE_ONOFF: case ID_MENU3D_ADHESIVE_ONOFF:
m_settings.SetFlag( FL_ADHESIVE, isChecked ); m_settings.SetFlag( FL_ADHESIVE, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_SILKSCREEN_ONOFF: case ID_MENU3D_SILKSCREEN_ONOFF:
m_settings.SetFlag( FL_SILKSCREEN, isChecked ); m_settings.SetFlag( FL_SILKSCREEN, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_SOLDER_MASK_ONOFF: case ID_MENU3D_SOLDER_MASK_ONOFF:
m_settings.SetFlag( FL_SOLDERMASK, isChecked ); m_settings.SetFlag( FL_SOLDERMASK, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_SOLDER_PASTE_ONOFF: case ID_MENU3D_SOLDER_PASTE_ONOFF:
m_settings.SetFlag( FL_SOLDERPASTE, isChecked ); m_settings.SetFlag( FL_SOLDERPASTE, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_COMMENTS_ONOFF: case ID_MENU3D_COMMENTS_ONOFF:
m_settings.SetFlag( FL_COMMENTS, isChecked ); m_settings.SetFlag( FL_COMMENTS, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_ECO_ONOFF: case ID_MENU3D_ECO_ONOFF:
m_settings.SetFlag( FL_ECO, isChecked ); m_settings.SetFlag( FL_ECO, isChecked );
ReloadRequest( ); NewDisplay( true );
return; return;
case ID_MENU3D_RESET_DEFAULTS: case ID_MENU3D_RESET_DEFAULTS:
@ -525,10 +524,10 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
// Refresh menu option state // Refresh menu option state
SetMenuBarOptionsState(); SetMenuBarOptionsState();
// Tell canvas that we (may) changed the render engine // Tell canvas that we (may have) changed the render engine
RenderEngineChanged(); RenderEngineChanged();
ReloadRequest(); NewDisplay( true );
} }
return; return;
@ -1050,7 +1049,7 @@ bool EDA_3D_VIEWER::Set3DSilkScreenColorFromUser()
&definedColors ); &definedColors );
if( change ) if( change )
NewDisplay(); NewDisplay( true );
return change; return change;
} }
@ -1086,7 +1085,7 @@ bool EDA_3D_VIEWER::Set3DSolderMaskColorFromUser()
&definedColors ); &definedColors );
if( change ) if( change )
NewDisplay(); NewDisplay( true );
return change; return change;
} }
@ -1112,7 +1111,7 @@ bool EDA_3D_VIEWER::Set3DCopperColorFromUser()
&definedColors ); &definedColors );
if( change ) if( change )
NewDisplay(); NewDisplay( true );
return change; return change;
} }
@ -1142,7 +1141,7 @@ bool EDA_3D_VIEWER::Set3DBoardBodyColorFromUser()
&definedColors ); &definedColors );
if( change ) if( change )
NewDisplay(); NewDisplay( true );
return change; return change;
} }
@ -1167,7 +1166,7 @@ bool EDA_3D_VIEWER::Set3DSolderPasteColorFromUser()
&definedColors ); &definedColors );
if( change ) if( change )
NewDisplay(); NewDisplay( true );
return change; return change;
} }