3D viewer: avoid recreating the 3D scene when not needed.

This commit is contained in:
jean-pierre charras 2021-07-21 11:14:00 +02:00
parent af90d47edc
commit 0525d50c58
2 changed files with 6 additions and 3 deletions

View File

@ -129,8 +129,7 @@ bool PANEL_3D_DISPLAY_OPTIONS::TransferDataFromWindow()
EDA_3D_CONTROLLER* ctrlTool = m_frame->GetToolManager()->GetTool<EDA_3D_CONTROLLER>(); EDA_3D_CONTROLLER* ctrlTool = m_frame->GetToolManager()->GetTool<EDA_3D_CONTROLLER>();
ctrlTool->SetRotationIncrement( m_spinCtrlRotationAngle->GetValue() ); ctrlTool->SetRotationIncrement( m_spinCtrlRotationAngle->GetValue() );
m_frame->NewDisplay(); // The 3D scene will be rebuilt by the caller
m_canvas->Request_refresh();
return true; return true;
} }

View File

@ -206,18 +206,22 @@ int EDA_3D_CONTROLLER::ToggleVisibility( const TOOL_EVENT& aEvent )
switch( flag ) switch( flag )
{ {
// These commands do not request a 3D scene rebuild:
case FL_RENDER_OPENGL_SHOW_MODEL_BBOX: case FL_RENDER_OPENGL_SHOW_MODEL_BBOX:
case FL_RENDER_RAYTRACING_SHADOWS: case FL_RENDER_RAYTRACING_SHADOWS:
case FL_RENDER_RAYTRACING_REFRACTIONS: case FL_RENDER_RAYTRACING_REFRACTIONS:
case FL_RENDER_RAYTRACING_REFLECTIONS: case FL_RENDER_RAYTRACING_REFLECTIONS:
case FL_RENDER_RAYTRACING_ANTI_ALIASING: case FL_RENDER_RAYTRACING_ANTI_ALIASING:
case FL_AXIS: case FL_AXIS:
case FL_FP_ATTRIBUTES_NORMAL:
case FL_FP_ATTRIBUTES_NORMAL_INSERT:
case FL_FP_ATTRIBUTES_VIRTUAL:
m_canvas->Request_refresh(); m_canvas->Request_refresh();
break; break;
default: default:
{ {
if( auto* viewer = dynamic_cast<EDA_3D_VIEWER_FRAME*>( m_toolMgr->GetToolHolder() ) ) if( auto viewer = dynamic_cast<EDA_3D_VIEWER_FRAME*>( m_toolMgr->GetToolHolder() ) )
viewer->NewDisplay( true ); viewer->NewDisplay( true );
else else
m_canvas->Request_refresh(); m_canvas->Request_refresh();