From 2d48f3e445ad4294cfe1a354629bf335117ba40d Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 10 Nov 2020 13:53:05 +0100 Subject: Fix 'outliner_scroll_view()' not reaching wanted element Scrolling to an item after opening relevant parents can go wrong if said parent e.g. the last in the list [as in: then the Outliner does not scroll down all the way] It stems from the fact that 'region->v2d.tot.ymin' is not up-to-date in outliner_scroll_view after outliner_show_active opens up parents, 'tot' will only update on a redraw. Now calculate the trees height on the fly using 'outliner_tree_dimensions()'. ref D9521 ref T82553 Maniphest Tasks: T82553 Differential Revision: https://developer.blender.org/D9523 --- source/blender/editors/space_outliner/outliner_edit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_outliner/outliner_edit.c') diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 779efc3cacb..165d7bb2aa2 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1343,7 +1343,7 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op)) int ytop = (active_element->ys + (size_y / 2)); int delta_y = ytop - v2d->cur.ymax; - outliner_scroll_view(region, delta_y); + outliner_scroll_view(space_outliner, region, delta_y); } else { return OPERATOR_CANCELLED; @@ -1375,6 +1375,7 @@ void OUTLINER_OT_show_active(wmOperatorType *ot) static int outliner_scroll_page_exec(bContext *C, wmOperator *op) { + SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); ARegion *region = CTX_wm_region(C); int size_y = BLI_rcti_size_y(®ion->v2d.mask) + 1; @@ -1384,7 +1385,7 @@ static int outliner_scroll_page_exec(bContext *C, wmOperator *op) size_y = -size_y; } - outliner_scroll_view(region, size_y); + outliner_scroll_view(space_outliner, region, size_y); ED_region_tag_redraw_no_rebuild(region); -- cgit v1.2.3