Blender  V3.3
tree_iterator.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "DNA_space_types.h"
8 
9 #include "BLI_listbase.h"
10 
11 #include "../outliner_intern.hh"
12 
13 #include "tree_iterator.hh"
14 
16 
17 void all(const SpaceOutliner &space_outliner, const VisitorFn visitor)
18 {
19  all_open(space_outliner, space_outliner.tree, visitor);
20 }
21 
22 void all(const ListBase &subtree, const VisitorFn visitor)
23 {
25  /* Get needed data out in case element gets freed. */
26  const ListBase subtree = element->subtree;
27 
28  visitor(element);
29  /* Don't access element from now on, it may be freed. */
30 
31  all(subtree, visitor);
32  }
33 }
34 
35 void all_open(const SpaceOutliner &space_outliner, const VisitorFn visitor)
36 {
37  all_open(space_outliner, space_outliner.tree, visitor);
38 }
39 
40 void all_open(const SpaceOutliner &space_outliner,
41  const ListBase &subtree,
42  const VisitorFn visitor)
43 {
45  /* Get needed data out in case element gets freed. */
46  const TreeStoreElem *tselem = TREESTORE(element);
47  const ListBase subtree = element->subtree;
48 
49  visitor(element);
50  /* Don't access element from now on, it may be freed. Note that the open/collapsed state may
51  * also have been changed in the visitor callback. */
52 
53  if (TSELEM_OPEN(tselem, &space_outliner)) {
54  all_open(space_outliner, subtree, visitor);
55  }
56  }
57 }
58 
59 } // namespace blender::ed::outliner::tree_iterator
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:354
ATTR_WARN_UNUSED_RESULT const void * element
void all_open(const SpaceOutliner &space_outliner, const VisitorFn visitor)
void all(const SpaceOutliner &space_outliner, const VisitorFn visitor)
#define TREESTORE(a)
#define TSELEM_OPEN(telm, sv)