Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remember last color_mode and picker_shape in ColorPickers in the editor #86129

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading