Blender V4.3
DEG_depsgraph_query.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2013 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11#pragma once
12
13#include "BLI_function_ref.hh"
14#include "BLI_iterator.h"
15#include "BLI_set.hh"
16#include "BLI_utildefines.h"
17
18#include "DEG_depsgraph.hh"
20
21/* Needed for the instance iterator. */
22#include "DNA_object_types.h"
23
24#include "BKE_object_types.hh"
25
26struct BLI_Iterator;
28struct Depsgraph;
29struct DupliObject;
30struct ID;
31struct ListBase;
32struct PointerRNA;
33struct Scene;
34struct ViewLayer;
35struct ViewerPath;
36
37/* -------------------------------------------------------------------- */
42Scene *DEG_get_input_scene(const Depsgraph *graph);
43
45ViewLayer *DEG_get_input_view_layer(const Depsgraph *graph);
46
48Main *DEG_get_bmain(const Depsgraph *graph);
49
51eEvaluationMode DEG_get_mode(const Depsgraph *graph);
52
54float DEG_get_ctime(const Depsgraph *graph);
55
58/* -------------------------------------------------------------------- */
63bool DEG_id_type_updated(const Depsgraph *depsgraph, short id_type);
64bool DEG_id_type_any_updated(const Depsgraph *depsgraph);
65
67bool DEG_id_type_any_exists(const Depsgraph *depsgraph, short id_type);
68
70uint32_t DEG_get_eval_flags_for_id(const Depsgraph *graph, const ID *id);
71
73void DEG_get_customdata_mask_for_object(const Depsgraph *graph,
74 Object *object,
75 CustomData_MeshMasks *r_mask);
76
84Scene *DEG_get_evaluated_scene(const Depsgraph *graph);
85
90ViewLayer *DEG_get_evaluated_view_layer(const Depsgraph *graph);
91
93Object *DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object);
94
96ID *DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id);
97
99void DEG_get_evaluated_rna_pointer(const Depsgraph *depsgraph,
101 PointerRNA *r_ptr_eval);
102
105
108
117Depsgraph *DEG_get_depsgraph_by_id(const ID &id);
118
125bool DEG_is_original_id(const ID *id);
126bool DEG_is_original_object(const Object *object);
127
128/* Opposite of the above (`DEG_is_original_*`).
129 *
130 * If the data-block is not original it must be evaluated, and vice versa. */
131
132bool DEG_is_evaluated_id(const ID *id);
133bool DEG_is_evaluated_object(const Object *object);
134
140bool DEG_is_fully_evaluated(const Depsgraph *depsgraph);
141
146bool DEG_id_is_fully_evaluated(const Depsgraph *depsgraph, const ID *id_eval);
147
158bool DEG_object_geometry_is_evaluated(const Object &object);
159
164bool DEG_object_transform_is_evaluated(const Object &object);
165
171
174/* -------------------------------------------------------------------- */
186
210
214#define DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS \
215 DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | \
216 DEG_ITER_OBJECT_FLAG_VISIBLE | DEG_ITER_OBJECT_FLAG_DUPLI
217
220 Depsgraph *graph;
221 int flag;
222
224
226
229
231
232 /* **** Iteration over dupli-list. *** */
233
234 /* Object which created the dupli-list. */
236 /* List of duplicated objects. */
238 /* Next duplicated object to step into. */
240 /* Corresponds to current object: current iterator object is evaluated from
241 * this duplicated object. */
243 /* Temporary storage to report fully populated DNA to the render engine or
244 * other users of the iterator. */
247
248 /* **** Iteration over ID nodes **** */
252};
253
257
258#define DEG_OBJECT_ITER_BEGIN(settings_, instance_) \
259 { \
260 DEGObjectIterData data_ = { \
261 (settings_), \
262 (settings_)->depsgraph, \
263 (int)(settings_)->flags, \
264 }; \
265\
266 ITER_BEGIN (DEG_iterator_objects_begin, \
267 DEG_iterator_objects_next, \
268 DEG_iterator_objects_end, \
269 &data_, \
270 Object *, \
271 instance_)
272
273#define DEG_OBJECT_ITER_END \
274 ITER_END; \
275 } \
276 ((void)0)
277
280/* -------------------------------------------------------------------- */
285 Depsgraph *graph;
287
290};
291
295
298/* -------------------------------------------------------------------- */
305
310void DEG_foreach_ancestor_ID(const Depsgraph *depsgraph,
311 const ID *id,
313void DEG_foreach_dependent_ID(const Depsgraph *depsgraph,
314 const ID *id,
316
321enum {
322 /* Ignore transform solvers which depends on multiple inputs and affects final transform.
323 * Is used for cases like snapping objects which are part of a rigid body simulation:
324 * without this there will be "false-positive" dependencies between transform components of
325 * objects:
326 *
327 * object 1 transform before solver ---> solver ------> object 1 final transform
328 * object 2 transform before solver -----^ \------> object 2 final transform
329 */
331};
333 const ID *id,
334 eDepsObjectComponentType source_component_type,
335 int flags,
337
339
#define ENUM_OPERATORS(_type, _max)
eEvaluationMode
eDepsObjectComponentType
float DEG_get_ctime(const Depsgraph *graph)
bool DEG_object_transform_is_evaluated(const Object &object)
uint32_t DEG_get_eval_flags_for_id(const Depsgraph *graph, const ID *id)
void DEG_foreach_ID(const Depsgraph *depsgraph, DEGForeachIDCallback callback)
bool DEG_id_is_fully_evaluated(const Depsgraph *depsgraph, const ID *id_eval)
bool DEG_is_fully_evaluated(const Depsgraph *depsgraph)
bool DEG_is_evaluated_id(const ID *id)
void DEG_iterator_ids_begin(BLI_Iterator *iter, DEGIDIterData *data)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
bool DEG_id_type_updated(const Depsgraph *depsgraph, short id_type)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
bool DEG_is_original_id(const ID *id)
ID * DEG_get_original_id(ID *id)
void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data)
void DEG_iterator_objects_end(BLI_Iterator *iter)
void DEG_foreach_dependent_ID_component(const Depsgraph *depsgraph, const ID *id, eDepsObjectComponentType source_component_type, int flags, DEGForeachIDComponentCallback callback)
Depsgraph * DEG_get_depsgraph_by_id(const ID &id)
bool DEG_object_geometry_is_evaluated(const Object &object)
void DEG_iterator_ids_end(BLI_Iterator *iter)
ViewLayer * DEG_get_evaluated_view_layer(const Depsgraph *graph)
ViewLayer * DEG_get_input_view_layer(const Depsgraph *graph)
void DEG_foreach_dependent_ID(const Depsgraph *depsgraph, const ID *id, DEGForeachIDCallback callback)
Main * DEG_get_bmain(const Depsgraph *graph)
void DEG_iterator_objects_next(BLI_Iterator *iter)
bool DEG_id_type_any_updated(const Depsgraph *depsgraph)
void DEG_iterator_ids_next(BLI_Iterator *iter)
bool DEG_is_original_object(const Object *object)
Scene * DEG_get_input_scene(const Depsgraph *graph)
Object * DEG_get_original_object(Object *object)
bool DEG_id_type_any_exists(const Depsgraph *depsgraph, short id_type)
void DEG_get_evaluated_rna_pointer(const Depsgraph *depsgraph, PointerRNA *ptr, PointerRNA *r_ptr_eval)
ID * DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id)
bool DEG_collection_geometry_is_evaluated(const Collection &collection)
@ DEG_FOREACH_COMPONENT_IGNORE_TRANSFORM_SOLVERS
void DEG_foreach_ancestor_ID(const Depsgraph *depsgraph, const ID *id, DEGForeachIDCallback callback)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
bool DEG_is_evaluated_object(const Object *object)
void DEG_get_customdata_mask_for_object(const Depsgraph *graph, Object *object, CustomData_MeshMasks *r_mask)
@ DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY
@ DEG_ITER_OBJECT_FLAG_VISIBLE
@ DEG_ITER_OBJECT_FLAG_DUPLI
@ DEG_ITER_OBJECT_FLAG_LINKED_INDIRECTLY
@ DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET
Object is a sort of wrapper for general info.
const Depsgraph * depsgraph
DEGForeachIDComponentCallback callback
unsigned int uint32_t
Definition stdint.h:80
DEGObjectIterSettings * settings
eEvaluationMode eval_mode
DEGObjectIterData & operator=(const DEGObjectIterData &other)
DupliObject * dupli_object_next
DupliObject * dupli_object_current
blender::bke::ObjectRuntime temp_dupli_object_runtime
blender::Set< const Object * > * included_objects
const ViewerPath * viewer_path
Definition DNA_ID.h:413
PointerRNA * ptr
Definition wm_files.cc:4126