[Bf-blender-cvs] [dbcce31ad36] soc-2019-outliner: Outliner: Show active improvements

Nathan Craddock noreply at git.blender.org
Thu Jul 18 02:52:27 CEST 2019


Commit: dbcce31ad3632cae643c366d4bca13fa30c08ac6
Author: Nathan Craddock
Date:   Wed Jul 17 18:49:18 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBdbcce31ad3632cae643c366d4bca13fa30c08ac6

Outliner: Show active improvements

Prevent the show active operator from scrolling beneath the
allowed scrolling range. This removes jumpy redraws after the
operator executes.

The horizontal centering is difficult, because the elements
outside the view of the outliner do not have the xend properly set
and the max width of the outliner is not properly calculated.
This means it is not possible to center the x position while
keeping the view in range of scrolling.

This could be resolved by drawing the outliner after setting the y
position, but that is not an ideal solution.

===================================================================

M	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 6f817a451e3..b26db7345ee 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -1191,7 +1191,6 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
   View2D *v2d = &ar->v2d;
 
   TreeElement *te;
-  int ytop;
 
   Object *obact = OBACT(view_layer);
 
@@ -1225,14 +1224,20 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
       outliner_set_coordinates(ar, so);
     }
 
-    /* make te->ys center of view */
-    ytop = te->ys + BLI_rcti_size_y(&v2d->mask) / 2;
+    int size_y = BLI_rcti_size_y(&v2d->mask) + 1;
+    int y_min = MIN2(ar->v2d.tot.ymin, v2d->cur.ymin);
+    int ytop = te->ys + size_y / 2;
+
+    /* make te->ys center of view  keeping element within scroll limits */
     if (ytop > 0) {
       ytop = 0;
     }
+    else if ((ytop - size_y) < y_min) {
+      ytop += y_min - (ytop - size_y);
+    }
 
-    v2d->cur.ymax = (float)ytop;
-    v2d->cur.ymin = (float)(ytop - BLI_rcti_size_y(&v2d->mask));
+    v2d->cur.ymax = ytop;
+    v2d->cur.ymin = ytop - size_y;
   }
 
   ED_region_tag_redraw_no_rebuild(ar);



More information about the Bf-blender-cvs mailing list