Blender V5.3
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 "COMPOSITOR";
61 return "LAYER_COLLECTIONS";
63 return "COPY_ON_EVAL";
65 return "OBJECT_FROM_LAYER";
67 return "HIERARCHY";
68 /* **** Evaluation-Related Outer Types (with Sub-data) **** */
70 return "EVAL_POSE";
71 case NodeType::BONE:
72 return "BONE";
74 return "PARTICLE_SYSTEM";
76 return "PARTICLE_SETTINGS";
78 return "SHADING";
79 case NodeType::CACHE:
80 return "CACHE";
82 return "POINT_CACHE";
84 return "IMAGE_ANIMATION";
86 return "BATCH_CACHE";
88 return "INSTANCING";
90 return "SYNCHRONIZATION";
91 case NodeType::AUDIO:
92 return "AUDIO";
94 return "ARMATURE";
96 return "GENERIC_DATABLOCK";
97 case NodeType::SCENE:
98 return "SCENE";
100 return "VISIBILITY";
102 return "NTREE_OUTPUT";
104 return "NTREE_GEOMETRY_PREPROCESS";
105
106 /* Total number of meaningful node types. */
108 return "SpecialCase";
109 }
110 BLI_assert_msg(0, "Unhandled node type, should never happen.");
111 return "UNKNOWN";
112}
113
128
130{
131 switch (type) {
140
143 case NodeType::ID_REF:
148 case NodeType::AUDIO:
151 case NodeType::SCENE:
164 case NodeType::BONE:
166 case NodeType::CACHE:
170
172 BLI_assert_msg(0, "Visibility component is supposed to be only used internally.");
174 }
175 BLI_assert_msg(0, "Unhandled node type, not supposed to happen.");
177}
178
180{
181 switch (component_type) {
182 case DEG_OB_COMP_ANY:
183 return NodeType::UNDEFINED;
187 return NodeType::ANIMATION;
189 return NodeType::TRANSFORM;
191 return NodeType::GEOMETRY;
193 return NodeType::EVAL_POSE;
194 case DEG_OB_COMP_BONE:
195 return NodeType::BONE;
197 return NodeType::SHADING;
199 return NodeType::CACHE;
200 }
201 return NodeType::UNDEFINED;
202}
203
205{
206 switch (type) {
217 case NodeType::BONE:
218 return DEG_OB_COMP_BONE;
220 return DEG_OB_COMP_SHADING;
221 case NodeType::CACHE:
222 return DEG_OB_COMP_CACHE;
223
226 case NodeType::ID_REF:
233 case NodeType::AUDIO:
236 case NodeType::SCENE:
249
251 BLI_assert_msg(0, "Visibility component is supposed to be only used internally.");
253 }
254 BLI_assert_msg(0, "Unhandled node type, not supposed to happen.");
256}
257
258/*******************************************************************************
259 * Type information.
260 */
261
266
267/*******************************************************************************
268 * Evaluation statistics.
269 */
270
272{
273 reset();
274}
275
277{
278 current_time = 0.0;
279}
280
282{
283 current_time = 0.0;
284}
285
286/*******************************************************************************
287 * Node itself.
288 */
289
291{
292 name = "";
293}
294
295Node::~Node() = default;
296
297std::string Node::identifier() const
298{
299 return std::string(nodeTypeAsString(type)) + " : " + name;
300}
301
303{
304 if (type == NodeType::OPERATION) {
306 }
308 return NodeClass::GENERIC;
309 }
310
312}
313
314/*******************************************************************************
315 * Generic nodes definition.
316 */
317
320
323
329
330} // namespace blender::deg
#define BLI_assert_msg(a, msg)
void register_node_typeinfo(DepsNodeFactory *factory)
eDepsObjectComponentType nodeTypeToObjectComponent(NodeType type)
Definition deg_node.cc:204
NodeType nodeTypeFromSceneComponent(eDepsSceneComponentType component)
Definition deg_node.cc:114
eDepsSceneComponentType nodeTypeToSceneComponent(NodeType type)
Definition deg_node.cc:129
static DepsNodeFactoryImpl< IDNode > DNTI_ID_REF
Definition deg_node.cc:322
static DepsNodeFactoryImpl< TimeSourceNode > DNTI_TIMESOURCE
Definition deg_node.cc:319
const char * nodeClassAsString(NodeClass node_class)
Definition deg_node.cc:21
NodeType nodeTypeFromObjectComponent(eDepsObjectComponentType component_type)
Definition deg_node.cc:179
DEG_DEPSNODE_DEFINE(TimeSourceNode, NodeType::TIMESOURCE, "Time Source")
const char * nodeTypeAsString(NodeType type)
Definition deg_node.cc:35
void deg_register_base_depsnodes()
Definition deg_node.cc:324
TypeInfo(NodeType type, const char *type_name, int id_recalc_tag=0)
Definition deg_node.cc:262
std::string name
Definition deg_node.hh:186
virtual std::string identifier() const
Definition deg_node.cc:297
virtual NodeClass get_class() const
Definition deg_node.cc:302