Blender  V2.93
tree_display_scenes.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include "BLI_listbase.h"
22 #include "BLI_listbase_wrapper.hh"
23 #include "BLI_mempool.h"
24 
25 #include "BKE_main.h"
26 
27 #include "../outliner_intern.h"
28 #include "tree_display.hh"
29 
30 namespace blender::ed::outliner {
31 
32 /* Convenience/readability. */
33 template<typename T> using List = ListBaseWrapper<T>;
34 
36  : AbstractTreeDisplay(space_outliner)
37 {
38 }
39 
41 {
42  /* On first view we open scenes. */
43  const int show_opened = !space_outliner_.treestore ||
45  ListBase tree = {nullptr};
46 
47  for (ID *id : List<ID>(source_data.bmain->scenes)) {
48  Scene *scene = reinterpret_cast<Scene *>(id);
50  &space_outliner_, &tree, scene, nullptr, TSE_SOME_ID, 0);
51  TreeStoreElem *tselem = TREESTORE(te);
52 
53  /* New scene elements open by default */
54  if ((scene == source_data.scene && show_opened) || !tselem->used) {
55  tselem->flag &= ~TSE_CLOSED;
56  }
57 
59  }
60 
61  return tree;
62 }
63 
64 } // namespace blender::ed::outliner
int BLI_mempool_len(BLI_mempool *pool) ATTR_NONNULL(1)
Definition: BLI_mempool.c:454
@ TSE_SOME_ID
@ TSE_CLOSED
Base Class For Tree-Displays.
Definition: tree_display.hh:55
ListBase buildTree(const TreeSourceData &source_data) override
TreeDisplayScenes(SpaceOutliner &space_outliner)
Scene scene
void * tree
ListBaseWrapper< T > List
#define TREESTORE(a)
TreeElement * outliner_add_element(SpaceOutliner *space_outliner, ListBase *lb, void *idv, TreeElement *parent, short type, short index)
void outliner_make_object_parent_hierarchy(ListBase *lb)
Definition: DNA_ID.h:273
ListBase scenes
Definition: BKE_main.h:146
struct BLI_mempool * treestore
ListBase subtree
The data to build the tree from.
Definition: tree_display.h:39
struct Scene * scene
Definition: tree_display.h:41
struct Main * bmain
Definition: tree_display.h:40
Establish and manage Outliner trees for different display modes.