Commit: ec9dfb21d748ad26c5a46a7c76e09e7fd581c8a5
Author: Nathan Craddock
Date:   Thu Jul 25 16:06:02 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBec9dfb21d748ad26c5a46a7c76e09e7fd581c8a5

Outliner fix openclose recursive not working as expected

The openclose all operator would not close the upper element, nor
would it work on the outermost collections of a scene. Now the
recursive open all option will work as expected, opening all of
an element's children, and the element itself, or closing
the element and all of its children.

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

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 9cccdbdd186..b8f44a86344 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -140,16 +140,17 @@ void OUTLINER_OT_highlight_update(wmOperatorType *ot)
 
 /* Toggle Open/Closed ------------------------------------------- */
 
-/* Open or close a tree element */
-static bool outliner_item_openclose(TreeElement *te, bool open_all)
+/* Open or close a tree element, optionally toggling all children recursively 
*/
+static bool outliner_item_openclose(TreeElement *te, bool toggle_all)
 {
   TreeStoreElem *tselem = TREESTORE(te);
 
   /* all below close/open? */
-  if (open_all) {
-    tselem->flag &= ~TSE_CLOSED;
-    outliner_flag_set(
-        &te->subtree, TSE_CLOSED, !outliner_flag_is_any_test(&te->subtree, 
TSE_CLOSED, 1));
+  if (toggle_all) {
+    const bool open = tselem->flag & TSE_CLOSED;
+
+    tselem->flag ^= TSE_CLOSED;
+    outliner_flag_set(&te->subtree, TSE_CLOSED, !open);
 
     return true;
   }
@@ -204,7 +205,7 @@ static int outliner_item_openclose_invoke(bContext *C, 
wmOperator *op, const wmE
   ARegion *ar = CTX_wm_region(C);
   SpaceOutliner *soops = CTX_wm_space_outliner(C);
 
-  const bool open_all = RNA_boolean_get(op->ptr, "all");
+  const bool toggle_all = RNA_boolean_get(op->ptr, "all");
 
   float view_mval[2];
   UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], 
&view_mval[0], &view_mval[1]);
@@ -212,7 +213,7 @@ static int outliner_item_openclose_invoke(bContext *C, 
wmOperator *op, const wmE
   TreeElement *te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
 
   if (te && outliner_item_is_co_within_close_toggle(te, view_mval[0])) {
-    outliner_item_openclose(te, open_all);
+    outliner_item_openclose(te, toggle_all);
     ED_region_tag_redraw(ar);
 
     /* Store the first clicked on element */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to