-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Don't instantiate ColorPicker
in EditorPropertyColor
constructor
#101570
Conversation
You can use |
I was considering that, but that signal is only emitted once right? I need the signal to be emitted every time it's opened. Unless I use |
You only need |
a85e747
to
3376ba6
Compare
picker->connect("popup_closed", callable_mp(this, &EditorPropertyColor::_popup_closed), CONNECT_DEFERRED); | ||
picker->get_popup()->connect("about_to_popup", callable_mp(EditorNode::get_singleton(), &EditorNode::setup_color_picker).bind(picker->get_picker())); | ||
picker->get_popup()->connect("about_to_popup", callable_mp(this, &EditorPropertyColor::_picker_opening)); | ||
picker->connect("picker_created", callable_mp(this, &EditorPropertyColor::_picker_created), CONNECT_ONE_SHOT); |
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.
ONE_SHOT is not needed, because the signal is emitted only once anyway.
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.
We can lump this in alongside the later fix you mentioned
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.
Seems like picker_created
was already used before, but was replaced in #62581.
For editor properties we could call setup_color_picker()
only once. Also the setup method can be changed to take button instead, so popups are not created early (there is a few of them in the editor).
That's for later though, this fix is fine for now.
Thanks! |
The
EditorPropertyColor
constructor was usingColorPickerButton::get_popup()
andColorPickerButton::get_picker()
, which was instantiating the ColorPicker without it being opened first. This led to 40+ pickers being instantiated in some cases.This PR avoids calling those getters by using the
ColorPickerButton::picker_created
signal to setup the picker at a later stage.On a debug build I get these results (quickly measured by eye & timer):
Editor Settings > Text Editor > Theme
:Switching away to another setting or inspector is faster now too, since there's no need to delete all the pickers.