From 7a5ae8bd5c25a2925eeaaf90ab13392e4c319708 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Tue, 4 Mar 2025 20:31:39 +0100 Subject: [PATCH 1/3] Gui: Create light sources parameter group * categorizes light sources into its own group * fixes config file issues between 1.0 and 1.1 --- .../PreferencePages/DlgSettingsLightSources.h | 2 +- src/Gui/View3DSettings.cpp | 31 ++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) 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..9976e29da9 100644 --- a/src/Gui/View3DSettings.cpp +++ b/src/Gui/View3DSettings.cpp @@ -94,20 +94,23 @@ 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"); + OnChange(*hGrp,"NavigationStyle"); OnChange(*hGrp,"OrbitStyle"); OnChange(*hGrp,"Sensitivity"); From 71cac77a599630c0e2f1f91aad9e775d14f0cbb0 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Tue, 4 Mar 2025 20:31:52 +0100 Subject: [PATCH 2/3] Gui: Remove unused static function --- src/Gui/PreferencePages/DlgSettingsLightSources.cpp | 7 ------- 1 file changed, 7 deletions(-) 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) From 6a226c946996b369aa4bf3d5c49c2612983da91c Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Tue, 4 Mar 2025 21:00:51 +0100 Subject: [PATCH 3/3] Gui: Workaround for lighting issue --- src/Gui/View3DSettings.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Gui/View3DSettings.cpp b/src/Gui/View3DSettings.cpp index 9976e29da9..b625158f0d 100644 --- a/src/Gui/View3DSettings.cpp +++ b/src/Gui/View3DSettings.cpp @@ -111,6 +111,29 @@ void View3DSettings::applySettings() 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");