Blender  V3.3
tree_display_scenes.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 #include "BLI_listbase_wrapper.hh"
11 #include "BLI_mempool.h"
12 
13 #include "BKE_main.h"
14 
15 #include "../outliner_intern.hh"
16 #include "common.hh"
17 #include "tree_display.hh"
18 #include "tree_element.hh"
19 
20 namespace blender::ed::outliner {
21 
22 template<typename T> using List = ListBaseWrapper<T>;
23 
25  : AbstractTreeDisplay(space_outliner)
26 {
27 }
28 
30 {
31  return true;
32 }
33 
35 {
36  /* On first view we open scenes. */
37  const int show_opened = !space_outliner_.treestore ||
39  ListBase tree = {nullptr};
40 
41  for (ID *id : List<ID>(source_data.bmain->scenes)) {
42  Scene *scene = reinterpret_cast<Scene *>(id);
44  &space_outliner_, &tree, scene, nullptr, TSE_SOME_ID, 0);
45  TreeStoreElem *tselem = TREESTORE(te);
46 
47  /* New scene elements open by default */
48  if ((scene == source_data.scene && show_opened) || !tselem->used) {
49  tselem->flag &= ~TSE_CLOSED;
50  }
51 
53  }
54 
55  return tree;
56 }
57 
58 } // namespace blender::ed::outliner
int BLI_mempool_len(const BLI_mempool *pool) ATTR_NONNULL(1)
Definition: BLI_mempool.c:434
@ TSE_SOME_ID
@ TSE_CLOSED
Base Class For Tree-Displays.
Definition: tree_display.hh:62
ListBase buildTree(const TreeSourceData &source_data) override
TreeDisplayScenes(SpaceOutliner &space_outliner)
void outliner_make_object_parent_hierarchy(ListBase *lb)
Definition: common.cc:37
Scene scene
void * tree
TreeElement * outliner_add_element(SpaceOutliner *space_outliner, ListBase *lb, void *idv, TreeElement *parent, short type, short index, const bool expand)
ListBaseWrapper< T > List
#define TREESTORE(a)
Definition: DNA_ID.h:368
ListBase scenes
Definition: BKE_main.h:168
struct BLI_mempool * treestore
ListBase subtree
The data to build the tree from.
Definition: tree_display.hh:43
Establish and manage Outliner trees for different display modes.