Blender V5.3
DNA_layer_types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "DNA_freestyle_types.h"
12#include "DNA_listBase.h"
13#include "DNA_scene_enums.h"
14
15#include "BLI_enum_flags.hh"
16#include "BLI_map.hh"
17
18namespace blender {
19
20struct Base;
21struct Object;
22struct ViewLayerRuntime;
23
25
45 EEVEE_RENDER_PASS_UNUSED_14 = (1 << 14), /* EEVEE_RENDER_PASS_BLOOM */
47 /*
48 * TODO(@jbakker): Clean up conflicting bits after EEVEE has been removed.
49 * #EEVEE_RENDER_PASS_CRYPTOMATTE is for EEVEE, `EEVEE_RENDER_PASS_CRYPTOMATTE_*` are for
50 * EEVEE-Next.
51 */
59 /*
60 * Set of denoising render passes. The flags are left as zero in DNA and controlled via
61 * eViewLayerEEVEEDenoisingPassCategory.
62 */
68};
69#define EEVEE_RENDER_PASS_MAX_BIT 26
71
72
74 /* Can be changed in the future if not all passes should be enabled by the same flag. */
76 /* Whether to use roughness-based weighting for the albedo or split by the BSDF type. */
78};
80
81/* #ViewLayer::grease_pencil_flags */
86
87/* #ViewLayerAOV.type */
92
93/* #ViewLayerAOV.flag */
95 AOV_CONFLICT = (1 << 0),
96};
98
99/* #ViewLayer.cryptomatte_flag */
107#define VIEW_LAYER_CRYPTOMATTE_ALL \
108 (VIEW_LAYER_CRYPTOMATTE_OBJECT | VIEW_LAYER_CRYPTOMATTE_MATERIAL | VIEW_LAYER_CRYPTOMATTE_ASSET)
109
110/* Base->flag */
111enum eBase_Flag : short {
112 /* User controlled flags. */
113 BASE_SELECTED = (1 << 0), /* Object is selected. */
114 BASE_HIDDEN = (1 << 8), /* Object is hidden for editing. */
115
116 /* Runtime evaluated flags. */
117
118 /* Object is enabled and potentially visible in a viewport. Layer collection
119 * visibility, local collection visibility, and local view are not part of this
120 * and may cause the object to be hidden depending on the 3D viewport settings.
121 *
122 * Objects with this flag will be considered visible by the viewport depsgraph
123 * and be evaluated as a result.
124 *
125 * This implies BASE_ENABLED_VIEWPORT. */
127
128 /* Object can be selected. */
129 BASE_SELECTABLE = (1 << 2),
130
131 /* Object comes from a duplicator. */
132 BASE_FROM_DUPLI = (1 << 3),
133
134 /* Object is enabled and visible in a viewport with default viewport settings,
135 * (so without any local view or local collection visibility overrides). Used
136 * when editors other than the 3D viewport need to know if an object is visible. */
138
139 /* Object comes from a scene set. */
140 BASE_FROM_SET = (1 << 5),
141
142 /* Object is enabled for viewport or final render respectively. Only enabled
143 * objects can be pulled into the depsgraph for evaluation, either through being
144 * directly visible, as a dependency of another object, or as part of colliders
145 * and effectors for physics. */
148
149 /* BASE_DEPRECATED = (1 << 9), */
150
151 /* Object masked out from render */
152 BASE_HOLDOUT = (1 << 10),
153 /* Object only contributes indirectly to render */
155};
157
158/* LayerCollection->flag */
160 /* LAYER_COLLECTION_DEPRECATED0 = (1 << 0), */
161 /* LAYER_COLLECTION_DEPRECATED1 = (1 << 1), */
162 /* LAYER_COLLECTION_DEPRECATED2 = (1 << 2), */
163 /* LAYER_COLLECTION_DEPRECATED3 = (1 << 3), */
169};
171
172/* Layer Collection->runtime_flag
173 * Keep it synced with base->flag based on g_base_collection_flags. */
176 /* LAYER_COLLECTION_VISIBLE_DEPSGRAPH = (1 << 1), */ /* UNUSED */
179};
181
182/* ViewLayer->flag */
183enum eViewLayer_Flag : short {
185 /* VIEW_LAYER_DEPRECATED = (1 << 1), */
189};
191
192struct Base {
193 struct Base *next = nullptr, *prev = nullptr;
194
195 struct Object *object = nullptr;
196
197 /* Pointer to an original base. Is initialized for evaluated view layer.
198 * NOTE: Only allowed to be accessed from within active dependency graph. */
199 struct Base *base_orig = nullptr;
200
201 DNA_DEPRECATED unsigned int lay = 0;
202 /* Final flags, including both accumulated collection flags and object's
203 * restriction flags. */
205 /* Flags which are based on the collections flags evaluation, does not
206 * include flags from object's restrictions. */
208 short flag_legacy = 0;
209 unsigned short local_view_bits = 0;
210 unsigned short local_collections_bits = 0;
211 char _pad1[2] = {};
212};
213
215 struct LayerCollection *next = nullptr, *prev = nullptr;
216 struct Collection *collection = nullptr;
217 void *_pad1 = nullptr;
220 char _pad[4] = {};
221
223 ListBaseT<LayerCollection> layer_collections = {nullptr, nullptr};
224
225 unsigned short local_collections_bits = 0;
226 short _pad2[3] = {};
227};
228
229/* Type containing EEVEE settings per view-layer */
236
239 struct ViewLayerAOV *next = nullptr, *prev = nullptr;
240
241 /* Name of the AOV */
242 char name[64] = "";
244 /* Type of AOV (color/value). */
246};
247
250 struct ViewLayerLightgroup *next = nullptr, *prev = nullptr;
251
252 /* Name of the Light-group. */
253 char name[64] = "";
254};
255
256/* Light-group membership information. */
258 /* Name of the Light-group. */
259 char name[64] = "";
260};
261
262struct ViewLayer {
263 struct ViewLayer *next = nullptr, *prev = nullptr;
264 char name[/*MAX_NAME*/ 64] = "";
266 char _pad[6] = {};
267 ListBaseT<Base> object_bases = {nullptr, nullptr};
269 struct SceneStats *stats = nullptr;
270 struct Base *basact = nullptr;
271
275 ListBaseT<LayerCollection> layer_collections = {nullptr, nullptr};
277
278 /* Old SceneRenderLayer data. */
286
287 int samples = 0;
288
289 struct Material *mat_override = nullptr;
290 struct World *world_override = nullptr;
292 struct IDProperty *id_properties = nullptr;
294 struct IDProperty *system_properties = nullptr;
295
298
299 ListBaseT<ViewLayerAOV> aovs = {nullptr, nullptr};
301
302 ListBaseT<ViewLayerLightgroup> lightgroups = {nullptr, nullptr};
304
306
307#ifdef __cplusplus
309 Span<Base *> object_bases_array() const;
310#endif
311};
312
313} // namespace blender
#define ENUM_OPERATORS(_enum_type)
#define DNA_DEPRECATED
Definition DNA_defs.h:21
These structs are the foundation for all linked lists in the library system.
BMesh Iterators.
@ BASE_ENABLED_VIEWPORT
@ BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT
@ BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT
Map< const Object *, Base * > ObjectBasesMap
eViewLayerGreasePencilFlags
@ GREASE_PENCIL_AS_SEPARATE_PASS
unsigned int uint32_t
Definition BKE_text.h:81
@ VIEW_LAYER_OUT_OF_SYNC
@ VIEW_LAYER_HAS_EXPORT_COLLECTIONS
@ LAYER_COLLECTION_INDIRECT_ONLY
@ LAYER_COLLECTION_EXCLUDE
@ LAYER_COLLECTION_HIDE
@ LAYER_COLLECTION_PREVIOUSLY_EXCLUDED
@ LAYER_COLLECTION_HOLDOUT
eLayerCollection_RuntimeFlag
@ LAYER_COLLECTION_VISIBLE_VIEW_LAYER
@ LAYER_COLLECTION_HIDE_VIEWPORT
@ LAYER_COLLECTION_HAS_OBJECTS
@ EEVEE_RENDER_PASS_CRYPTOMATTE_ASSET
@ EEVEE_RENDER_PASS_MIST
@ EEVEE_RENDER_PASS_SPECULAR_LIGHT
@ EEVEE_RENDER_PASS_DIFFUSE_COLOR
@ EEVEE_RENDER_PASS_DENOISING_NORMAL
@ EEVEE_RENDER_PASS_CRYPTOMATTE_MATERIAL
@ EEVEE_RENDER_PASS_ENVIRONMENT
@ EEVEE_RENDER_PASS_VECTOR
@ EEVEE_RENDER_PASS_EMIT
@ EEVEE_RENDER_PASS_CRYPTOMATTE
@ EEVEE_RENDER_PASS_AOV
@ EEVEE_RENDER_PASS_AO
@ EEVEE_RENDER_PASS_DENOISING_ROUGHNESS
@ EEVEE_RENDER_PASS_DENOISING_DIFFUSE_ALBEDO
@ EEVEE_RENDER_PASS_DEPTH
@ EEVEE_RENDER_PASS_CRYPTOMATTE_OBJECT
@ EEVEE_RENDER_PASS_COMBINED
@ EEVEE_RENDER_PASS_VOLUME_LIGHT
@ EEVEE_RENDER_PASS_DENOISING_SPECULAR_ALBEDO
@ EEVEE_RENDER_PASS_TRANSPARENT
@ EEVEE_RENDER_PASS_NORMAL
@ EEVEE_RENDER_PASS_UNUSED_8
@ EEVEE_RENDER_PASS_POSITION
@ EEVEE_RENDER_PASS_DIFFUSE_LIGHT
@ EEVEE_RENDER_PASS_SPECULAR_COLOR
@ EEVEE_RENDER_PASS_SHADOW
@ EEVEE_RENDER_PASS_UNUSED_14
@ EEVEE_RENDER_PASS_DENOISING_DEPTH
@ VIEW_LAYER_CRYPTOMATTE_ASSET
@ VIEW_LAYER_CRYPTOMATTE_ACCURATE
@ VIEW_LAYER_CRYPTOMATTE_MATERIAL
@ VIEW_LAYER_CRYPTOMATTE_OBJECT
eViewLayerEEVEEDenoisingPassFlag
@ EEVEE_DENOISING_PASS_STORE
@ EEVEE_DENOISING_PASS_USE_ALBEDO_ROUGHNESS_WEIGHTING
struct Base * prev
DNA_DEPRECATED unsigned int lay
unsigned short local_collections_bits
struct Base * base_orig
eBase_Flag flag_from_collection
struct Base * next
unsigned short local_view_bits
eLayerCollection_Flag flag
struct Collection * collection
ListBaseT< LayerCollection > layer_collections
struct LayerCollection * prev
eLayerCollection_RuntimeFlag runtime_flag
struct LayerCollection * next
unsigned short local_collections_bits
eViewLayerAOVFlag flag
struct ViewLayerAOV * next
eViewLayerAOVType type
struct ViewLayerAOV * prev
eViewLayerEEVEEPassType render_passes
struct ViewLayerLightgroup * prev
struct ViewLayerLightgroup * next
struct FreestyleConfig freestyle_config
ViewLayerRuntime * runtime
ListBaseT< LayerCollection > layer_collections
struct SceneStats * stats
ListBaseT< ViewLayerAOV > aovs
struct ViewLayer * prev
eViewLayerGreasePencilFlags grease_pencil_flags
struct ViewLayer * next
ListBaseT< ViewLayerLightgroup > lightgroups
struct IDProperty * id_properties
eViewLayerCryptomatteFlags cryptomatte_flag
eViewLayer_Flag flag
LayerCollection * active_collection
ListBaseT< Base > object_bases
struct World * world_override
struct Material * mat_override
struct IDProperty * system_properties
ViewLayerAOV * active_aov
ViewLayerLightgroup * active_lightgroup