Expose Theme.freeze_change_propagation()
and Theme.unfreeze_and_propagate_changes()
#10873
Labels
Theme.freeze_change_propagation()
and Theme.unfreeze_and_propagate_changes()
#10873
Describe the project you are working on
A text editor that supports multiple themes
Describe the problem or limitation you are having in your project
I have a function that changes the theme according to a
.tet
file, so it makes a lot of calls toTheme.set_*
(over 120). Since each call to those set methods then calls_emit_theme_changed()
(which propagatesNOTIFICATION_THEME_CHANGED
to all nodes), it results in basically doing 120x the work it should, and so the entire project freezes for 12 seconds.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Exposing these methods would let the Theme not notify all nodes after every change. Alternatively, the Controls can only update once on idle frames instead of immediately after every notification.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Instead of
it would be
Alternatively, it should follow Control's
begin/end_bulk_theme_override
:If this enhancement will not be used often, can it be worked around with a few lines of script?
Technically yes, by unparenting all nodes, setting all the theme items, then parenting them back. This is less than ideal, especially since subwindows will be closed temporarily, things will disappear for two frames, etc.
Is there a reason why this should be core and not an add-on in the asset library?
This is not possible to do with an addon
The text was updated successfully, but these errors were encountered: