diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-04 15:50:59 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-05 17:06:12 +0300 |
commit | 03ac94f46abf9007f1ac2cd66805d3aab9aa4178 (patch) | |
tree | 38c03ff24137db9bbc6a98798e020bdaee4050d8 /source/blender | |
parent | ea05edceaa3347e7b847e47862effdab9b42498a (diff) |
Depsgraph: Add inverse of node type conversion functions
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/depsgraph/intern/node/deg_node.cc | 88 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/node/deg_node.h | 3 |
2 files changed, 91 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/node/deg_node.cc b/source/blender/depsgraph/intern/node/deg_node.cc index 2c734d14c53..f53caca00a9 100644 --- a/source/blender/depsgraph/intern/node/deg_node.cc +++ b/source/blender/depsgraph/intern/node/deg_node.cc @@ -133,6 +133,47 @@ NodeType nodeTypeFromSceneComponent(eDepsSceneComponentType component) return NodeType::UNDEFINED; } +eDepsSceneComponentType nodeTypeToSceneComponent(NodeType type) +{ + switch (type) { + case NodeType::PARAMETERS: + return DEG_SCENE_COMP_PARAMETERS; + case NodeType::ANIMATION: + return DEG_SCENE_COMP_ANIMATION; + case NodeType::SEQUENCER: + return DEG_SCENE_COMP_SEQUENCER; + + case NodeType::OPERATION: + case NodeType::TIMESOURCE: + case NodeType::ID_REF: + case NodeType::LAYER_COLLECTIONS: + case NodeType::COPY_ON_WRITE: + case NodeType::OBJECT_FROM_LAYER: + case NodeType::AUDIO: + case NodeType::ARMATURE: + case NodeType::GENERIC_DATABLOCK: + case NodeType::PARTICLE_SYSTEM: + case NodeType::PARTICLE_SETTINGS: + case NodeType::SHADING_PARAMETERS: + case NodeType::POINT_CACHE: + case NodeType::BATCH_CACHE: + case NodeType::DUPLI: + case NodeType::SYNCHRONIZATION: + case NodeType::UNDEFINED: + case NodeType::NUM_TYPES: + case NodeType::TRANSFORM: + case NodeType::GEOMETRY: + case NodeType::EVAL_POSE: + case NodeType::BONE: + case NodeType::SHADING: + case NodeType::CACHE: + case NodeType::PROXY: + return DEG_SCENE_COMP_PARAMETERS; + } + BLI_assert(!"Unhandled node type, not suppsed to happen."); + return DEG_SCENE_COMP_PARAMETERS; +} + NodeType nodeTypeFromObjectComponent(eDepsObjectComponentType component) { switch (component) { @@ -158,6 +199,53 @@ NodeType nodeTypeFromObjectComponent(eDepsObjectComponentType component) return NodeType::UNDEFINED; } +eDepsObjectComponentType nodeTypeToObjectComponent(NodeType type) +{ + switch (type) { + case NodeType::PARAMETERS: + return DEG_OB_COMP_PARAMETERS; + case NodeType::PROXY: + return DEG_OB_COMP_PROXY; + case NodeType::ANIMATION: + return DEG_OB_COMP_ANIMATION; + case NodeType::TRANSFORM: + return DEG_OB_COMP_TRANSFORM; + case NodeType::GEOMETRY: + return DEG_OB_COMP_GEOMETRY; + case NodeType::EVAL_POSE: + return DEG_OB_COMP_EVAL_POSE; + case NodeType::BONE: + return DEG_OB_COMP_BONE; + case NodeType::SHADING: + return DEG_OB_COMP_SHADING; + case NodeType::CACHE: + return DEG_OB_COMP_CACHE; + + case NodeType::OPERATION: + case NodeType::TIMESOURCE: + case NodeType::ID_REF: + case NodeType::SEQUENCER: + case NodeType::LAYER_COLLECTIONS: + case NodeType::COPY_ON_WRITE: + case NodeType::OBJECT_FROM_LAYER: + case NodeType::AUDIO: + case NodeType::ARMATURE: + case NodeType::GENERIC_DATABLOCK: + case NodeType::PARTICLE_SYSTEM: + case NodeType::PARTICLE_SETTINGS: + case NodeType::SHADING_PARAMETERS: + case NodeType::POINT_CACHE: + case NodeType::BATCH_CACHE: + case NodeType::DUPLI: + case NodeType::SYNCHRONIZATION: + case NodeType::UNDEFINED: + case NodeType::NUM_TYPES: + return DEG_OB_COMP_PARAMETERS; + } + BLI_assert(!"Unhandled node type, not suppsed to happen."); + return DEG_OB_COMP_PARAMETERS; +} + /******************************************************************************* * Type information. */ diff --git a/source/blender/depsgraph/intern/node/deg_node.h b/source/blender/depsgraph/intern/node/deg_node.h index 5bb9b7fe9ce..3ebc5ec8125 100644 --- a/source/blender/depsgraph/intern/node/deg_node.h +++ b/source/blender/depsgraph/intern/node/deg_node.h @@ -133,7 +133,10 @@ enum class NodeType { const char *nodeTypeAsString(NodeType type); NodeType nodeTypeFromSceneComponent(eDepsSceneComponentType component); +eDepsSceneComponentType nodeTypeToSceneComponent(NodeType type); + NodeType nodeTypeFromObjectComponent(eDepsObjectComponentType component); +eDepsObjectComponentType nodeTypeToObjectComponent(NodeType type); /* All nodes in Depsgraph are descended from this. */ struct Node { |