Blender  V3.3
DEG_depsgraph_query.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2013 Blender Foundation. All rights reserved. */
3 
10 #pragma once
11 
12 #include "BLI_iterator.h"
13 
14 #include "DEG_depsgraph.h"
15 #include "DEG_depsgraph_build.h"
16 
17 /* Needed for the instance iterator. */
18 #include "DNA_object_types.h"
19 
20 struct BLI_Iterator;
22 struct Depsgraph;
23 struct DupliObject;
24 struct ID;
25 struct ListBase;
26 struct PointerRNA;
27 struct Scene;
28 struct ViewLayer;
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /* -------------------------------------------------------------------- */
40 
43 
45 struct Main *DEG_get_bmain(const Depsgraph *graph);
46 
49 
51 float DEG_get_ctime(const Depsgraph *graph);
52 
55 /* -------------------------------------------------------------------- */
60 bool DEG_id_type_updated(const struct Depsgraph *depsgraph, short id_type);
62 
64 bool DEG_id_type_any_exists(const struct Depsgraph *depsgraph, short id_type);
65 
67 uint32_t DEG_get_eval_flags_for_id(const struct Depsgraph *graph, const struct ID *id);
68 
71  struct Object *object,
72  struct CustomData_MeshMasks *r_mask);
73 
82 
88 
90 struct Object *DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object);
91 
93 struct ID *DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id);
94 
97  struct PointerRNA *ptr,
98  struct PointerRNA *r_ptr_eval);
99 
101 struct Object *DEG_get_original_object(struct Object *object);
102 
104 struct ID *DEG_get_original_id(struct ID *id);
105 
112 bool DEG_is_original_id(const struct ID *id);
113 bool DEG_is_original_object(const struct Object *object);
114 
115 /* Opposite of the above.
116  *
117  * If the data-block is not original it must be evaluated, and vice versa. */
118 
119 bool DEG_is_evaluated_id(const struct ID *id);
120 bool DEG_is_evaluated_object(const struct Object *object);
121 
127 bool DEG_is_fully_evaluated(const struct Depsgraph *depsgraph);
128 
131 /* -------------------------------------------------------------------- */
135 enum {
141 };
142 
143 typedef struct DEGObjectIterData {
144  struct Depsgraph *graph;
145  int flag;
146 
147  struct Scene *scene;
148 
150 
152 
153  /* **** Iteration over dupli-list. *** */
154 
155  /* Object which created the dupli-list. */
157  /* List of duplicated objects. */
159  /* Next duplicated object to step into. */
161  /* Corresponds to current object: current iterator object is evaluated from
162  * this duplicated object. */
164  /* Temporary storage to report fully populated DNA to the render engine or
165  * other users of the iterator. */
166  struct Object temp_dupli_object;
167 
168  /* **** Iteration over ID nodes **** */
170  size_t num_id_nodes;
172 
174 void DEG_iterator_objects_next(struct BLI_Iterator *iter);
175 void DEG_iterator_objects_end(struct BLI_Iterator *iter);
176 
182 #define DEG_OBJECT_ITER_BEGIN(graph_, instance_, flag_) \
183  { \
184  DEGObjectIterData data_ = { \
185  graph_, \
186  flag_, \
187  }; \
188 \
189  ITER_BEGIN (DEG_iterator_objects_begin, \
190  DEG_iterator_objects_next, \
191  DEG_iterator_objects_end, \
192  &data_, \
193  Object *, \
194  instance_)
195 
196 #define DEG_OBJECT_ITER_END \
197  ITER_END; \
198  } \
199  ((void)0)
200 
204 #define DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(graph_, instance_) \
205  DEG_OBJECT_ITER_BEGIN (graph_, \
206  instance_, \
207  DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | \
208  DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | DEG_ITER_OBJECT_FLAG_VISIBLE | \
209  DEG_ITER_OBJECT_FLAG_DUPLI)
210 
211 #define DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END DEG_OBJECT_ITER_END
212 
215 /* -------------------------------------------------------------------- */
219 typedef struct DEGIDIterData {
220  struct Depsgraph *graph;
222 
224  size_t num_id_nodes;
226 
228 void DEG_iterator_ids_next(struct BLI_Iterator *iter);
230 
233 /* -------------------------------------------------------------------- */
240  void *user_data);
241 
247  const ID *id,
249  void *user_data);
251  const ID *id,
253  void *user_data);
254 
259 enum {
260  /* Ignore transform solvers which depends on multiple inputs and affects final transform.
261  * Is used for cases like snapping objects which are part of a rigid body simulation:
262  * without this there will be "false-positive" dependencies between transform components of
263  * objects:
264  *
265  * object 1 transform before solver ---> solver ------> object 1 final transform
266  * object 2 transform before solver -----^ \------> object 2 final transform
267  */
269 };
271  const ID *id,
272  eDepsObjectComponentType source_component_type,
273  int flags,
275  void *user_data);
276 
278 
281 #ifdef __cplusplus
282 } /* extern "C" */
283 #endif
static uint8 component(Color32 c, uint i)
Definition: ColorBlock.cpp:108
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
eEvaluationMode
Definition: DEG_depsgraph.h:44
eDepsObjectComponentType
void DEG_iterator_objects_next(struct BLI_Iterator *iter)
float DEG_get_ctime(const Depsgraph *graph)
void DEG_foreach_dependent_ID_component(const Depsgraph *depsgraph, const ID *id, eDepsObjectComponentType source_component_type, int flags, DEGForeachIDComponentCallback callback, void *user_data)
struct Scene * DEG_get_input_scene(const Depsgraph *graph)
void DEG_iterator_ids_begin(struct BLI_Iterator *iter, DEGIDIterData *data)
bool DEG_is_fully_evaluated(const struct Depsgraph *depsgraph)
bool DEG_id_type_any_exists(const struct Depsgraph *depsgraph, short id_type)
struct DEGIDIterData DEGIDIterData
void DEG_get_evaluated_rna_pointer(const struct Depsgraph *depsgraph, struct PointerRNA *ptr, struct PointerRNA *r_ptr_eval)
@ DEG_FOREACH_COMPONENT_IGNORE_TRANSFORM_SOLVERS
void DEG_foreach_ID(const Depsgraph *depsgraph, DEGForeachIDCallback callback, void *user_data)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
bool DEG_id_type_any_updated(const struct Depsgraph *depsgraph)
void DEG_iterator_ids_end(struct BLI_Iterator *iter)
struct Object * DEG_get_original_object(struct Object *object)
bool DEG_is_original_object(const struct Object *object)
bool DEG_is_original_id(const struct ID *id)
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)
bool DEG_is_evaluated_object(const struct Object *object)
@ 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
void DEG_foreach_dependent_ID(const Depsgraph *depsgraph, const ID *id, DEGForeachIDCallback callback, void *user_data)
struct ViewLayer * DEG_get_evaluated_view_layer(const struct Depsgraph *graph)
void DEG_iterator_objects_end(struct BLI_Iterator *iter)
struct ID * DEG_get_original_id(struct ID *id)
uint32_t DEG_get_eval_flags_for_id(const struct Depsgraph *graph, const struct ID *id)
bool DEG_is_evaluated_id(const struct ID *id)
void DEG_iterator_objects_begin(struct BLI_Iterator *iter, DEGObjectIterData *data)
void DEG_iterator_ids_next(struct BLI_Iterator *iter)
struct Main * DEG_get_bmain(const Depsgraph *graph)
void(* DEGForeachIDComponentCallback)(ID *id, eDepsObjectComponentType component, void *user_data)
struct ViewLayer * DEG_get_input_view_layer(const Depsgraph *graph)
bool DEG_id_type_updated(const struct Depsgraph *depsgraph, short id_type)
void(* DEGForeachIDCallback)(ID *id, void *user_data)
void DEG_get_customdata_mask_for_object(const struct Depsgraph *graph, struct Object *object, struct CustomData_MeshMasks *r_mask)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
void DEG_foreach_ancestor_ID(const Depsgraph *depsgraph, const ID *id, DEGForeachIDCallback callback, void *user_data)
struct DEGObjectIterData DEGObjectIterData
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
Object is a sort of wrapper for general info.
Depsgraph * graph
const Depsgraph * depsgraph
void * user_data
DEGForeachIDComponentCallback callback
SyclQueue void void size_t num_bytes void
unsigned int uint32_t
Definition: stdint.h:80
struct Depsgraph * graph
struct Object * next_object
eEvaluationMode eval_mode
struct Object temp_dupli_object
struct Depsgraph * graph
struct DupliObject * dupli_object_next
struct Object * dupli_parent
struct ListBase * dupli_list
struct DupliObject * dupli_object_current
Definition: DNA_ID.h:368
Definition: BKE_main.h:121
PointerRNA * ptr
Definition: wm_files.c:3480