Merge pull request #86129 from TheSofox/color-picker-memory

Remember last `color_mode` and `picker_shape` in `ColorPicker`s in the editor
This commit is contained in:
Yuri Sizov 2023-12-14 21:22:39 +01:00
commit a5529f759c
2 changed files with 15 additions and 2 deletions

View File

@ -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);
}

View File

@ -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;
}