diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-04 15:43:54 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-05 17:06:12 +0300 |
commit | ea05edceaa3347e7b847e47862effdab9b42498a (patch) | |
tree | 3d79625cb6b7d2f0426663aaecd58cc5bbd41504 /source/blender | |
parent | 609e16339f13252a2dcaa2a5db4cf45c5e49e80b (diff) |
Depsgraph: Make object component conversion more accessible
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_build.cc | 33 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/node/deg_node.cc | 38 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/node/deg_node.h | 5 |
3 files changed, 47 insertions, 29 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index 279c5e7839a..dd2d7f70ed5 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -77,31 +77,6 @@ static DEG::NodeType deg_build_scene_component_type(eDepsSceneComponentType comp return DEG::NodeType::UNDEFINED; } -static DEG::NodeType deg_build_object_component_type(eDepsObjectComponentType component) -{ - switch (component) { - case DEG_OB_COMP_PARAMETERS: - return DEG::NodeType::PARAMETERS; - case DEG_OB_COMP_PROXY: - return DEG::NodeType::PROXY; - case DEG_OB_COMP_ANIMATION: - return DEG::NodeType::ANIMATION; - case DEG_OB_COMP_TRANSFORM: - return DEG::NodeType::TRANSFORM; - case DEG_OB_COMP_GEOMETRY: - return DEG::NodeType::GEOMETRY; - case DEG_OB_COMP_EVAL_POSE: - return DEG::NodeType::EVAL_POSE; - case DEG_OB_COMP_BONE: - return DEG::NodeType::BONE; - case DEG_OB_COMP_SHADING: - return DEG::NodeType::SHADING; - case DEG_OB_COMP_CACHE: - return DEG::NodeType::CACHE; - } - return DEG::NodeType::UNDEFINED; -} - static DEG::DepsNodeHandle *get_node_handle(DepsNodeHandle *node_handle) { return reinterpret_cast<DEG::DepsNodeHandle *>(node_handle); @@ -123,7 +98,7 @@ void DEG_add_object_relation(DepsNodeHandle *node_handle, eDepsObjectComponentType component, const char *description) { - DEG::NodeType type = deg_build_object_component_type(component); + DEG::NodeType type = DEG::nodeTypeFromObjectComponent(component); DEG::ComponentKey comp_key(&object->id, type); DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle); deg_node_handle->builder->add_node_handle_relation(comp_key, deg_node_handle, description); @@ -134,7 +109,7 @@ void DEG_add_object_cache_relation(DepsNodeHandle *node_handle, eDepsObjectComponentType component, const char *description) { - DEG::NodeType type = deg_build_object_component_type(component); + DEG::NodeType type = DEG::nodeTypeFromObjectComponent(component); DEG::ComponentKey comp_key(&cache_file->id, type); DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle); deg_node_handle->builder->add_node_handle_relation(comp_key, deg_node_handle, description); @@ -146,7 +121,7 @@ void DEG_add_bone_relation(DepsNodeHandle *node_handle, eDepsObjectComponentType component, const char *description) { - DEG::NodeType type = deg_build_object_component_type(component); + DEG::NodeType type = DEG::nodeTypeFromObjectComponent(component); DEG::ComponentKey comp_key(&object->id, type, bone_name); DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle); deg_node_handle->builder->add_node_handle_relation(comp_key, deg_node_handle, description); @@ -157,7 +132,7 @@ void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle, eDepsObjectComponentType component, const char *description) { - DEG::NodeType type = deg_build_object_component_type(component); + DEG::NodeType type = DEG::nodeTypeFromObjectComponent(component); DEG::ComponentKey comp_key(&object->id, type); DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle); DEG::DepsgraphRelationBuilder *relation_builder = deg_node_handle->builder; diff --git a/source/blender/depsgraph/intern/node/deg_node.cc b/source/blender/depsgraph/intern/node/deg_node.cc index 289c9a76cc7..2c734d14c53 100644 --- a/source/blender/depsgraph/intern/node/deg_node.cc +++ b/source/blender/depsgraph/intern/node/deg_node.cc @@ -120,6 +120,44 @@ const char *nodeTypeAsString(NodeType type) return "UNKNOWN"; } +NodeType nodeTypeFromSceneComponent(eDepsSceneComponentType component) +{ + switch (component) { + case DEG_SCENE_COMP_PARAMETERS: + return NodeType::PARAMETERS; + case DEG_SCENE_COMP_ANIMATION: + return NodeType::ANIMATION; + case DEG_SCENE_COMP_SEQUENCER: + return NodeType::SEQUENCER; + } + return NodeType::UNDEFINED; +} + +NodeType nodeTypeFromObjectComponent(eDepsObjectComponentType component) +{ + switch (component) { + case DEG_OB_COMP_PARAMETERS: + return NodeType::PARAMETERS; + case DEG_OB_COMP_PROXY: + return NodeType::PROXY; + case DEG_OB_COMP_ANIMATION: + return NodeType::ANIMATION; + case DEG_OB_COMP_TRANSFORM: + return NodeType::TRANSFORM; + case DEG_OB_COMP_GEOMETRY: + return NodeType::GEOMETRY; + case DEG_OB_COMP_EVAL_POSE: + return NodeType::EVAL_POSE; + case DEG_OB_COMP_BONE: + return NodeType::BONE; + case DEG_OB_COMP_SHADING: + return NodeType::SHADING; + case DEG_OB_COMP_CACHE: + return NodeType::CACHE; + } + return NodeType::UNDEFINED; +} + /******************************************************************************* * Type information. */ diff --git a/source/blender/depsgraph/intern/node/deg_node.h b/source/blender/depsgraph/intern/node/deg_node.h index 65cb5b73c99..5bb9b7fe9ce 100644 --- a/source/blender/depsgraph/intern/node/deg_node.h +++ b/source/blender/depsgraph/intern/node/deg_node.h @@ -27,6 +27,8 @@ #include "BLI_utildefines.h" +#include "DEG_depsgraph_build.h" + struct GHash; struct ID; struct Scene; @@ -130,6 +132,9 @@ enum class NodeType { }; const char *nodeTypeAsString(NodeType type); +NodeType nodeTypeFromSceneComponent(eDepsSceneComponentType component); +NodeType nodeTypeFromObjectComponent(eDepsObjectComponentType component); + /* All nodes in Depsgraph are descended from this. */ struct Node { /* Helper class for static typeinfo in subclasses. */ |