From 7979412c7566b327748a622f5679369469baba08 Mon Sep 17 00:00:00 2001 From: Sofox Date: Wed, 13 Dec 2023 20:05:20 +0000 Subject: [PATCH] Remember last 'color_mode' and 'picker_shape' in 'ColorPicker's in the editor --- editor/editor_node.cpp | 5 +++-- scene/gui/color_picker.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 6e30980852c..181b9a4890e 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3701,8 +3701,9 @@ void EditorNode::_set_current_scene_nocheck(int p_idx) { void EditorNode::setup_color_picker(ColorPicker *p_picker) { p_picker->set_editor_settings(EditorSettings::get_singleton()); - int default_color_mode = EDITOR_GET("interface/inspector/default_color_picker_mode"); - int picker_shape = EDITOR_GET("interface/inspector/default_color_picker_shape"); + int default_color_mode = EditorSettings::get_singleton()->get_project_metadata("color_picker", "color_mode", EDITOR_GET("interface/inspector/default_color_picker_mode")); + int picker_shape = EditorSettings::get_singleton()->get_project_metadata("color_picker", "picker_shape", EDITOR_GET("interface/inspector/default_color_picker_shape")); + p_picker->set_color_mode((ColorPicker::ColorModeType)default_color_mode); p_picker->set_picker_shape((ColorPicker::PickerShapeType)picker_shape); } diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 23b216195a0..d31806fe974 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -693,6 +693,12 @@ void ColorPicker::set_picker_shape(PickerShapeType p_shape) { current_shape = p_shape; +#ifdef TOOLS_ENABLED + if (editor_settings) { + editor_settings->call(SNAME("set_project_metadata"), "color_picker", "picker_shape", current_shape); + } +#endif + _copy_color_to_hsv(); _update_controls(); @@ -927,6 +933,12 @@ void ColorPicker::set_color_mode(ColorModeType p_mode) { current_mode = p_mode; +#ifdef TOOLS_ENABLED + if (editor_settings) { + editor_settings->call(SNAME("set_project_metadata"), "color_picker", "color_mode", current_mode); + } +#endif + if (!is_inside_tree()) { return; }