Blender V4.3
deg_builder_nodes.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2013 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BLI_span.hh"
12
19
20#include "DEG_depsgraph.hh"
21
22struct CacheFile;
23struct Camera;
24struct Collection;
25struct FCurve;
26struct FreestyleLineSet;
28struct ID;
29struct IDProperty;
30struct Image;
31struct Key;
32struct LayerCollection;
33struct Light;
34struct LightProbe;
35struct ListBase;
36struct Main;
37struct Mask;
38struct Material;
39struct MovieClip;
40struct Object;
41struct ParticleSettings;
42struct Scene;
43struct Speaker;
44struct Tex;
45struct VFont;
46struct World;
47struct bAction;
48struct bArmature;
49struct bConstraint;
50struct bNodeSocket;
51struct bNodeTree;
52struct bPoseChannel;
53struct bSound;
54struct PointerRNA;
55
56namespace blender::deg {
57
58struct ComponentNode;
59struct Depsgraph;
61struct IDNode;
62struct OperationKey;
63struct OperationNode;
64struct TimeSourceNode;
65
67 public:
70
71 /* For given original ID get ID which is created by copy-on-evaluation system. */
72 ID *get_cow_id(const ID *id_orig) const;
73 /* Similar to above, but for the cases when there is no ID node we create
74 * one. */
75 ID *ensure_cow_id(ID *id_orig);
76
77 /* Helper wrapper function which wraps get_cow_id with a needed type cast. */
78 template<typename T> T *get_cow_datablock(const T *orig) const
79 {
80 return (T *)get_cow_id(&orig->id);
81 }
82
83 /* For a given evaluated datablock get corresponding original one. */
84 template<typename T> T *get_orig_datablock(const T *cow) const
85 {
86 return (T *)cow->id.orig_id;
87 }
88
89 virtual void begin_build();
90 virtual void end_build();
91
96 int foreach_id_cow_detect_need_for_update_callback(ID *id_cow_self, ID *id_pointer);
97
98 IDNode *add_id_node(ID *id);
99 IDNode *find_id_node(const ID *id);
101
102 ComponentNode *add_component_node(ID *id, NodeType comp_type, const char *comp_name = "");
103 ComponentNode *find_component_node(const ID *id, NodeType comp_type, const char *comp_name = "");
104
106 OperationCode opcode,
107 const DepsEvalOperationCb &op = nullptr,
108 const char *name = "",
109 int name_tag = -1);
111 NodeType comp_type,
112 const char *comp_name,
113 OperationCode opcode,
114 const DepsEvalOperationCb &op = nullptr,
115 const char *name = "",
116 int name_tag = -1);
118 NodeType comp_type,
119 OperationCode opcode,
120 const DepsEvalOperationCb &op = nullptr,
121 const char *name = "",
122 int name_tag = -1);
123
125 NodeType comp_type,
126 const char *comp_name,
127 OperationCode opcode,
128 const DepsEvalOperationCb &op = nullptr,
129 const char *name = "",
130 int name_tag = -1);
132 NodeType comp_type,
133 OperationCode opcode,
134 const DepsEvalOperationCb &op = nullptr,
135 const char *name = "",
136 int name_tag = -1);
137
138 bool has_operation_node(ID *id,
139 NodeType comp_type,
140 const char *comp_name,
141 OperationCode opcode,
142 const char *name = "",
143 int name_tag = -1);
144 bool has_operation_node(ID *id, NodeType comp_type, OperationCode opcode);
145
147 NodeType comp_type,
148 const char *comp_name,
149 OperationCode opcode,
150 const char *name = "",
151 int name_tag = -1);
152
154 NodeType comp_type,
155 OperationCode opcode,
156 const char *name = "",
157 int name_tag = -1);
158
160
161 virtual void build_id(ID *id, bool force_be_visible = false);
162
163 /* Build function for ID types that do not need their own build_xxx() function. */
164 virtual void build_generic_id(ID *id);
165
166 virtual void build_idproperties(IDProperty *id_property);
167
168 virtual void build_scene_render(Scene *scene, ViewLayer *view_layer);
169 virtual void build_scene_camera(Scene *scene);
170 virtual void build_scene_parameters(Scene *scene);
171 virtual void build_scene_compositor(Scene *scene);
172
173 virtual void build_layer_collections(ListBase *lb);
174 virtual void build_view_layer(Scene *scene,
175 ViewLayer *view_layer,
176 eDepsNode_LinkedState_Type linked_state);
177 virtual void build_collection(LayerCollection *from_layer_collection, Collection *collection);
178 virtual void build_object(int base_index,
179 Object *object,
180 eDepsNode_LinkedState_Type linked_state,
181 bool is_visible);
182 virtual void build_object_instance_collection(Object *object, bool is_object_visible);
183 virtual void build_object_from_layer(int base_index,
184 Object *object,
185 eDepsNode_LinkedState_Type linked_state);
186 virtual void build_object_flags(int base_index,
187 Object *object,
188 eDepsNode_LinkedState_Type linked_state);
189 virtual void build_object_modifiers(Object *object);
190 virtual void build_object_data(Object *object);
191 virtual void build_object_data_camera(Object *object);
192 virtual void build_object_data_geometry(Object *object);
193 virtual void build_object_data_geometry_datablock(ID *obdata);
194 virtual void build_object_data_light(Object *object);
195 virtual void build_object_data_lightprobe(Object *object);
196 virtual void build_object_data_speaker(Object *object);
197 virtual void build_object_data_grease_pencil(Object *object);
198 virtual void build_object_transform(Object *object);
199 virtual void build_object_constraints(Object *object);
200 virtual void build_object_pointcache(Object *object);
201 virtual void build_object_shading(Object *object);
202
203 virtual void build_object_light_linking(Object *object);
204 virtual void build_light_linking_collection(Collection *collection);
205
206 virtual void build_pose_constraints(Object *object, bPoseChannel *pchan, int pchan_index);
207 virtual void build_rigidbody(Scene *scene);
208 virtual void build_particle_systems(Object *object, bool is_object_visible);
209 virtual void build_particle_settings(ParticleSettings *part);
214 virtual void build_animdata(ID *id);
215 virtual void build_animdata_nlastrip_targets(ListBase *strips);
219 virtual void build_animation_images(ID *id);
220 virtual void build_action(bAction *action);
221
228 virtual void build_driver(ID *id, FCurve *fcurve, int driver_index);
229
230 virtual void build_driver_variables(ID *id, FCurve *fcurve);
231 virtual void build_driver_scene_camera_variable(Scene *scene, const char *camera_path);
232
233 /* Build operations of a property value from which is read by a driver target.
234 *
235 * The driver target points to a data-block (or a sub-data-block like View Layer).
236 * This data-block is presented in the interface as a "Prop" and its resolved RNA pointer is
237 * passed here as `target_prop`.
238 *
239 * The tricky part (and a bit confusing naming) is that the driver target accesses a property of
240 * the `target_prop` to get its value. The property which is read to give an actual target value
241 * is denoted by its RNA path relative to the `target_prop`. In the interface it is called "Path"
242 * and here it is called `rna_path_from_target_prop`. */
243 virtual void build_driver_id_property(const PointerRNA &target_prop,
244 const char *rna_path_from_target_prop);
245
246 virtual void build_parameters(ID *id);
247 virtual void build_dimensions(Object *object);
249 virtual void build_ik_pose(Object *object, bPoseChannel *pchan, bConstraint *con);
251 virtual void build_splineik_pose(Object *object, bPoseChannel *pchan, bConstraint *con);
253 virtual void build_rig(Object *object);
254 virtual void build_armature(bArmature *armature);
255 virtual void build_armature_bones(ListBase *bones);
258 virtual void build_shapekeys(Key *key);
259 virtual void build_camera(Camera *camera);
260 virtual void build_light(Light *lamp);
261 virtual void build_nodetree(bNodeTree *ntree);
262 virtual void build_nodetree_socket(bNodeSocket *socket);
264 virtual void build_material(Material *ma);
265 virtual void build_materials(Material **materials, int num_materials);
266 virtual void build_freestyle_lineset(FreestyleLineSet *fls);
267 virtual void build_freestyle_linestyle(FreestyleLineStyle *linestyle);
269 virtual void build_texture(Tex *tex);
270 virtual void build_image(Image *image);
272 virtual void build_world(World *world);
273 virtual void build_cachefile(CacheFile *cache_file);
274 virtual void build_mask(Mask *mask);
275 virtual void build_movieclip(MovieClip *clip);
276 virtual void build_lightprobe(LightProbe *probe);
277 virtual void build_speaker(Speaker *speaker);
278 virtual void build_sound(bSound *sound);
279 virtual void build_scene_sequencer(Scene *scene);
280 virtual void build_scene_audio(Scene *scene);
281 virtual void build_scene_speakers(Scene *scene, ViewLayer *view_layer);
282 virtual void build_vfont(VFont *vfont);
283
284 /* Per-ID information about what was already in the dependency graph.
285 * Allows to re-use certain values, to speed up following evaluation. */
286 struct IDInfo {
287 /* Copy-on-written pointer of the corresponding ID. */
289 /* Mask of visible components from previous state of the
290 * dependency graph. */
292 /* Special evaluation flag mask from the previous depsgraph. */
294 /* Mesh CustomData mask from the previous depsgraph. */
296 };
297
298 protected:
299 /* Entry tags and non-updated operations from the previous state of the dependency graph.
300 * The entry tags are operations which were directly tagged, the matching operations from the
301 * new dependency graph will be tagged. The needs-update operations are possibly indirectly
302 * modified operations, whose complementary part from the new dependency graph will only be
303 * marked as needs-update.
304 * Stored before the graph is re-created so that they can be transferred over. */
307
311 static void modifier_walk(void *user_data,
312 struct Object *object,
313 struct ID **idpoin,
314 int cb_flag);
315 static void constraint_walk(bConstraint *constraint,
316 ID **idpoin,
317 bool is_reference,
318 void *user_data);
319
326
327 /* State which demotes currently built entities. */
331 /* NOTE: Collection are possibly built recursively, so be careful when
332 * setting the current state. */
333 /* Accumulated flag over the hierarchy of currently building collections.
334 * Denotes whether all the hierarchy from parent of `collection_` to the
335 * very root is visible (aka not restricted.). */
337
338 /* Indexed by original ID.session_uid, values are IDInfo. */
340
341 /* Set of IDs which were already build. Makes it easier to keep track of
342 * what was already built and what was not. */
344};
345
346} // namespace blender::deg
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between world
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
DepsgraphBuilder(Main *bmain, Depsgraph *graph, DepsgraphBuilderCache *cache)
ComponentNode * find_component_node(const ID *id, NodeType comp_type, const char *comp_name="")
virtual void build_scene_parameters(Scene *scene)
virtual void build_scene_sequencer(Scene *scene)
virtual void build_object_data_camera(Object *object)
virtual void build_object_data_geometry(Object *object)
virtual void build_pose_constraints(Object *object, bPoseChannel *pchan, int pchan_index)
virtual void build_object_pointcache(Object *object)
static void modifier_walk(void *user_data, struct Object *object, struct ID **idpoin, int cb_flag)
virtual void build_world(World *world)
virtual void build_object(int base_index, Object *object, eDepsNode_LinkedState_Type linked_state, bool is_visible)
OperationNode * ensure_operation_node(ID *id, NodeType comp_type, const char *comp_name, OperationCode opcode, const DepsEvalOperationCb &op=nullptr, const char *name="", int name_tag=-1)
virtual void build_id(ID *id, bool force_be_visible=false)
virtual void build_freestyle_linestyle(FreestyleLineStyle *linestyle)
virtual void build_scene_speakers(Scene *scene, ViewLayer *view_layer)
virtual void build_cachefile(CacheFile *cache_file)
virtual void build_object_instance_collection(Object *object, bool is_object_visible)
virtual void build_object_data_speaker(Object *object)
OperationNode * add_operation_node(ComponentNode *comp_node, OperationCode opcode, const DepsEvalOperationCb &op=nullptr, const char *name="", int name_tag=-1)
virtual void build_vfont(VFont *vfont)
OperationNode * find_operation_node(const ID *id, NodeType comp_type, const char *comp_name, OperationCode opcode, const char *name="", int name_tag=-1)
virtual void build_object_data(Object *object)
virtual void build_particle_settings(ParticleSettings *part)
static void constraint_walk(bConstraint *constraint, ID **idpoin, bool is_reference, void *user_data)
virtual void build_scene_camera(Scene *scene)
virtual void build_driver_id_property(const PointerRNA &target_prop, const char *rna_path_from_target_prop)
virtual void build_particle_systems(Object *object, bool is_object_visible)
virtual void build_dimensions(Object *object)
virtual void build_armature(bArmature *armature)
virtual void build_scene_audio(Scene *scene)
ComponentNode * add_component_node(ID *id, NodeType comp_type, const char *comp_name="")
virtual void build_driver_variables(ID *id, FCurve *fcurve)
T * get_orig_datablock(const T *cow) const
virtual void build_action(bAction *action)
virtual void build_driver_scene_camera_variable(Scene *scene, const char *camera_path)
virtual void build_animdata_nlastrip_targets(ListBase *strips)
virtual void build_material(Material *ma)
virtual void build_materials(Material **materials, int num_materials)
virtual void build_collection(LayerCollection *from_layer_collection, Collection *collection)
virtual void build_rigidbody(Scene *scene)
virtual void build_object_transform(Object *object)
virtual void build_light_linking_collection(Collection *collection)
virtual void build_freestyle_lineset(FreestyleLineSet *fls)
virtual void build_movieclip(MovieClip *clip)
T * get_cow_datablock(const T *orig) const
virtual void build_object_data_light(Object *object)
virtual void build_ik_pose(Object *object, bPoseChannel *pchan, bConstraint *con)
virtual void build_scene_render(Scene *scene, ViewLayer *view_layer)
virtual void build_image(Image *image)
virtual void build_speaker(Speaker *speaker)
virtual void build_sound(bSound *sound)
Vector< PersistentOperationKey > needs_update_operations_
virtual void build_object_data_geometry_datablock(ID *obdata)
DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph, DepsgraphBuilderCache *cache)
Vector< PersistentOperationKey > saved_entry_tags_
virtual void build_object_flags(int base_index, Object *object, eDepsNode_LinkedState_Type linked_state)
ID * get_cow_id(const ID *id_orig) const
virtual void build_rig(Object *object)
virtual void build_lightprobe(LightProbe *probe)
int foreach_id_cow_detect_need_for_update_callback(ID *id_cow_self, ID *id_pointer)
virtual void build_nodetree(bNodeTree *ntree)
virtual void build_splineik_pose(Object *object, bPoseChannel *pchan, bConstraint *con)
virtual void build_idproperties(IDProperty *id_property)
virtual void build_camera(Camera *camera)
virtual void build_light(Light *lamp)
virtual void build_armature_bones(ListBase *bones)
virtual void build_driver(ID *id, FCurve *fcurve, int driver_index)
virtual void build_object_light_linking(Object *object)
bool has_operation_node(ID *id, NodeType comp_type, const char *comp_name, OperationCode opcode, const char *name="", int name_tag=-1)
virtual void build_view_layer(Scene *scene, ViewLayer *view_layer, eDepsNode_LinkedState_Type linked_state)
virtual void build_nodetree_socket(bNodeSocket *socket)
virtual void build_armature_bone_collections(blender::Span< BoneCollection * > collections)
virtual void build_scene_compositor(Scene *scene)
virtual void build_object_data_lightprobe(Object *object)
virtual void build_object_data_grease_pencil(Object *object)
virtual void build_object_constraints(Object *object)
virtual void build_object_shading(Object *object)
virtual void build_object_modifiers(Object *object)
virtual void build_object_from_layer(int base_index, Object *object, eDepsNode_LinkedState_Type linked_state)
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
ccl_device_inline float4 mask(const int4 mask, const float4 a)
uint64_t IDComponentsMask
function< void(::Depsgraph *)> DepsEvalOperationCb
unsigned int uint32_t
Definition stdint.h:80
Definition DNA_ID.h:413