Depsgraph: Make geoemtry to tag function more reusable

This commit is contained in:
2018-09-19 15:06:18 +02:00
parent 34c361db5a
commit 1b98fff713
2 changed files with 45 additions and 38 deletions

View File

@@ -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

View File

@@ -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)