diff --git a/src/Gui/PreferencePages/DlgSettingsLightSources.cpp b/src/Gui/PreferencePages/DlgSettingsLightSources.cpp index 034017a009..3f6bddce8c 100644 --- a/src/Gui/PreferencePages/DlgSettingsLightSources.cpp +++ b/src/Gui/PreferencePages/DlgSettingsLightSources.cpp @@ -48,13 +48,6 @@ using namespace Gui::Dialog; /* TRANSLATOR Gui::Dialog::DlgSettingsLightSources */ -static inline SbVec3f getDirectionVector(const SbRotation& rotation) -{ - SbVec3f dir {0.0f, 0.0f, -1.0f}; - rotation.multVec(dir, dir); - return dir; -} - DlgSettingsLightSources::DlgSettingsLightSources(QWidget* parent) : PreferencePage(parent) , ui(new Ui_DlgSettingsLightSources) diff --git a/src/Gui/PreferencePages/DlgSettingsLightSources.h b/src/Gui/PreferencePages/DlgSettingsLightSources.h index 2e1e1bd9de..4bbbc28d65 100644 --- a/src/Gui/PreferencePages/DlgSettingsLightSources.h +++ b/src/Gui/PreferencePages/DlgSettingsLightSources.h @@ -77,7 +77,7 @@ private: QPointer view; SoOrthographicCamera *camera = nullptr; - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View/LightSources"); float zoomStep = 3.0f; }; diff --git a/src/Gui/View3DSettings.cpp b/src/Gui/View3DSettings.cpp index 1163436c53..b625158f0d 100644 --- a/src/Gui/View3DSettings.cpp +++ b/src/Gui/View3DSettings.cpp @@ -94,20 +94,46 @@ void View3DSettings::applySettings() OnChange(*hGrp,"UseVBO"); OnChange(*hGrp,"RenderCache"); OnChange(*hGrp,"Orthographic"); - OnChange(*hGrp,"EnableHeadlight"); - OnChange(*hGrp,"HeadlightColor"); - OnChange(*hGrp,"HeadlightDirection"); - OnChange(*hGrp,"HeadlightIntensity"); - OnChange(*hGrp,"EnableBacklight"); - OnChange(*hGrp,"BacklightColor"); - OnChange(*hGrp,"BacklightDirection"); - OnChange(*hGrp,"BacklightIntensity"); - OnChange(*hGrp,"EnableFillLight"); - OnChange(*hGrp,"FillLightColor"); - OnChange(*hGrp,"FillLightDirection"); - OnChange(*hGrp,"FillLightIntensity"); - OnChange(*hGrp,"AmbientLightColor"); - OnChange(*hGrp,"AmbientLightIntensity"); + + auto lightSourcesGrp = hGrp->GetGroup("LightSources"); + OnChange(*lightSourcesGrp,"EnableHeadlight"); + OnChange(*lightSourcesGrp,"HeadlightColor"); + OnChange(*lightSourcesGrp,"HeadlightDirection"); + OnChange(*lightSourcesGrp,"HeadlightIntensity"); + OnChange(*lightSourcesGrp,"EnableBacklight"); + OnChange(*lightSourcesGrp,"BacklightColor"); + OnChange(*lightSourcesGrp,"BacklightDirection"); + OnChange(*lightSourcesGrp,"BacklightIntensity"); + OnChange(*lightSourcesGrp,"EnableFillLight"); + OnChange(*lightSourcesGrp,"FillLightColor"); + OnChange(*lightSourcesGrp,"FillLightDirection"); + OnChange(*lightSourcesGrp,"FillLightIntensity"); + OnChange(*lightSourcesGrp,"AmbientLightColor"); + OnChange(*lightSourcesGrp,"AmbientLightIntensity"); + + // Workaround + // Clear old settings that was used for a while in 1.1dev + // By clearing these settings, 1.0 will be able to run with same config file again + // For more info: https://github.com/FreeCAD/FreeCAD/issues/19880 + // TODO: Remove when 1.1.0 is about to be released + if (hGrp->GetASCII("FillLightDirection").empty()) { + hGrp->RemoveBool("EnableHeadlight"); + hGrp->RemoveUnsigned("HeadlightColor"); + hGrp->RemoveASCII("HeadlightDirection"); + hGrp->RemoveInt("HeadlightIntensity"); + hGrp->RemoveBool("EnableBacklight"); + hGrp->RemoveUnsigned("BacklightColor"); + hGrp->RemoveASCII("BacklightDirection"); + hGrp->RemoveInt("BacklightIntensity"); + hGrp->RemoveBool("EnableFillLight"); + hGrp->RemoveUnsigned("FillLightColor"); + hGrp->RemoveASCII("FillLightDirection"); + hGrp->RemoveInt("FillLightIntensity"); + hGrp->RemoveUnsigned("AmbientLightColor"); + hGrp->RemoveInt("AmbientLightIntensity"); + } + // End of workaround + OnChange(*hGrp,"NavigationStyle"); OnChange(*hGrp,"OrbitStyle"); OnChange(*hGrp,"Sensitivity");