1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
*
* Original Author: Joshua Leung
* Contributor(s): None Yet
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/depsgraph/DEG_depsgraph.h
* \ingroup depsgraph
*
* Public API for Depsgraph
*
* Dependency Graph
* ================
*
* The dependency graph tracks relations between various pieces of data in
* a Blender file, but mainly just those which make up scene data. It is used
* to determine the set of operations need to ensure that all data has been
* correctly evaluated in response to changes, based on dependencies and visibility
* of affected data.
*
*
* Evaluation Engine
* =================
*
* The evaluation takes the operation-nodes the Depsgraph has tagged for updating,
* and schedules them up for being evaluated/executed such that the all dependency
* relationship constraints are satisfied.
*/
/* ************************************************* */
/* Forward-defined typedefs for core types
* - These are used in all depsgraph code and by all callers of Depsgraph API...
*/
#ifndef __DEG_DEPSGRAPH_H__
#define __DEG_DEPSGRAPH_H__
/* Dependency Graph */
typedef struct Depsgraph Depsgraph;
/* ------------------------------------------------ */
struct EvaluationContext;
struct Main;
struct PointerRNA;
struct PropertyRNA;
#ifdef __cplusplus
extern "C" {
#endif
bool DEG_depsgraph_use_legacy(void);
void DEG_depsgraph_switch_to_legacy(void);
void DEG_depsgraph_switch_to_new(void);
/* ************************************************ */
/* Depsgraph API */
/* CRUD ------------------------------------------- */
// Get main depsgraph instance from context!
/* Create new Depsgraph instance */
// TODO: what args are needed here? What's the building-graph entry point?
Depsgraph *DEG_graph_new(void);
/* Free Depsgraph itself and all its data */
void DEG_graph_free(Depsgraph *graph);
/* Node Types Registry ---------------------------- */
/* Register all node types */
void DEG_register_node_types(void);
/* Free node type registry on exit */
void DEG_free_node_types(void);
/* Update Tagging -------------------------------- */
/* Tag node(s) associated with states such as time and visibility */
void DEG_scene_update_flags(Depsgraph *graph, const bool do_time);
/* Update dependency graph when visible scenes/layers changes. */
void DEG_graph_on_visible_update(struct Main *bmain, struct Scene *scene);
/* Update all dependency graphs when visible scenes/layers changes. */
void DEG_on_visible_update(struct Main *bmain, const bool do_time);
/* Tag node(s) associated with changed data for later updates */
void DEG_graph_id_tag_update(struct Main *bmain,
Depsgraph *graph,
struct ID *id);
/* Tag given ID for an update in all the dependency graphs. */
void DEG_id_tag_update(struct ID *id, short flag);
void DEG_id_tag_update_ex(struct Main *bmain,
struct ID *id,
short flag);
/* Mark a particular datablock type as having changing. This does
* not cause any updates but is used by external render engines to detect if for
* example a datablock was removed.
*/
void DEG_id_type_tag(struct Main *bmain, short idtype);
void DEG_ids_clear_recalc(struct Main *bmain);
/* Update Flushing ------------------------------- */
/* Flush updates for all IDs */
void DEG_ids_flush_tagged(struct Main *bmain);
/* Flush updates for IDs in a single scene. */
void DEG_scene_flush_update(struct Main *bmain, struct Scene *scene);
/* Check if something was changed in the database and inform
* editors about this.
*/
void DEG_ids_check_recalc(struct Main *bmain,
struct Scene *scene,
bool time);
/* ************************************************ */
/* Evaluation Engine API */
/* Evaluation Context ---------------------------- */
/* Create new evaluation context. */
struct EvaluationContext *DEG_evaluation_context_new(int mode);
/* Initialize evaluation context.
* Used by the areas which currently overrides the context or doesn't have
* access to a proper one.
*/
void DEG_evaluation_context_init(struct EvaluationContext *eval_ctx, int mode);
/* Free evaluation context. */
void DEG_evaluation_context_free(struct EvaluationContext *eval_ctx);
/* Graph Evaluation ----------------------------- */
/* Frame changed recalculation entry point
* < context_type: context to perform evaluation for
* < ctime: (frame) new frame to evaluate values on
*/
void DEG_evaluate_on_framechange(struct EvaluationContext *eval_ctx,
struct Main *bmain,
Depsgraph *graph,
float ctime,
const unsigned int layer);
/* Data changed recalculation entry point.
* < context_type: context to perform evaluation for
* < layers: visible layers bitmask to update the graph for
*/
void DEG_evaluate_on_refresh_ex(struct EvaluationContext *eval_ctx,
Depsgraph *graph,
const unsigned int layers);
/* Data changed recalculation entry point.
* < context_type: context to perform evaluation for
*/
void DEG_evaluate_on_refresh(struct EvaluationContext *eval_ctx,
Depsgraph *graph,
struct Scene *scene);
bool DEG_needs_eval(Depsgraph *graph);
/* Editors Integration -------------------------- */
/* Mechanism to allow editors to be informed of depsgraph updates,
* to do their own updates based on changes.
*/
typedef void (*DEG_EditorUpdateIDCb)(struct Main *bmain, struct ID *id);
typedef void (*DEG_EditorUpdateSceneCb)(struct Main *bmain,
struct Scene *scene,
int updated);
typedef void (*DEG_EditorUpdateScenePreCb)(struct Main *bmain,
struct Scene *scene,
bool time);
/* Set callbacks which are being called when depsgraph changes. */
void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func,
DEG_EditorUpdateSceneCb scene_func,
DEG_EditorUpdateScenePreCb scene_pre_func);
void DEG_editors_update_pre(struct Main *bmain, struct Scene *scene, bool time);
/* Evaluation Debug ------------------------------ */
void DEG_debug_print_eval(const char *function_name,
const char *object_name,
const void *object_address);
void DEG_debug_print_eval_subdata(const char *function_name,
const char *object_name,
const void *object_address,
const char *subdata_comment,
const char *subdata_name,
const void *subdata_address);
void DEG_debug_print_eval_subdata_index(const char *function_name,
const char *object_name,
const void *object_address,
const char *subdata_comment,
const char *subdata_name,
const void *subdata_address,
const int subdata_index);
void DEG_debug_print_eval_time(const char *function_name,
const char *object_name,
const void *object_address,
float time);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __DEG_DEPSGRAPH_H__ */
|