Tree: Calling update in _gui_input less frequently #39350
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Optimizes _gui_input handling in tree control to only call
update()
when going from a control that actually needs to re-render which are the ones that use hover states (columns and cells which haveset_custom_as_button
set to true).update()
which can safely be removed.update()
only when hovering in/out of cells that useset_custom_as_button
.Can this fix be cherry picked for 3.2.2 since it's backwards compatible?
Also, I'm not sure if anyone out there is using
set_custom_as_button
it looks like the editor used it a few years ago but no longer does. It's barely documented and I had to poke around the source code to figure out how to even get it to work so I'd be surprised if anyone is using it. Might be something good to remove for 4.0 if it's a good time to deprecate unused APIs.Test project: TreeSample.zip
Still seeing some updates that could be optimized but much less than before. The main benefit here is when I'm moving my mouse around the first 3 groups of cells which don't have any hover state, there are no draw call updates. Everything else is still working as expected.
Fix: #39251