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  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
20 /** \file
21  * \ingroup DNA
22  */
23 
24 #pragma once
25 
26 #include "DNA_defs.h"
27 
28 struct ID;
29 
30 typedef struct TreeStoreElem {
31   short type, nr, flag, used;
32 
33   /* XXX We actually also store non-ID data in this pointer for identifying
34    * the TreeStoreElem for a TreeElement when rebuilding the tree. Ugly! */
35   struct ID *id;
36 } TreeStoreElem;
37 
38 /* used only to store data in in blend files */
39 typedef struct TreeStore {
40   /** Was previously used for memory preallocation. */
41   int totelem DNA_DEPRECATED;
42   /** Number of elements in data array. */
43   int usedelem;
44   /**
45    * Elements to be packed from mempool in writefile.c
46    * or extracted to mempool in readfile.c
47    */
48   TreeStoreElem *data;
49 } TreeStore;
50 
51 /* TreeStoreElem->flag */
52 enum {
53   TSE_CLOSED = (1 << 0),
54   TSE_SELECTED = (1 << 1),
55   TSE_TEXTBUT = (1 << 2),
56   TSE_CHILDSEARCH = (1 << 3),
57   TSE_SEARCHMATCH = (1 << 4),
58   TSE_HIGHLIGHTED = (1 << 5),
59   TSE_DRAG_INTO = (1 << 6),
60   TSE_DRAG_BEFORE = (1 << 7),
61   TSE_DRAG_AFTER = (1 << 8),
62   /* Needed because outliner-only elements can be active */
63   TSE_ACTIVE = (1 << 9),
64   /* TSE_ACTIVE_WALK = (1 << 10), */ /* Unused */
65   TSE_DRAG_ANY = (TSE_DRAG_INTO | TSE_DRAG_BEFORE | TSE_DRAG_AFTER),
66 };
67 
68 /* TreeStoreElem->types */
69 #define TSE_NLA 1 /* NO ID */
70 #define TSE_NLA_ACTION 2
71 #define TSE_DEFGROUP_BASE 3
72 #define TSE_DEFGROUP 4
73 #define TSE_BONE 5
74 #define TSE_EBONE 6
75 #define TSE_CONSTRAINT_BASE 7
76 #define TSE_CONSTRAINT 8
77 #define TSE_MODIFIER_BASE 9
78 #define TSE_MODIFIER 10
79 #define TSE_LINKED_OB 11
80 /* #define TSE_SCRIPT_BASE     12 */ /* UNUSED */
81 #define TSE_POSE_BASE 13
82 #define TSE_POSE_CHANNEL 14
83 #define TSE_ANIM_DATA 15
84 #define TSE_DRIVER_BASE 16           /* NO ID */
85 /* #define TSE_DRIVER          17 */ /* UNUSED */
86 
87 #define TSE_PROXY 18
88 #define TSE_R_LAYER_BASE 19
89 #define TSE_R_LAYER 20
90 /* #define TSE_R_PASS          21 */ /* UNUSED */
91 #define TSE_LINKED_MAT 22
92 /* NOTE, is used for light group */
93 #define TSE_LINKED_LAMP 23
94 #define TSE_POSEGRP_BASE 24
95 #define TSE_POSEGRP 25
96 #define TSE_SEQUENCE 26     /* NO ID */
97 #define TSE_SEQ_STRIP 27    /* NO ID */
98 #define TSE_SEQUENCE_DUP 28 /* NO ID */
99 #define TSE_LINKED_PSYS 29
100 #define TSE_RNA_STRUCT 30     /* NO ID */
101 #define TSE_RNA_PROPERTY 31   /* NO ID */
102 #define TSE_RNA_ARRAY_ELEM 32 /* NO ID */
103 #define TSE_NLA_TRACK 33      /* NO ID */
104 #define TSE_KEYMAP 34         /* NO ID */
105 #define TSE_KEYMAP_ITEM 35    /* NO ID */
106 #define TSE_ID_BASE 36        /* NO ID */
107 #define TSE_GP_LAYER 37       /* NO ID */
108 #define TSE_LAYER_COLLECTION 38
109 #define TSE_SCENE_COLLECTION_BASE 39
110 #define TSE_VIEW_COLLECTION_BASE 40
111 #define TSE_SCENE_OBJECTS_BASE 41
112 #define TSE_GPENCIL_EFFECT_BASE 42
113 #define TSE_GPENCIL_EFFECT 43
114 
115 /* Check whether given TreeStoreElem should have a real ID in its ->id member. */
116 #define TSE_IS_REAL_ID(_tse) \
117   (!ELEM((_tse)->type, \
118          TSE_NLA, \
119          TSE_NLA_TRACK, \
120          TSE_DRIVER_BASE, \
121          TSE_SEQUENCE, \
122          TSE_SEQ_STRIP, \
123          TSE_SEQUENCE_DUP, \
124          TSE_RNA_STRUCT, \
125          TSE_RNA_PROPERTY, \
126          TSE_RNA_ARRAY_ELEM, \
127          TSE_KEYMAP, \
128          TSE_KEYMAP_ITEM, \
129          TSE_ID_BASE, \
130          TSE_GP_LAYER))
131