ShapeKey: add utils to say whether given ID type supports shapekeys.

Those kind of checks are handy to have for generic processing...
This commit is contained in:
Bastien Montagne
2019-01-25 17:37:19 +01:00
parent 2a7b74c237
commit a42441d145
2 changed files with 14 additions and 0 deletions

View File

@@ -66,6 +66,8 @@ float *BKE_key_evaluate_object_ex(
float *BKE_key_evaluate_object(
struct Object *ob, int *r_totelem);
bool BKE_key_idtype_support(const short id_type);
struct Key **BKE_key_from_id_p(struct ID *id);
struct Key *BKE_key_from_id(struct ID *id);
struct Key **BKE_key_from_object_p(struct Object *ob);

View File

@@ -1374,6 +1374,18 @@ float *BKE_key_evaluate_object(Object *ob, int *r_totelem)
return BKE_key_evaluate_object_ex(ob, r_totelem, NULL, 0);
}
bool BKE_key_idtype_support(const short id_type)
{
switch (id_type) {
case ID_ME:
case ID_CU:
case ID_LT:
return true;
default:
return false;
}
}
Key **BKE_key_from_id_p(ID *id)
{
switch (GS(id->name)) {