[Bf-blender-cvs] [558679a19ea] soc-2019-outliner: Outliner: Utils function is element visible

Nathan Craddock noreply at git.blender.org
Thu May 30 06:59:02 CEST 2019


Commit: 558679a19ea3d7e5c176280762a9f3aa7d4ec69b
Author: Nathan Craddock
Date:   Wed May 29 22:56:09 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB558679a19ea3d7e5c176280762a9f3aa7d4ec69b

Outliner: Utils function is element visible

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

M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_utils.c

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

diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 76c30fba5db..aeabe5727ef 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -449,5 +449,6 @@ bool outliner_tree_traverse(const SpaceOutliner *soops,
                             void *customdata);
 float outliner_restrict_columns_width(const struct SpaceOutliner *soops);
 TreeElement *outliner_find_active_element(const ListBase *lb);
+bool outliner_is_element_visible(const ListBase *lb, const TreeElement *te);
 
 #endif /* __OUTLINER_INTERN_H__ */
diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c
index 941b98a1591..f24435415f7 100644
--- a/source/blender/editors/space_outliner/outliner_utils.c
+++ b/source/blender/editors/space_outliner/outliner_utils.c
@@ -315,3 +315,22 @@ TreeElement *outliner_find_active_element(const ListBase *lb)
   }
   return NULL;
 }
+
+/* Find if element is visible in the outliner tree */
+bool outliner_is_element_visible(const ListBase *lb, const TreeElement *search_te)
+{
+  for (TreeElement *te = lb->first; te; te = te->next) {
+    if (te == search_te) {
+      return true;
+    }
+
+    /* Search the next layer if the element is open */
+    if (!(TREESTORE(te)->flag & TSE_CLOSED)) {
+      bool element = outliner_is_element_visible(&te->subtree, search_te);
+      if (element) {
+        return element;
+      }
+    }
+  }
+  return false;
+}
\ No newline at end of file



More information about the Bf-blender-cvs mailing list