Blender  V2.93
deg_node_operation.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 
24 #pragma once
25 
26 #include "intern/node/deg_node.h"
27 
28 #include "intern/depsgraph_type.h"
29 
30 struct Depsgraph;
31 
32 namespace blender {
33 namespace deg {
34 
35 struct ComponentNode;
36 
37 /* Evaluation Operation for atomic operation */
38 /* XXX: move this to another header that can be exposed? */
39 typedef function<void(struct ::Depsgraph *)> DepsEvalOperationCb;
40 
41 /* Identifiers for common operations (as an enum). */
42 enum class OperationCode {
43  /* Generic Operations. -------------------------------------------------- */
44 
45  /* Placeholder for operations which don't need special mention */
46  OPERATION = 0,
47 
48  /* Generic parameters evaluation. */
53 
54  /* Animation, Drivers, etc. --------------------------------------------- */
55  /* NLA + Action */
59  /* Driver */
60  DRIVER,
61 
62  /* Scene related. ------------------------------------------------------- */
63  SCENE_EVAL,
66 
67  /* Object related. ------------------------------------------------------ */
71  DIMENSIONS,
72 
73  /* Transform. ----------------------------------------------------------- */
74  /* Transform entry point. */
76  /* Local transforms only */
78  /* Parenting */
80  /* Constraints */
82  /* Handle object-level updates, mainly proxies hacks and recalc flags. */
84  /* Initializes transformation for simulation.
85  * For example, ensures point cache is properly reset before doing rigid
86  * body simulation. */
88  /* Transform exit point */
90 
91  /* Rigid body. ---------------------------------------------------------- */
92  /* Perform Simulation */
95  /* Copy results to object */
97 
98  /* Geometry. ------------------------------------------------------------ */
99 
100  /* Initialize evaluation of the geometry. Is an entry operation of geometry
101  * component. */
103  /* Evaluate the whole geometry, including modifiers. */
105  /* Evaluation of geometry is completely done.. */
107  /* Evaluation of a shape key.
108  * NOTE: Currently only for object data data-blocks. */
110 
111  /* Object data. --------------------------------------------------------- */
113  SPEAKER_EVAL,
114  SOUND_EVAL,
116 
117  /* Pose. ---------------------------------------------------------------- */
118  /* Init pose, clear flags, etc. */
119  POSE_INIT,
120  /* Initialize IK solver related pose stuff. */
121  POSE_INIT_IK,
122  /* Pose is evaluated, and runtime data can be freed. */
123  POSE_CLEANUP,
124  /* Pose has been fully evaluated and ready to be used by others. */
125  POSE_DONE,
126  /* IK/Spline Solvers */
129 
130  /* Bone. ---------------------------------------------------------------- */
131  /* Bone local transforms - entry point */
132  BONE_LOCAL,
133  /* Pose-space conversion (includes parent + restpose, */
135  /* Constraints */
137  /* Bone transforms are ready
138  *
139  * - "READY" This (internal, noop is used to signal that all pre-IK
140  * operations are done. Its role is to help mediate situations
141  * where cyclic relations may otherwise form (i.e. one bone in
142  * chain targeting another in same chain,
143  *
144  * - "DONE" This noop is used to signal that the bone's final pose
145  * transform can be read by others. */
146  /* TODO: deform mats could get calculated in the final_transform ops... */
147  BONE_READY,
148  BONE_DONE,
149  /* B-Bone segment shape computation (after DONE) */
151 
152  /* Particle System. ----------------------------------------------------- */
156 
157  /* Particle Settings. --------------------------------------------------- */
161 
162  /* Point Cache. --------------------------------------------------------- */
164 
165  /* File cache. ---------------------------------------------------------- */
167 
168  /* Collections. --------------------------------------------------------- */
170 
171  /* Copy on Write. ------------------------------------------------------- */
173 
174  /* Shading. ------------------------------------------------------------- */
175  SHADING,
177  LIGHT_UPDATE,
178  WORLD_UPDATE,
179 
180  /* Batch caches. -------------------------------------------------------- */
182 
183  /* Masks. --------------------------------------------------------------- */
185  MASK_EVAL,
186 
187  /* Movie clips. --------------------------------------------------------- */
190 
191  /* Images. -------------------------------------------------------------- */
193 
194  /* Synchronization. ----------------------------------------------------- */
196 
197  /* Generic data-block --------------------------------------------------- */
199 
200  /* Sequencer. ----------------------------------------------------------- */
201 
203 
204  /* Duplication/instancing system. --------------------------------------- */
205  DUPLI,
206 
207  /* Simulation. ---------------------------------------------------------- */
209 };
210 const char *operationCodeAsString(OperationCode opcode);
211 
212 /* Flags for Depsgraph Nodes.
213  * NOTE: IS a bit shifts to allow usage as an accumulated. bitmask.
214  */
216  /* Node needs to be updated. */
218  /* Node was directly modified, causing need for update. */
220  /* Node was updated due to user input. */
222  /* Node may not be removed, even when it has no evaluation callback and no
223  * outgoing relations. This is for NO-OP nodes that are purely used to indicate a
224  * relation between components/IDs, and not for connecting to an operation. */
225  DEPSOP_FLAG_PINNED = (1 << 3),
226 
227  /* Set of flags which gets flushed along the relations. */
229 };
230 
231 /* Atomic Operation - Base type for all operations */
232 struct OperationNode : public Node {
233  OperationNode();
234 
235  virtual string identifier() const override;
236  string full_identifier() const;
237 
238  virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
239 
240  bool is_noop() const
241  {
242  return (bool)evaluate == false;
243  }
244 
245  virtual OperationNode *get_entry_operation() override
246  {
247  return this;
248  }
249  virtual OperationNode *get_exit_operation() override
250  {
251  return this;
252  }
253 
254  /* Set this operation as component's entry/exit operation. */
255  void set_as_entry();
256  void set_as_exit();
257 
258  /* Component that contains the operation. */
260 
261  /* Callback for operation. */
263 
264  /* How many inlinks are we still waiting on before we can be evaluated. */
266  bool scheduled;
267 
268  /* Identifier for the operation being performed. */
270  int name_tag;
271 
272  /* (OperationFlag) extra settings affecting evaluation. */
273  int flag;
274 
276 };
277 
279 
280 } // namespace deg
281 } // namespace blender
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
Depsgraph * graph
const char * operationCodeAsString(OperationCode opcode)
void deg_register_operation_depsnodes()
function< void(struct ::Depsgraph *)> DepsEvalOperationCb
unsigned int uint32_t
Definition: stdint.h:83
virtual OperationNode * get_exit_operation() override
virtual void tag_update(Depsgraph *graph, eUpdateSource source) override
virtual string identifier() const override
virtual OperationNode * get_entry_operation() override