Rename any instance of scene layer or render layer in code with view layer
[blender.git] / source / blender / makesdna / DNA_layer_types.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * Contributor(s): Dalai Felinto
19  *
20  * ***** END GPL LICENSE BLOCK *****
21  */
22
23 /** \file DNA_layer_types.h
24  *  \ingroup DNA
25  */
26
27 #ifndef __DNA_LAYER_TYPES_H__
28 #define __DNA_LAYER_TYPES_H__
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #include "DNA_freestyle_types.h"
35 #include "DNA_listBase.h"
36
37 typedef struct Base {
38         struct Base *next, *prev;
39         short flag;
40         short refcount;
41         short sx, sy;
42         struct Object *object;
43         unsigned int lay;
44         int flag_legacy;
45         struct IDProperty *collection_properties; /* used by depsgraph, flushed from collection-tree */
46 } Base;
47
48 typedef struct CollectionOverride {
49         struct CollectionOverride *next, *prev;
50         char name[64]; /* MAX_NAME */
51         /* TODO proper data */
52 } CollectionOverride;
53
54 typedef struct ViewLayerEngineData {
55         struct ViewLayerEngineData *next, *prev;
56         struct DrawEngineType *engine_type;
57         void *storage;
58         void (*free)(void *storage);
59 } ViewLayerEngineData;
60
61 typedef struct LayerCollection {
62         struct LayerCollection *next, *prev;
63         struct SceneCollection *scene_collection;
64         short flag;
65         /* TODO(sergey): Get rid of this once we've got CoW in DEG, */
66         short flag_evaluated;
67         short pad[2];
68         ListBase object_bases;      /* (ObjectBase *)LinkData->data - synced with collection->objects and collection->filter_objects */
69         ListBase overrides;
70         ListBase layer_collections; /* synced with collection->collections */
71         struct IDProperty *properties;  /* overrides */
72         struct IDProperty *properties_evaluated;
73 } LayerCollection;
74
75 typedef struct ViewLayer {
76         struct ViewLayer *next, *prev;
77         char name[64]; /* MAX_NAME */
78         short active_collection;
79         short flag;
80         short pad[2];
81         ListBase object_bases;      /* ObjectBase */
82         struct SceneStats *stats;   /* default allocated now */
83         struct Base *basact;
84         ListBase layer_collections; /* LayerCollection */
85         struct IDProperty *properties;  /* overrides */
86         struct IDProperty *properties_evaluated;
87
88         /* Old SceneRenderLayer data. */
89         int layflag;
90         int passflag;                   /* pass_xor has to be after passflag */
91         int pass_xor;
92         float pass_alpha_threshold;
93
94         struct IDProperty *id_properties; /* Equivalent to datablocks ID properties. */
95
96         struct FreestyleConfig freestyle_config;
97
98         /* Runtime data */
99         ListBase drawdata;    /* ViewLayerEngineData */
100 } ViewLayer;
101
102 typedef struct SceneCollection {
103         struct SceneCollection *next, *prev;
104         char name[64]; /* MAX_NAME */
105         char filter[64]; /* MAX_NAME */
106         int active_object_index; /* for UI */
107         int pad;
108         ListBase objects;           /* (Object *)LinkData->data */
109         ListBase filter_objects;    /* (Object *)LinkData->data */
110         ListBase scene_collections; /* nested collections */
111 } SceneCollection;
112
113 /* Base->flag */
114 enum {
115         BASE_SELECTED         = (1 << 0),
116         BASE_VISIBLED         = (1 << 1),
117         BASE_SELECTABLED      = (1 << 2),
118         BASE_FROMDUPLI        = (1 << 3),
119         BASE_DIRTY_ENGINE_SETTINGS = (1 << 4),
120         BASE_FROM_SET         = (1 << 5), /* To be set only by the depsgraph */
121 };
122
123 /* LayerCollection->flag */
124 enum {
125         COLLECTION_VISIBLE    = (1 << 0),
126         COLLECTION_SELECTABLE = (1 << 1),
127         COLLECTION_DISABLED   = (1 << 2),
128 };
129
130 /* ViewLayer->flag */
131 enum {
132         VIEW_LAYER_RENDER = (1 << 0),
133         VIEW_LAYER_ENGINE_DIRTY  = (1 << 1),
134         VIEW_LAYER_FREESTYLE = (1 << 2),
135 };
136
137
138 /* *************************************************************** */
139 /* Engine Settings */
140
141 /* CollectionEngineSettings->type */
142 typedef enum CollectionEngineSettingsType {
143         COLLECTION_MODE_NONE = 0,
144         COLLECTION_MODE_OBJECT = 1,
145         COLLECTION_MODE_EDIT = 2,
146         COLLECTION_MODE_PAINT_WEIGHT = 5,
147         COLLECTION_MODE_PAINT_VERTEX = 6,
148 } CollectionModeSettingsType;
149
150 /* *************************************************************** */
151
152
153 #ifdef __cplusplus
154 }
155 #endif
156
157 #endif  /* __DNA_LAYER_TYPES_H__ */
158