Use dedicated canvas item to properly cull tree items#114572
Use dedicated canvas item to properly cull tree items#114572akien-mga merged 1 commit intogodotengine:masterfrom
Conversation
1e7eeef to
13ed88f
Compare
|
Scroll hints have wrong color: |
KoBeWi
left a comment
There was a problem hiding this comment.
I skimmed over the code. You are performing lots of unnecessary updates for the internal CanvasItems. You should only set what is necessary (and do it once if it does not change), most of the stuff like visibility, modulate, transform is just inherited from Tree.
d0f1d63 to
eef97f9
Compare
KoBeWi
left a comment
There was a problem hiding this comment.
Tested, works fine overall. Though you are unnecessarily passing the canvas items as arguments to methods. They always use the same one.
Though before doing further changes, apply this patch:
It removes some unnecessary code and disables clipping of custom drawing (it wasn't clipped in previous versions, so no reason to do it).
eef97f9 to
02c2dea
Compare
02c2dea to
bd54c55
Compare
| } | ||
| rendering_server->canvas_item_clear(header_ci); | ||
| rendering_server->canvas_item_set_custom_rect(header_ci, !is_visibility_clip_disabled(), header_clip_rect); | ||
| rendering_server->canvas_item_set_clip(header_ci, true); |
There was a problem hiding this comment.
Setting clip here should also be unnecessary, but from my testing it seems you have to set it every time for some reason. No idea how it works.
|
Thanks! And congrats for your first merged Godot contribution 🎉 |
…-tree-item-culling Use dedicated canvas item to properly cull tree items


This PR fixes #114123 following the advice given here by the reporter @KoBeWi.
The culling window for tree items has been restricted to the proper rect up to the bottom of the tree, fixing the early exit that didn't account for the bottom margin and thus the issue itself.
That itself was not enough, as the same problem was showing on the top of the
FileSystem tab, which lead me do find out it was a workaround to prevent items from rendering beyond the column headers.So, as suggested in the linked comment, I introduced a separate
canvas itemfor column headers in order to separate item culling from those, no matter the size of the item.I'm attaching some videos as proof of the solution.
Details
DpamvqBPb8.mp4
godot.windows.editor.x86_64_wzhlsNdaW1.mp4
godot.windows.editor.x86_64_zhFaApCg6p.mp4
Bugsquad edit: Fixes #114140