Blender  V2.93
deg_node_operation.cc
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 
25 
26 #include "MEM_guardedalloc.h"
27 
28 #include "BLI_utildefines.h"
29 
30 #include "intern/depsgraph.h"
34 
35 namespace blender::deg {
36 
38 {
39  switch (opcode) {
40  /* Generic Operations. */
42  return "OPERATION";
44  return "ID_PROPERTY";
46  return "PARAMETERS_ENTRY";
48  return "PARAMETERS_EVAL";
50  return "PARAMETERS_EXIT";
51  /* Animation, Drivers, etc. */
53  return "ANIMATION_ENTRY";
55  return "ANIMATION_EVAL";
57  return "ANIMATION_EXIT";
59  return "DRIVER";
60  /* Scene related. */
62  return "SCENE_EVAL";
64  return "AUDIO_ENTRY";
66  return "AUDIO_VOLUME";
67  /* Object related. */
69  return "OBJECT_FROM_LAYER_ENTRY";
71  return "OBJECT_BASE_FLAGS";
73  return "OBJECT_FROM_LAYER_EXIT";
75  return "DIMENSIONS";
76  /* Transform. */
78  return "TRANSFORM_INIT";
80  return "TRANSFORM_LOCAL";
82  return "TRANSFORM_PARENT";
84  return "TRANSFORM_CONSTRAINTS";
86  return "TRANSFORM_FINAL";
88  return "TRANSFORM_EVAL";
90  return "TRANSFORM_SIMULATION_INIT";
91  /* Rigid body. */
93  return "RIGIDBODY_REBUILD";
95  return "RIGIDBODY_SIM";
97  return "RIGIDBODY_TRANSFORM_COPY";
98  /* Geometry. */
100  return "GEOMETRY_EVAL_INIT";
102  return "GEOMETRY_EVAL";
104  return "GEOMETRY_EVAL_DONE";
106  return "GEOMETRY_SHAPEKEY";
107  /* Object data. */
109  return "LIGHT_PROBE_EVAL";
111  return "SPEAKER_EVAL";
113  return "SOUND_EVAL";
115  return "ARMATURE_EVAL";
116  /* Pose. */
118  return "POSE_INIT";
120  return "POSE_INIT_IK";
122  return "POSE_CLEANUP";
124  return "POSE_DONE";
126  return "POSE_IK_SOLVER";
128  return "POSE_SPLINE_IK_SOLVER";
129  /* Bone. */
131  return "BONE_LOCAL";
133  return "BONE_POSE_PARENT";
135  return "BONE_CONSTRAINTS";
137  return "BONE_READY";
139  return "BONE_DONE";
141  return "BONE_SEGMENTS";
142  /* Particle System. */
144  return "PARTICLE_SYSTEM_INIT";
146  return "PARTICLE_SYSTEM_EVAL";
148  return "PARTICLE_SYSTEM_DONE";
149  /* Particles Settings. */
151  return "PARTICLE_SETTINGS_INIT";
153  return "PARTICLE_SETTINGS_EVAL";
155  return "PARTICLE_SETTINGS_RESET";
156  /* Point Cache. */
158  return "POINT_CACHE_RESET";
159  /* File cache. */
161  return "FILE_CACHE_UPDATE";
162  /* Batch cache. */
164  return "GEOMETRY_SELECT_UPDATE";
165  /* Masks. */
167  return "MASK_ANIMATION";
169  return "MASK_EVAL";
170  /* Collections. */
172  return "VIEW_LAYER_EVAL";
173  /* Copy on write. */
175  return "COPY_ON_WRITE";
176  /* Shading. */
178  return "SHADING";
180  return "MATERIAL_UPDATE";
182  return "LIGHT_UPDATE";
184  return "WORLD_UPDATE";
185  /* Movie clip. */
187  return "MOVIECLIP_EVAL";
189  return "MOVIECLIP_SELECT_UPDATE";
190  /* Image. */
192  return "IMAGE_ANIMATION";
193  /* Synchronization. */
195  return "SYNCHRONIZE_TO_ORIGINAL";
196  /* Generic datablock. */
198  return "GENERIC_DATABLOCK_UPDATE";
199  /* Sequencer. */
201  return "SEQUENCES_EVAL";
202  /* instancing/duplication. */
204  return "DUPLI";
206  return "SIMULATION_EVAL";
207  }
208  BLI_assert(!"Unhandled operation code, should never happen.");
209  return "UNKNOWN";
210 }
211 
212 OperationNode::OperationNode() : name_tag(-1), flag(0)
213 {
214 }
215 
217 {
218  return string(operationCodeAsString(opcode)) + "(" + name + ")";
219 }
220 
221 /* Full node identifier, including owner name.
222  * used for logging and debug prints. */
224 {
225  string owner_str = owner->owner->name;
226  if (owner->type == NodeType::BONE || !owner->name.empty()) {
227  owner_str += "/" + owner->name;
228  }
229  return owner_str + "/" + identifier();
230 }
231 
233 {
234  if ((flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
235  graph->add_entry_tag(this);
236  }
237  /* Tag for update, but also note that this was the source of an update. */
239  switch (source) {
243  /* Currently nothing. */
244  break;
247  break;
248  }
249 }
250 
252 {
253  BLI_assert(owner != nullptr);
254  owner->set_entry_operation(this);
255 }
256 
258 {
259  BLI_assert(owner != nullptr);
260  owner->set_exit_operation(this);
261 }
262 
265 
267 {
269 }
270 
271 } // namespace blender::deg
#define BLI_assert(a)
Definition: BLI_assert.h:58
Read Guarded memory(de)allocation.
Depsgraph * graph
void register_node_typeinfo(DepsNodeFactory *factory)
const char * operationCodeAsString(OperationCode opcode)
static DepsNodeFactoryImpl< OperationNode > DNTI_OPERATION
void deg_register_operation_depsnodes()
DEG_DEPSNODE_DEFINE(TimeSourceNode, NodeType::TIMESOURCE, "Time Source")
@ DEG_UPDATE_SOURCE_USER_EDIT
@ DEG_UPDATE_SOURCE_RELATIONS
@ DEG_UPDATE_SOURCE_VISIBILITY
void set_exit_operation(OperationNode *op_node)
void set_entry_operation(OperationNode *op_node)
virtual void tag_update(Depsgraph *graph, eUpdateSource source) override
virtual string identifier() const override