[Bf-blender-cvs] [d50b8c0bfb9] soc-2019-outliner: Outliner: Fix item openclose

Nathan Craddock noreply at git.blender.org
Fri Jul 26 04:40:12 CEST 2019


Commit: d50b8c0bfb97ae7dbc84b55fc9d0782c34c16638
Author: Nathan Craddock
Date:   Thu Jul 25 20:38:59 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBd50b8c0bfb97ae7dbc84b55fc9d0782c34c16638

Outliner: Fix item openclose

Rather than just switching between open and close when toggling
all children, first check if any children are closed when the
item is open. If so, extend all the children first. This behavior
makes more sense.

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

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 b8f44a86344..7f16539054b 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -141,15 +141,22 @@ void OUTLINER_OT_highlight_update(wmOperatorType *ot)
 /* Toggle Open/Closed ------------------------------------------- */
 
 /* Open or close a tree element, optionally toggling all children recursively */
-static bool outliner_item_openclose(TreeElement *te, bool toggle_all)
+bool outliner_item_openclose(TreeElement *te, bool toggle_all)
 {
   TreeStoreElem *tselem = TREESTORE(te);
 
-  /* all below close/open? */
   if (toggle_all) {
-    const bool open = tselem->flag & TSE_CLOSED;
+    /* Open all children if this element is closed, or if any children are closed */
+    const bool open = (tselem->flag & TSE_CLOSED) ||
+                      (outliner_flag_is_any_test(&te->subtree, TSE_CLOSED, 1));
+
+    if (open) {
+      tselem->flag &= ~TSE_CLOSED;
+    }
+    else {
+      tselem->flag |= TSE_CLOSED;
+    }
 
-    tselem->flag ^= TSE_CLOSED;
     outliner_flag_set(&te->subtree, TSE_CLOSED, !open);
 
     return true;



More information about the Bf-blender-cvs mailing list