Blender  V2.93
DEG_depsgraph_build.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2013 Blender Foundation.
17  * All rights reserved.
18  */
19 
26 #pragma once
27 
28 /* ************************************************* */
29 
30 /* Dependency Graph */
31 struct Depsgraph;
32 
33 /* ------------------------------------------------ */
34 
35 struct CacheFile;
37 struct ID;
38 struct Main;
39 struct Object;
40 struct Scene;
41 struct Simulation;
42 struct bNodeTree;
43 struct Collection;
44 
45 #include "BLI_sys_types.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 /* Graph Building -------------------------------- */
52 
53 /* Build depsgraph for the given scene, and dump results in given graph container. */
55 
56 /* Build depsgraph for all objects (so also invisible ones) in the given view layer. */
58 
59 /* Special version of builder which produces dependency graph suitable for the render pipeline.
60  * It will contain sequencer and compositor (if needed) and all their dependencies. */
62 
63 /* Builds minimal dependency graph for compositor preview.
64  *
65  * Note that compositor editor might have pinned node tree, which is different from scene's node
66  * tree.
67  */
68 void DEG_graph_build_for_compositor_preview(struct Depsgraph *graph, struct bNodeTree *nodetree);
69 
70 void DEG_graph_build_from_ids(struct Depsgraph *graph, struct ID **ids, const int num_ids);
71 
72 /* Tag relations from the given graph for update. */
74 
75 /* Create or update relations in the specified graph. */
77 
78 /* Tag all relations in the database for update.*/
79 void DEG_relations_tag_update(struct Main *bmain);
80 
81 /* Add Dependencies ----------------------------- */
82 
83 /* Handle for components to define their dependencies from callbacks.
84  * This is generated by the depsgraph and passed to dependency callbacks
85  * as a symbolic reference to the current DepsNode.
86  * All relations will be defined in reference to that node.
87  */
88 struct DepsNodeHandle;
89 
91  /* Parameters Component - Default when nothing else fits
92  * (i.e. just SDNA property setting). */
94  /* Animation Component
95  * TODO(sergey): merge in with parameters? */
97  /* Sequencer Component (Scene Only). */
100 
102  /* Used in query API, to denote which component caller is interested in. */
104 
105  /* Parameters Component - Default when nothing else fits
106  * (i.e. just SDNA property setting). */
108  /* Generic "Proxy-Inherit" Component.
109  * TODO(sergey): Also for instancing of subgraphs? */
111  /* Animation Component.
112  *
113  * TODO(sergey): merge in with parameters? */
115  /* Transform Component (Parenting/Constraints) */
117  /* Geometry Component (Mesh/Displist) */
119 
120  /* Evaluation-Related Outer Types (with Sub-data) */
121 
122  /* Pose Component - Owner/Container of Bones Eval */
124  /* Bone Component - Child/Sub-component of Pose */
126 
127  /* Material Shading Component */
129  /* Cache Component */
132 
133 void DEG_add_scene_relation(struct DepsNodeHandle *node_handle,
134  struct Scene *scene,
136  const char *description);
137 void DEG_add_object_relation(struct DepsNodeHandle *node_handle,
138  struct Object *object,
140  const char *description);
141 void DEG_add_collection_geometry_relation(struct DepsNodeHandle *node_handle,
142  struct Collection *collection,
143  const char *description);
144 void DEG_add_collection_geometry_customdata_mask(struct DepsNodeHandle *node_handle,
145  struct Collection *collection,
146  const struct CustomData_MeshMasks *masks);
147 void DEG_add_simulation_relation(struct DepsNodeHandle *node_handle,
148  struct Simulation *simulation,
149  const char *description);
150 void DEG_add_node_tree_relation(struct DepsNodeHandle *node_handle,
151  struct bNodeTree *node_tree,
152  const char *description);
153 void DEG_add_bone_relation(struct DepsNodeHandle *handle,
154  struct Object *object,
155  const char *bone_name,
157  const char *description);
158 void DEG_add_object_cache_relation(struct DepsNodeHandle *handle,
159  struct CacheFile *cache_file,
161  const char *description);
162 /* Adds relation from DEG_OPCODE_GENERIC_DATABLOCK_UPDATE of a given ID.
163  * Is used for such entities as textures and images. */
164 void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle,
165  struct ID *id,
166  const char *description);
167 
168 /* Special function which is used from modifiers' updateDepsgraph() callback
169  * to indicate that the modifier needs to know transformation of the object
170  * which that modifier belongs to.
171  * This function will take care of checking which operation is required to
172  * have transformation for the modifier, taking into account possible simulation
173  * solvers. */
174 void DEG_add_modifier_to_transform_relation(struct DepsNodeHandle *node_handle,
175  const char *description);
176 
177 /* Adds relations from the given component of a given object to the given node
178  * handle AND the component to the point cache component of the node's ID. */
179 void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
180  struct Object *object,
182  const char *description);
183 
184 void DEG_add_special_eval_flag(struct DepsNodeHandle *handle, struct ID *id, uint32_t flag);
185 void DEG_add_customdata_mask(struct DepsNodeHandle *handle,
186  struct Object *object,
187  const struct CustomData_MeshMasks *masks);
188 
189 struct ID *DEG_get_id_from_handle(struct DepsNodeHandle *node_handle);
190 struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *node_handle);
191 
192 bool DEG_object_has_geometry_component(struct Object *object);
193 
194 /* ************************************************ */
195 
196 #ifdef __cplusplus
197 } /* extern "C" */
198 #endif
static uint8 component(Color32 c, uint i)
Definition: ColorBlock.cpp:126
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
void DEG_graph_build_from_view_layer(struct Depsgraph *graph)
eDepsSceneComponentType
@ DEG_SCENE_COMP_ANIMATION
@ DEG_SCENE_COMP_PARAMETERS
@ DEG_SCENE_COMP_SEQUENCER
void DEG_add_node_tree_relation(struct DepsNodeHandle *node_handle, struct bNodeTree *node_tree, const char *description)
void DEG_graph_tag_relations_update(struct Depsgraph *graph)
void DEG_add_object_relation(struct DepsNodeHandle *node_handle, struct Object *object, eDepsObjectComponentType component, const char *description)
void DEG_add_modifier_to_transform_relation(struct DepsNodeHandle *node_handle, const char *description)
void DEG_add_collection_geometry_customdata_mask(struct DepsNodeHandle *node_handle, struct Collection *collection, const struct CustomData_MeshMasks *masks)
void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle, struct ID *id, const char *description)
void DEG_add_customdata_mask(struct DepsNodeHandle *handle, struct Object *object, const struct CustomData_MeshMasks *masks)
void DEG_add_collection_geometry_relation(struct DepsNodeHandle *node_handle, struct Collection *collection, const char *description)
void DEG_graph_build_for_compositor_preview(struct Depsgraph *graph, struct bNodeTree *nodetree)
struct ID * DEG_get_id_from_handle(struct DepsNodeHandle *node_handle)
void DEG_graph_build_for_render_pipeline(struct Depsgraph *graph)
void DEG_add_scene_relation(struct DepsNodeHandle *node_handle, struct Scene *scene, eDepsSceneComponentType component, const char *description)
eDepsObjectComponentType
@ DEG_OB_COMP_ANY
@ DEG_OB_COMP_EVAL_POSE
@ DEG_OB_COMP_GEOMETRY
@ DEG_OB_COMP_ANIMATION
@ DEG_OB_COMP_TRANSFORM
@ DEG_OB_COMP_SHADING
@ DEG_OB_COMP_PROXY
@ DEG_OB_COMP_PARAMETERS
@ DEG_OB_COMP_CACHE
@ DEG_OB_COMP_BONE
void DEG_relations_tag_update(struct Main *bmain)
void DEG_graph_build_for_all_objects(struct Depsgraph *graph)
void DEG_graph_build_from_ids(struct Depsgraph *graph, struct ID **ids, const int num_ids)
void DEG_graph_relations_update(struct Depsgraph *graph)
bool DEG_object_has_geometry_component(struct Object *object)
void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle, struct Object *object, eDepsObjectComponentType component, const char *description)
void DEG_add_simulation_relation(struct DepsNodeHandle *node_handle, struct Simulation *simulation, const char *description)
void DEG_add_special_eval_flag(struct DepsNodeHandle *handle, struct ID *id, uint32_t flag)
void DEG_add_object_cache_relation(struct DepsNodeHandle *handle, struct CacheFile *cache_file, eDepsObjectComponentType component, const char *description)
void DEG_add_bone_relation(struct DepsNodeHandle *handle, struct Object *object, const char *bone_name, eDepsObjectComponentType component, const char *description)
struct Depsgraph * DEG_get_graph_from_handle(struct DepsNodeHandle *node_handle)
Depsgraph * graph
Scene scene
Simulation simulation
unsigned int uint32_t
Definition: stdint.h:83
Definition: DNA_ID.h:273
Definition: BKE_main.h:116