Blender V5.0
deg_node.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2013 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10
11#include "intern/depsgraph.hh"
18
19namespace blender::deg {
20
21const char *nodeClassAsString(NodeClass node_class)
22{
23 switch (node_class) {
25 return "GENERIC";
27 return "COMPONENT";
29 return "OPERATION";
30 }
31 BLI_assert_msg(0, "Unhandled node class, should never happen.");
32 return "UNKNOWN";
33}
34
35const char *nodeTypeAsString(NodeType type)
36{
37 switch (type) {
39 return "UNDEFINED";
41 return "OPERATION";
42 /* **** Generic Types **** */
44 return "TIMESOURCE";
46 return "ID_REF";
47 /* **** Outer Types **** */
49 return "PARAMETERS";
51 return "ANIMATION";
53 return "TRANSFORM";
55 return "GEOMETRY";
57 return "SEQUENCER";
59 return "LAYER_COLLECTIONS";
61 return "COPY_ON_EVAL";
63 return "OBJECT_FROM_LAYER";
65 return "HIERARCHY";
66 /* **** Evaluation-Related Outer Types (with Sub-data) **** */
68 return "EVAL_POSE";
69 case NodeType::BONE:
70 return "BONE";
72 return "PARTICLE_SYSTEM";
74 return "PARTICLE_SETTINGS";
76 return "SHADING";
77 case NodeType::CACHE:
78 return "CACHE";
80 return "POINT_CACHE";
82 return "IMAGE_ANIMATION";
84 return "BATCH_CACHE";
86 return "INSTANCING";
88 return "SYNCHRONIZATION";
89 case NodeType::AUDIO:
90 return "AUDIO";
92 return "ARMATURE";
94 return "GENERIC_DATABLOCK";
95 case NodeType::SCENE:
96 return "SCENE";
98 return "VISIBILITY";
100 return "NTREE_OUTPUT";
102 return "NTREE_GEOMETRY_PREPROCESS";
103
104 /* Total number of meaningful node types. */
106 return "SpecialCase";
107 }
108 BLI_assert_msg(0, "Unhandled node type, should never happen.");
109 return "UNKNOWN";
110}
111
124
126{
127 switch (type) {
134
137 case NodeType::ID_REF:
142 case NodeType::AUDIO:
145 case NodeType::SCENE:
158 case NodeType::BONE:
160 case NodeType::CACHE:
164
166 BLI_assert_msg(0, "Visibility component is supposed to be only used internally.");
168 }
169 BLI_assert_msg(0, "Unhandled node type, not supposed to happen.");
171}
172
174{
175 switch (component_type) {
176 case DEG_OB_COMP_ANY:
177 return NodeType::UNDEFINED;
181 return NodeType::ANIMATION;
183 return NodeType::TRANSFORM;
185 return NodeType::GEOMETRY;
187 return NodeType::EVAL_POSE;
188 case DEG_OB_COMP_BONE:
189 return NodeType::BONE;
191 return NodeType::SHADING;
193 return NodeType::CACHE;
194 }
195 return NodeType::UNDEFINED;
196}
197
199{
200 switch (type) {
211 case NodeType::BONE:
212 return DEG_OB_COMP_BONE;
214 return DEG_OB_COMP_SHADING;
215 case NodeType::CACHE:
216 return DEG_OB_COMP_CACHE;
217
220 case NodeType::ID_REF:
226 case NodeType::AUDIO:
229 case NodeType::SCENE:
242
244 BLI_assert_msg(0, "Visibility component is supposed to be only used internally.");
246 }
247 BLI_assert_msg(0, "Unhandled node type, not supposed to happen.");
249}
250
251/*******************************************************************************
252 * Type information.
253 */
254
259
260/*******************************************************************************
261 * Evaluation statistics.
262 */
263
265{
266 reset();
267}
268
270{
271 current_time = 0.0;
272}
273
275{
276 current_time = 0.0;
277}
278
279/*******************************************************************************
280 * Node itself.
281 */
282
284{
285 name = "";
286}
287
288Node::~Node() = default;
289
290std::string Node::identifier() const
291{
292 return std::string(nodeTypeAsString(type)) + " : " + name;
293}
294
296{
297 if (type == NodeType::OPERATION) {
299 }
301 return NodeClass::GENERIC;
302 }
303
305}
306
307/*******************************************************************************
308 * Generic nodes definition.
309 */
310
313
316
322
323} // namespace blender::deg
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
eDepsSceneComponentType
@ DEG_SCENE_COMP_ANIMATION
@ DEG_SCENE_COMP_PARAMETERS
@ DEG_SCENE_COMP_SEQUENCER
eDepsObjectComponentType
@ DEG_OB_COMP_ANY
@ DEG_OB_COMP_EVAL_POSE
@ DEG_OB_COMP_GEOMETRY
@ DEG_OB_COMP_ANIMATION
@ DEG_OB_COMP_TRANSFORM
@ DEG_OB_COMP_SHADING
@ DEG_OB_COMP_PARAMETERS
@ DEG_OB_COMP_CACHE
@ DEG_OB_COMP_BONE
void reset()
clear internal cached data and reset random seed
#define DEG_DEPSNODE_DEFINE(NodeType, type_, tname_)
Definition deg_node.hh:219
void register_node_typeinfo(DepsNodeFactory *factory)
eDepsObjectComponentType nodeTypeToObjectComponent(NodeType type)
Definition deg_node.cc:198
NodeType nodeTypeFromSceneComponent(eDepsSceneComponentType component)
Definition deg_node.cc:112
eDepsSceneComponentType nodeTypeToSceneComponent(NodeType type)
Definition deg_node.cc:125
static DepsNodeFactoryImpl< IDNode > DNTI_ID_REF
Definition deg_node.cc:315
static DepsNodeFactoryImpl< TimeSourceNode > DNTI_TIMESOURCE
Definition deg_node.cc:312
const char * nodeClassAsString(NodeClass node_class)
Definition deg_node.cc:21
NodeType nodeTypeFromObjectComponent(eDepsObjectComponentType component_type)
Definition deg_node.cc:173
const char * nodeTypeAsString(NodeType type)
Definition deg_node.cc:35
void deg_register_base_depsnodes()
Definition deg_node.cc:317
TypeInfo(NodeType type, const char *type_name, int id_recalc_tag=0)
Definition deg_node.cc:255
std::string name
Definition deg_node.hh:180
virtual std::string identifier() const
Definition deg_node.cc:290
virtual NodeClass get_class() const
Definition deg_node.cc:295