Page MenuHome

Fix T75003: Scrollbars hidden on file load.
Needs ReviewPublic

Authored by Anthony Edlin (krash) on Mar 16 2021, 8:30 AM.

Details

Summary

Fix T75003:
View2D's cur and tot rect have stale data when loaded and in certain combinations
can get the vert and hor scroller rects to be initialized with file loaded data
that may not match larger window size. The action zones for the scroller display
are created only on file load and window/area resize, so if you make the region
require a scroller then the vert and hor rects are updated, but the action zones
are left in stale data state until resize.

Solution was to just update the vert and hor rects irregardless of weather the
scrollers are visible.

Diff Detail

Repository
rB Blender
Branch
fix_T75003_scrollbars_hidden_on_file_load (branched from master)
Build Status
Buildable 13532
Build 13532: arc lint + arc unit

Event Timeline

Anthony Edlin (krash) requested review of this revision.Mar 16 2021, 8:30 AM
Anthony Edlin (krash) created this revision.

Here is debug output showing Load Factory Settings with window of about 1280x1350. Breaks in green with v2d rect printouts.

You can see in the region_azones_add after the buttons_main_region that the azone scroll rects are loaded with data from the loaded file because they are never updated to the mask rect.

Hey @Anthony Edlin (krash), I think I am seeing some unnecessary complexity in this solution, but bear in mind I haven't looked at it much so could be incorrect in the following:

There is currently a UI_view2d_scroller_size_get() in that same file and your solution here is making another function that looks identical to it, except it directly takes scroller flags rather than get this via view2d_scroll_mapped(). If this is the meat of the solution, then it could be made easier to understand and reduce the code.

Place your view2d_scroller_size_get() (I'd actually rename it just "scroller_size_get()") before UI_view2d_scroller_size_get() and alter the latter to call the former. This would reduce the existing UI_view2d_scroller_size_get() to a single line and seeing the two functions close together would make it easier to see the difference between them.

alter the latter to call the former.

Am I missing something, isn't this what was done in the patch?

Place your view2d_scroller_size_get() (I'd actually rename it just "scroller_size_get()") before UI_view2d_scroller_size_get()

I initially did place it there but then had to forward declare the function because it's called before that in view2d_masks(), so I just moved it directly before it's first use, which seems consistent with most of blender code (I don't see very much forward declaration of static functions). Another option would be to move UI_view2d_scroller_size_get out of the "Utilities" section and just after view2d_scroller_size_get in order to keep them close together. So there are 3 total options, leave as is, move before UI_view2d_scroller_size_get and forward declare it at start of file, or move UI_view2d_scroller_size_get. Pick your poison I guess, I'm not fussed with anything.

I should note I also tried just making UI_view2d_scroller_size_get just take a scroll instead of v2d, but view2d_scroll_mapped() is a static function and I didn't want to go through making it public and updating everywhere UI_view2d_scroller_size_get was called.

Thanks for looking at this.

@Anthony Edlin (krash) - Am I missing something, isn't this what was done in the patch?

No, you aren't missing anything as that is exactly what you did do. I didn't think that I had that much much wine last night, but you never know...

Another option would be to move UI_view2d_scroller_size_get out of the "Utilities" section and just after view2d_scroller_size_get...

I guess I like that just because it makes it clear why they both exist and the differences between them.

But your patch certainly seems to fix the problem.