Page MenuHome

UI: Skip expensive view button searching when drawing
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Dec 29 2022, 3:30 PM.

Details

Summary

Finding the active view item button should only happen when it's actually
necessary, since looping through all buttons and blocks is an expensive
operation. This patch limits the search a bit more, to left clicks (the only
case that is actually handled).

This improves drawing performance in the node editor, where this
was a bottleneck.


Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Dec 29 2022, 3:30 PM
Hans Goudey (HooglyBoogly) created this revision.
Julian Eisel (Severin) requested changes to this revision.Jan 3 2023, 7:35 PM
Julian Eisel (Severin) added inline comments.
source/blender/editors/interface/interface_handlers.cc
11293–11295

This is a bit too specific for ui_region_handler() for my taste. How about this:

ui_handle_view_items_hover(event, region);
if (retval == WM_UI_HANDLER_CONTINUE) {
  retval = ui_handle_view_item_over(...);
}

(With the return in your code we're also not calling ui_apply_but_funcs_after().)

There's also a chance that but is already the view item button we're looking for at this point, could you check that? I'm traveling and my Blender doesn't want to compile :)

This revision now requires changes to proceed.Jan 3 2023, 7:35 PM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/editors/interface/interface_handlers.cc
11293–11295

Great points, thanks!

This revision is now accepted and ready to land.Jan 3 2023, 10:08 PM