[Bf-blender-cvs] [f2cc499a043] soc-2019-outliner: Outliner: Fix small issues in walk navigation

Nathan Craddock noreply at git.blender.org
Fri Jul 26 23:35:17 CEST 2019


Commit: f2cc499a043dcbc5e1940e44e780a7b00dc3e2dc
Author: Nathan Craddock
Date:   Fri Jul 26 15:33:56 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBf2cc499a043dcbc5e1940e44e780a7b00dc3e2dc

Outliner: Fix small issues in walk navigation

After adding open/close features to walk navigation, a few small
issues appeared. This adds a few more checks to ensure a walk
or expand really occurs when the desired keys are pressed, rather
than expanding when a walk is desired.

Also moved the walking code to separate functions to make the
switch statement more clear to read.

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

M	source/blender/editors/space_outliner/outliner_select.c

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

diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index bf3066766d5..e1f861b0917 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1654,6 +1654,46 @@ static TreeElement *outliner_find_next_element(SpaceOutliner *soops, TreeElement
   return walk_element;
 }
 
+/* Walk the element left, or close the element */
+static TreeElement *outliner_walk_left(SpaceOutliner *soops,
+                                       TreeElement *walk_element,
+                                       TreeStoreElem *tselem,
+                                       bool toggle_all)
+{
+  if (TSELEM_OPEN(tselem, soops)) {
+    if (toggle_all) {
+      TREESTORE(walk_element)->flag |= TSE_CLOSED;
+      outliner_flag_set(&walk_element->subtree, TSE_CLOSED, true);
+    }
+    else {
+      outliner_item_openclose(walk_element, false);
+    }
+  }
+  else if (!toggle_all && walk_element->parent) {
+    return walk_element->parent;
+  }
+
+  return walk_element;
+}
+
+/* Walk the element right or expand the element */
+static TreeElement *outliner_walk_right(SpaceOutliner *soops,
+                                        TreeElement *walk_element,
+                                        TreeStoreElem *tselem,
+                                        bool toggle_all)
+{
+  if (!toggle_all && TSELEM_OPEN(tselem, soops)) {
+    return walk_element->subtree.first;
+  }
+  else if ((!TSELEM_OPEN(tselem, soops) ||
+            outliner_flag_is_any_test(&walk_element->subtree, TSE_CLOSED, 1)) &&
+           walk_element->subtree.first) {
+    outliner_item_openclose(walk_element, toggle_all);
+  }
+
+  return walk_element;
+}
+
 static void do_outliner_select_walk(SpaceOutliner *soops,
                                     TreeElement *walk_element,
                                     const int direction,
@@ -1676,19 +1716,10 @@ static void do_outliner_select_walk(SpaceOutliner *soops,
       break;
     case OUTLINER_SELECT_WALK_LEFT:
       /* Close open element or walk to parent */
-      if (TSELEM_OPEN(tselem, soops)) {
-        outliner_item_openclose(walk_element, toggle_all);
-      }
-      else if (walk_element->parent) {
-        walk_element = walk_element->parent;
-      }
+      walk_element = outliner_walk_left(soops, walk_element, tselem, toggle_all);
       break;
     case OUTLINER_SELECT_WALK_RIGHT:
-      if ((!TSELEM_OPEN(tselem, soops) ||
-           outliner_flag_is_any_test(&walk_element->subtree, TSE_CLOSED, 1)) &&
-          walk_element->subtree.first) {
-        outliner_item_openclose(walk_element, toggle_all);
-      }
+      walk_element = outliner_walk_right(soops, walk_element, tselem, toggle_all);
       break;
   }



More information about the Bf-blender-cvs mailing list