Skip to content

Commit

Permalink
Remember last 'color_mode' and 'picker_shape' in 'ColorPicker's in th…
Browse files Browse the repository at this point in the history
…e editor
  • Loading branch information
TheSofox committed Dec 14, 2023
1 parent aa5b6ed commit 7979412
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
12 changes: 12 additions & 0 deletions scene/gui/color_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 7979412

Please sign in to comment.