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.
19 * Original Author: Joshua Leung
22 /** \file blender/depsgraph/intern/node/deg_node_operation.h
28 #include "intern/node/deg_node.h"
30 #include "intern/depsgraph_type.h"
39 /* Evaluation Operation for atomic operation */
40 // XXX: move this to another header that can be exposed?
41 typedef function<void(struct ::Depsgraph *)> DepsEvalOperationCb;
43 /* Identifiers for common operations (as an enum). */
44 enum class OperationCode {
45 /* Generic Operations. -------------------------------------------------- */
47 /* Placeholder for operations which don't need special mention */
50 /* Generic parameters evaluation. */
54 // XXX: Placeholder while porting depsgraph code
57 /* Animation, Drivers, etc. --------------------------------------------- */
63 /* Object related. ------------------------------------------------------ */
66 /* Transform. ----------------------------------------------------------- */
67 /* Transform entry point - local transforms only */
72 TRANSFORM_CONSTRAINTS,
73 /* Transform exit point */
75 /* Handle object-level updates, mainly proxies hacks and recalc flags. */
76 TRANSFORM_OBJECT_UBEREVAL,
78 /* Rigid body. ---------------------------------------------------------- */
79 /* Perform Simulation */
82 /* Copy results to object */
83 RIGIDBODY_TRANSFORM_COPY,
85 /* Geometry. ------------------------------------------------------------ */
87 /* Evaluate the whole geometry, including modifiers. */
89 /* Evaluation of a shape key. */
92 /* Object data. --------------------------------------------------------- */
96 /* Pose. ---------------------------------------------------------------- */
97 /* Init pose, clear flags, etc. */
99 /* Initialize IK solver related pose stuff. */
101 /* Pose is evaluated, and runtime data can be freed. */
103 /* Pose has been fully evaluated and ready to be used by others. */
105 /* IK/Spline Solvers */
107 POSE_SPLINE_IK_SOLVER,
109 /* Bone. ---------------------------------------------------------------- */
110 /* Bone local transforms - entry point */
112 /* Pose-space conversion (includes parent + restpose, */
116 /* Bone transforms are ready
118 * - "READY" This (internal, noop is used to signal that all pre-IK
119 * operations are done. Its role is to help mediate situations
120 * where cyclic relations may otherwise form (i.e. one bone in
121 * chain targeting another in same chain,
123 * - "DONE" This noop is used to signal that the bone's final pose
124 * transform can be read by others. */
125 // TODO: deform mats could get calculated in the final_transform ops...
128 /* B-Bone segment shape computation (after DONE) */
131 /* Particle System. ----------------------------------------------------- */
132 PARTICLE_SYSTEM_INIT,
133 PARTICLE_SYSTEM_EVAL,
134 PARTICLE_SYSTEM_DONE,
136 /* Particle Settings. --------------------------------------------------- */
137 PARTICLE_SETTINGS_INIT,
138 PARTICLE_SETTINGS_EVAL,
139 PARTICLE_SETTINGS_RESET,
141 /* Point Cache. --------------------------------------------------------- */
144 /* Collections. --------------------------------------------------------- */
147 /* Copy on Write. ------------------------------------------------------- */
150 /* Shading. ------------------------------------------------------------- */
155 /* Batch caches. -------------------------------------------------------- */
156 GEOMETRY_SELECT_UPDATE,
158 /* Masks. --------------------------------------------------------------- */
162 /* Movie clips. --------------------------------------------------------- */
164 MOVIECLIP_SELECT_UPDATE,
166 /* Synchronization clips. ----------------------------------------------- */
167 SYNCHRONIZE_TO_ORIGINAL,
169 /* Generic datablock ---------------------------------------------------- */
170 GENERIC_DATABLOCK_UPDATE,
172 const char *operationCodeAsString(OperationCode opcode);
174 /* Flags for Depsgraph Nodes.
175 * NOTE: IS a bit shifts to allow usage as an accumulated. bitmask.
178 /* Node needs to be updated. */
179 DEPSOP_FLAG_NEEDS_UPDATE = (1 << 0),
180 /* Node was directly modified, causing need for update. */
181 DEPSOP_FLAG_DIRECTLY_MODIFIED = (1 << 1),
182 /* Node was updated due to user input. */
183 DEPSOP_FLAG_USER_MODIFIED = (1 << 2),
185 /* Set of flags which gets flushed along the relations. */
186 DEPSOP_FLAG_FLUSH = (DEPSOP_FLAG_USER_MODIFIED),
189 /* Atomic Operation - Base type for all operations */
190 struct OperationNode : public Node {
194 virtual string identifier() const override;
195 string full_identifier() const;
197 virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
199 bool is_noop() const { return (bool)evaluate == false; }
201 virtual OperationNode *get_entry_operation() override {
204 virtual OperationNode *get_exit_operation() override {
208 /* Set this operation as component's entry/exit operation. */
212 /* Component that contains the operation. */
213 ComponentNode *owner;
215 /* Callback for operation. */
216 DepsEvalOperationCb evaluate;
218 /* How many inlinks are we still waiting on before we can be evaluated. */
219 uint32_t num_links_pending;
222 /* Identifier for the operation being performed. */
223 OperationCode opcode;
226 /* (OperationFlag) extra settings affecting evaluation. */
229 DEG_DEPSNODE_DECLARE;
232 void deg_register_operation_depsnodes();