2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2013 Blender Foundation.
19 * All rights reserved.
21 * Original Author: Joshua Leung
22 * Contributor(s): Lukas Toenne
24 * ***** END GPL LICENSE BLOCK *****
27 /** \file blender/depsgraph/DEG_depsgraph_build.h
30 * Public API for Depsgraph
33 #ifndef __DEG_DEPSGRAPH_BUILD_H__
34 #define __DEG_DEPSGRAPH_BUILD_H__
36 /* ************************************************* */
38 /* Dependency Graph */
41 /* ------------------------------------------------ */
44 struct EffectorWeights;
45 struct EvaluationContext;
57 /* Graph Building -------------------------------- */
59 /* Build depsgraph for the given scene, and dump results in given
62 void DEG_graph_build_from_view_layer(struct Depsgraph *graph,
65 struct ViewLayer *view_layer);
67 /* Tag relations from the given graph for update. */
68 void DEG_graph_tag_relations_update(struct Depsgraph *graph);
70 /* Create or update relations in the specified graph. */
71 void DEG_graph_relations_update(struct Depsgraph *graph,
74 struct ViewLayer *view_layer);
76 /* Tag all relations in the database for update.*/
77 void DEG_relations_tag_update(struct Main *bmain);
79 /* Add Dependencies ----------------------------- */
81 /* Handle for components to define their dependencies from callbacks.
82 * This is generated by the depsgraph and passed to dependency callbacks
83 * as a symbolic reference to the current DepsNode.
84 * All relations will be defined in reference to that node.
86 struct DepsNodeHandle;
88 typedef enum eDepsSceneComponentType {
89 /* Parameters Component - Default when nothing else fits
90 * (i.e. just SDNA property setting).
92 DEG_SCENE_COMP_PARAMETERS,
93 /* Animation Component
94 * TODO(sergey): merge in with parameters?
96 DEG_SCENE_COMP_ANIMATION,
97 /* Sequencer Component (Scene Only). */
98 DEG_SCENE_COMP_SEQUENCER,
99 } eDepsSceneComponentType;
101 typedef enum eDepsObjectComponentType {
102 /* Parameters Component - Default when nothing else fits
103 * (i.e. just SDNA property setting).
105 DEG_OB_COMP_PARAMETERS,
106 /* Generic "Proxy-Inherit" Component.
107 * TODO(sergey): Also for instancing of subgraphs?
110 /* Animation Component.
112 * TODO(sergey): merge in with parameters?
114 DEG_OB_COMP_ANIMATION,
115 /* Transform Component (Parenting/Constraints) */
116 DEG_OB_COMP_TRANSFORM,
117 /* Geometry Component (DerivedMesh/Displist) */
118 DEG_OB_COMP_GEOMETRY,
120 /* Evaluation-Related Outer Types (with Subdata) */
122 /* Pose Component - Owner/Container of Bones Eval */
123 DEG_OB_COMP_EVAL_POSE,
124 /* Bone Component - Child/Subcomponent of Pose */
127 /* Particle Systems Component */
128 DEG_OB_COMP_EVAL_PARTICLES,
129 /* Material Shading Component */
131 /* Cache Component */
133 } eDepsObjectComponentType;
135 void DEG_add_scene_relation(struct DepsNodeHandle *node,
137 eDepsSceneComponentType component,
138 const char *description);
139 void DEG_add_object_relation(struct DepsNodeHandle *node,
140 struct Object *object,
141 eDepsObjectComponentType component,
142 const char *description);
143 void DEG_add_bone_relation(struct DepsNodeHandle *handle,
144 struct Object *object,
145 const char *bone_name,
146 eDepsObjectComponentType component,
147 const char *description);
148 void DEG_add_object_cache_relation(struct DepsNodeHandle *handle,
149 struct CacheFile *cache_file,
150 eDepsObjectComponentType component,
151 const char *description);
154 struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *handle);
155 void DEG_add_special_eval_flag(struct Depsgraph *graph, struct ID *id, short flag);
157 /* Utility functions for physics modifiers */
158 typedef bool (*DEG_CollobjFilterFunction)(struct Object *obj, struct ModifierData *md);
160 void DEG_add_collision_relations(struct DepsNodeHandle *handle,
162 struct Object *object,
164 unsigned int modifier_type,
165 DEG_CollobjFilterFunction fn,
168 void DEG_add_forcefield_relations(struct DepsNodeHandle *handle,
170 struct Object *object,
171 struct EffectorWeights *eff,
176 /* ************************************************ */
182 #endif /* __DEG_DEPSGRAPH_BUILD_H__ */