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.
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.
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.
16 * The Original Code is Copyright (C) 2013 Blender Foundation.
17 * All rights reserved.
20 /** \file blender/depsgraph/DEG_depsgraph_build.h
23 * Public API for Depsgraph
26 #ifndef __DEG_DEPSGRAPH_BUILD_H__
27 #define __DEG_DEPSGRAPH_BUILD_H__
29 /* ************************************************* */
31 /* Dependency Graph */
34 /* ------------------------------------------------ */
38 struct EffectorWeights;
50 #include "BLI_sys_types.h"
52 /* Graph Building -------------------------------- */
54 /* Build depsgraph for the given scene, and dump results in given
57 void DEG_graph_build_from_view_layer(struct Depsgraph *graph,
60 struct ViewLayer *view_layer);
62 /* Tag relations from the given graph for update. */
63 void DEG_graph_tag_relations_update(struct Depsgraph *graph);
65 /* Create or update relations in the specified graph. */
66 void DEG_graph_relations_update(struct Depsgraph *graph,
69 struct ViewLayer *view_layer);
71 /* Tag all relations in the database for update.*/
72 void DEG_relations_tag_update(struct Main *bmain);
74 /* Add Dependencies ----------------------------- */
76 /* Handle for components to define their dependencies from callbacks.
77 * This is generated by the depsgraph and passed to dependency callbacks
78 * as a symbolic reference to the current DepsNode.
79 * All relations will be defined in reference to that node.
81 struct DepsNodeHandle;
83 typedef enum eDepsSceneComponentType {
84 /* Parameters Component - Default when nothing else fits
85 * (i.e. just SDNA property setting). */
86 DEG_SCENE_COMP_PARAMETERS,
87 /* Animation Component
88 * TODO(sergey): merge in with parameters? */
89 DEG_SCENE_COMP_ANIMATION,
90 /* Sequencer Component (Scene Only). */
91 DEG_SCENE_COMP_SEQUENCER,
92 } eDepsSceneComponentType;
94 typedef enum eDepsObjectComponentType {
95 /* Parameters Component - Default when nothing else fits
96 * (i.e. just SDNA property setting). */
97 DEG_OB_COMP_PARAMETERS,
98 /* Generic "Proxy-Inherit" Component.
99 * TODO(sergey): Also for instancing of subgraphs? */
101 /* Animation Component.
103 * TODO(sergey): merge in with parameters? */
104 DEG_OB_COMP_ANIMATION,
105 /* Transform Component (Parenting/Constraints) */
106 DEG_OB_COMP_TRANSFORM,
107 /* Geometry Component (Mesh/Displist) */
108 DEG_OB_COMP_GEOMETRY,
110 /* Evaluation-Related Outer Types (with Subdata) */
112 /* Pose Component - Owner/Container of Bones Eval */
113 DEG_OB_COMP_EVAL_POSE,
114 /* Bone Component - Child/Subcomponent of Pose */
117 /* Material Shading Component */
119 /* Cache Component */
121 } eDepsObjectComponentType;
123 void DEG_add_scene_relation(struct DepsNodeHandle *node_handle,
125 eDepsSceneComponentType component,
126 const char *description);
127 void DEG_add_object_relation(struct DepsNodeHandle *node_handle,
128 struct Object *object,
129 eDepsObjectComponentType component,
130 const char *description);
131 void DEG_add_bone_relation(struct DepsNodeHandle *handle,
132 struct Object *object,
133 const char *bone_name,
134 eDepsObjectComponentType component,
135 const char *description);
136 void DEG_add_object_cache_relation(struct DepsNodeHandle *handle,
137 struct CacheFile *cache_file,
138 eDepsObjectComponentType component,
139 const char *description);
140 /* Adds relation from DEG_OPCODE_GENERIC_DATABLOCK_UPDATE of a given ID.
141 * Is used for such entities as textures and images. */
142 void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle,
144 const char *description);
146 /* Adds relations from the given component of a given object to the given node
147 * handle AND the component to the point cache component of the node's ID.
149 void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
150 struct Object *object,
151 eDepsObjectComponentType component,
152 const char *description);
154 void DEG_add_special_eval_flag(struct DepsNodeHandle *handle, struct ID *id, uint32_t flag);
155 void DEG_add_customdata_mask(struct DepsNodeHandle *handle, struct Object *object, uint64_t mask);
157 struct ID *DEG_get_id_from_handle(struct DepsNodeHandle *node_handle);
158 struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *node_handle);
160 /* ************************************************ */
166 #endif /* __DEG_DEPSGRAPH_BUILD_H__ */