From c5a9479953aa4189f5d81b841d79c2347ddb4e57 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Wed, 22 Jan 2020 22:48:20 +0000 Subject: [PATCH] Only get 3D viewer colors when launched from the PCb editor When launched from CVPCB or the footprint editor/viewer the stackup isn't user-editable, so it just gives its default colors. --- .../3d_render_raytracing/c3d_render_createscene.cpp | 3 ++- 3d-viewer/3d_viewer/3d_menubar.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp index 15291a8749..92fec05f69 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp @@ -677,11 +677,12 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter ) SFVEC3F layerColor; if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) ) - + { if( layer_id == B_Mask ) layerColor = m_settings.m_SolderMaskColorBot; else layerColor = m_settings.m_SolderMaskColorTop; + } else layerColor = m_settings.GetLayerColor( layer_id ); diff --git a/3d-viewer/3d_viewer/3d_menubar.cpp b/3d-viewer/3d_viewer/3d_menubar.cpp index 0b1e489cd1..fd310fdc86 100644 --- a/3d-viewer/3d_viewer/3d_menubar.cpp +++ b/3d-viewer/3d_viewer/3d_menubar.cpp @@ -308,8 +308,12 @@ void EDA_3D_VIEWER::CreateMenuBar() colorSubmenu->AddItem( ID_MENU3D_PCB_BODY_COLOR, _( "Board Body Color..." ), "", setcolor_board_body_xpm, SELECTION_CONDITIONS::ShowAlways ); - colorSubmenu->AddItem( ID_MENU3D_STACKUP_COLORS, _( "Get colors from physical stackup" ), "", - nullptr, SELECTION_CONDITIONS::ShowAlways ); + // Only allow the stackup to be used in the PCB editor, since it isn't editable in the other frames + if( Parent()->IsType( FRAME_PCB_EDITOR ) ) + { + colorSubmenu->AddItem( ID_MENU3D_STACKUP_COLORS, _( "Get colors from physical stackup" ), "", + nullptr, SELECTION_CONDITIONS::ShowAlways ); + } prefsMenu->AddMenu( colorSubmenu );