-
-
Notifications
You must be signed in to change notification settings - Fork 22.1k
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
Fix preset cache usage in ColorPicker #104496
base: master
Are you sure you want to change the base?
Conversation
9c864b4
to
eb47eef
Compare
eb47eef
to
240861f
Compare
scene/gui/color_picker.cpp
Outdated
for (int i = 1; i < preset_container->get_child_count(); i++) { | ||
preset_container->get_child(i)->queue_free(); | ||
} | ||
if (presets.is_empty() || Engine::get_singleton()->is_editor_hint()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this points at the main problem here.
The reported issue was about standalone ColorPicker, while the preset update code assumes that the ColorPicker always comes from ColorPickerButton. I think we should always update the presets in the latter case. For that the ColorPicker needs to know whether it's standalone or from a button.
240861f
to
98a3ca1
Compare
@@ -730,10 +731,10 @@ void ColorPicker::_update_color(bool p_update_sliders) { | |||
|
|||
void ColorPicker::_update_presets() { | |||
int preset_size = _get_preset_size(); | |||
btn_add_preset->set_custom_minimum_size(Size2(preset_size * 1, preset_size)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btn_add_preset->set_custom_minimum_size(Size2(preset_size * 1, preset_size)); | |
btn_add_preset->set_custom_minimum_size(Size2(preset_size, preset_size)); |
@@ -170,6 +170,7 @@ class ColorPicker : public VBoxContainer { | |||
Button *btn_pick = nullptr; | |||
Label *palette_name = nullptr; | |||
String palette_path; | |||
bool presets_just_loaded; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool presets_just_loaded; | |
bool presets_just_loaded = false; |
Fixes #104223
It also fixes two additional bugs (click to expand)
ColorPicker
s. Video of incorrect behaviour from 4.4.stable:Nagrywanie.ekranu.2025-03-23.001706.mp4
ColorPicker
in runtime. Video of incorrect behaviour from 4.4.stable:Nagrywanie.ekranu.2025-03-23.001306.mp4
Correct behaviour, fixed with this PR:
Nagrywanie.ekranu.2025-03-23.003851.mp4
Nagrywanie.ekranu.2025-03-23.004156.mp4