diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-19 16:06:18 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-19 17:10:12 +0300 |
commit | 1b98fff7130dbd5c371b8387b60f11a95f0977e5 (patch) | |
tree | a59d894c3650ea45bdb6f07d7585878bd790773d /source/blender/depsgraph | |
parent | 34c361db5a0515446bfc59c802a36e9b833523f3 (diff) |
Depsgraph: Make geoemtry to tag function more reusable
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_intern.h | 4 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_tag.cc | 79 |
2 files changed, 45 insertions, 38 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_intern.h b/source/blender/depsgraph/intern/depsgraph_intern.h index aa67226c47e..069407e855e 100644 --- a/source/blender/depsgraph/intern/depsgraph_intern.h +++ b/source/blender/depsgraph/intern/depsgraph_intern.h @@ -146,4 +146,8 @@ struct ListBase *deg_build_effector_relations(Depsgraph *graph, struct Collectio struct ListBase *deg_build_collision_relations(Depsgraph *graph, struct Collection *collection, unsigned int modifier_type); void deg_clear_physics_relations(Depsgraph *graph); +/* Tagging Utilities -------------------------------------------------------- */ + +eDepsNode_Type deg_geometry_tag_to_component(const ID *id); + } // namespace DEG diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index 42db6af797b..79f103a3b8f 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -89,44 +89,9 @@ void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag); void depsgraph_geometry_tag_to_component(const ID *id, eDepsNode_Type *component_type) { - const ID_Type id_type = GS(id->name); - switch (id_type) { - case ID_OB: - { - const Object *object = (Object *)id; - switch (object->type) { - case OB_MESH: - case OB_CURVE: - case OB_SURF: - case OB_FONT: - case OB_LATTICE: - case OB_MBALL: - case OB_GPENCIL: - *component_type = DEG_NODE_TYPE_GEOMETRY; - break; - case OB_ARMATURE: - *component_type = DEG_NODE_TYPE_EVAL_POSE; - break; - /* TODO(sergey): More cases here? */ - } - break; - } - case ID_ME: - *component_type = DEG_NODE_TYPE_GEOMETRY; - break; - case ID_PA: /* Particles */ - return; - case ID_LP: - *component_type = DEG_NODE_TYPE_PARAMETERS; - break; - case ID_GD: - *component_type = DEG_NODE_TYPE_GEOMETRY; - break; - case ID_PAL: /* Palettes */ - *component_type = DEG_NODE_TYPE_PARAMETERS; - break; - default: - break; + const eDepsNode_Type result = deg_geometry_tag_to_component(id); + if (result != DEG_NODE_TYPE_UNDEFINED) { + *component_type = result; } } @@ -568,6 +533,44 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph) } /* namespace */ +eDepsNode_Type deg_geometry_tag_to_component(const ID *id) +{ + const ID_Type id_type = GS(id->name); + switch (id_type) { + case ID_OB: + { + const Object *object = (Object *)id; + switch (object->type) { + case OB_MESH: + case OB_CURVE: + case OB_SURF: + case OB_FONT: + case OB_LATTICE: + case OB_MBALL: + case OB_GPENCIL: + return DEG_NODE_TYPE_GEOMETRY; + case OB_ARMATURE: + return DEG_NODE_TYPE_EVAL_POSE; + /* TODO(sergey): More cases here? */ + } + break; + } + case ID_ME: + return DEG_NODE_TYPE_GEOMETRY; + case ID_PA: /* Particles */ + return DEG_NODE_TYPE_UNDEFINED; + case ID_LP: + return DEG_NODE_TYPE_PARAMETERS; + case ID_GD: + return DEG_NODE_TYPE_GEOMETRY; + case ID_PAL: /* Palettes */ + return DEG_NODE_TYPE_PARAMETERS; + default: + break; + } + return DEG_NODE_TYPE_UNDEFINED; +} + } // namespace DEG const char *DEG_update_tag_as_string(eDepsgraph_Tag flag) |