Merge pull request #76751 from anvilfolk/swatch

Fix adding colors to swatches not updating in previous ColorPickers.
This commit is contained in:
Rémi Verschelde 2023-05-22 13:48:43 +02:00
commit 0f0f233d37
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -615,14 +615,15 @@ void ColorPicker::_update_presets() {
#ifdef TOOLS_ENABLED
if (editor_settings) {
// Only load preset buttons when the only child is the add-preset button.
if (preset_container->get_child_count() == 1) {
// Rebuild swatch color buttons, keeping the add-preset button in the first position.
for (int i = 1; i < preset_container->get_child_count(); i++) {
preset_container->get_child(i)->queue_free();
}
for (int i = 0; i < preset_cache.size(); i++) {
_add_preset_button(preset_size, preset_cache[i]);
}
_notification(NOTIFICATION_VISIBILITY_CHANGED);
}
}
#endif
}