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 /* ------------------------------------------------ */
45 struct EffectorWeights;
57 #include "BLI_sys_types.h"
59 /* Graph Building -------------------------------- */
61 /* Build depsgraph for the given scene, and dump results in given
64 void DEG_graph_build_from_view_layer(struct Depsgraph *graph,
67 struct ViewLayer *view_layer);
69 /* Tag relations from the given graph for update. */
70 void DEG_graph_tag_relations_update(struct Depsgraph *graph);
72 /* Create or update relations in the specified graph. */
73 void DEG_graph_relations_update(struct Depsgraph *graph,
76 struct ViewLayer *view_layer);
78 /* Tag all relations in the database for update.*/
79 void DEG_relations_tag_update(struct Main *bmain);
81 /* Add Dependencies ----------------------------- */
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.
88 struct DepsNodeHandle;
90 typedef enum eDepsSceneComponentType {
91 /* Parameters Component - Default when nothing else fits
92 * (i.e. just SDNA property setting).
94 DEG_SCENE_COMP_PARAMETERS,
95 /* Animation Component
96 * TODO(sergey): merge in with parameters?
98 DEG_SCENE_COMP_ANIMATION,
99 /* Sequencer Component (Scene Only). */
100 DEG_SCENE_COMP_SEQUENCER,
101 } eDepsSceneComponentType;
103 typedef enum eDepsObjectComponentType {
104 /* Parameters Component - Default when nothing else fits
105 * (i.e. just SDNA property setting).
107 DEG_OB_COMP_PARAMETERS,
108 /* Generic "Proxy-Inherit" Component.
109 * TODO(sergey): Also for instancing of subgraphs?
112 /* Animation Component.
114 * TODO(sergey): merge in with parameters?
116 DEG_OB_COMP_ANIMATION,
117 /* Transform Component (Parenting/Constraints) */
118 DEG_OB_COMP_TRANSFORM,
119 /* Geometry Component (Mesh/Displist) */
120 DEG_OB_COMP_GEOMETRY,
122 /* Evaluation-Related Outer Types (with Subdata) */
124 /* Pose Component - Owner/Container of Bones Eval */
125 DEG_OB_COMP_EVAL_POSE,
126 /* Bone Component - Child/Subcomponent of Pose */
129 /* Material Shading Component */
131 /* Cache Component */
133 } eDepsObjectComponentType;
135 void DEG_add_scene_relation(struct DepsNodeHandle *node_handle,
137 eDepsSceneComponentType component,
138 const char *description);
139 void DEG_add_object_relation(struct DepsNodeHandle *node_handle,
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);
152 /* Adds relation from DEG_OPCODE_GENERIC_DATABLOCK_UPDATE of a given ID.
153 * Is used for such entities as textures and images. */
154 void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle,
156 const char *description);
158 /* Adds relations from the given component of a given object to the given node
159 * handle AND the component to the point cache component of the node's ID.
161 void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
162 struct Object *object,
163 eDepsObjectComponentType component,
164 const char *description);
166 void DEG_add_special_eval_flag(struct DepsNodeHandle *handle, struct ID *id, uint32_t flag);
167 void DEG_add_customdata_mask(struct DepsNodeHandle *handle, struct Object *object, uint64_t mask);
169 struct ID *DEG_get_id_from_handle(struct DepsNodeHandle *node_handle);
170 struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *node_handle);
172 /* ************************************************ */
178 #endif /* __DEG_DEPSGRAPH_BUILD_H__ */