Skip to content
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

Tree: Calling update in _gui_input less frequently #39350

Merged
merged 1 commit into from
Jun 10, 2020

Conversation

giulianob
Copy link
Contributor

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 have set_custom_as_button set to true).

  1. Columns already had a condition to only update when they changed but there was still an explicit call to update() which can safely be removed.
  2. Calling update() only when hovering in/out of cells that use set_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.
cap3

Fix: #39251

@Calinou Calinou added cherrypick:3.x Considered for cherry-picking into a future 3.x release enhancement topic:gui labels Jun 7, 2020
@Calinou Calinou added this to the 4.0 milestone Jun 7, 2020
@akien-mga akien-mga merged commit 8b79f2a into godotengine:master Jun 10, 2020
@akien-mga
Copy link
Member

akien-mga commented Jun 10, 2020

Thanks! And congrats for your first merged PR (and a well detailed/tested one :)).

@akien-mga
Copy link
Member

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.

Yeah I think that could be a good candidate for removal in 4.0.

@akien-mga
Copy link
Member

Cherry-picked for 3.2.2.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jun 10, 2020
@giulianob giulianob deleted the improve-tree-redraw branch June 10, 2020 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tree component causes updates when simply hovering between cells
3 participants