Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/deform.c
| Show First 20 Lines • Show All 551 Lines • ▼ Show 20 Lines | if (name == NULL || name[0] == '\0') { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| const ListBase *defbase = BKE_object_defgroup_list(ob); | const ListBase *defbase = BKE_object_defgroup_list(ob); | ||||
| return BLI_findstring(defbase, name, offsetof(bDeformGroup, name)); | return BLI_findstring(defbase, name, offsetof(bDeformGroup, name)); | ||||
| } | } | ||||
| int BKE_id_defgroup_name_index(const ID *id, const char *name) | int BKE_id_defgroup_name_index(const ID *id, const char *name) | ||||
| { | { | ||||
| if (name == NULL || name[0] == '\0') { | int index; | ||||
| if (!BKE_id_defgroup_name_find(id, name, &index, NULL)) { | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| return index; | |||||
| } | |||||
| bool BKE_id_defgroup_name_find(const struct ID *id, | |||||
| const char *name, | |||||
| int *r_index, | |||||
| struct bDeformGroup **r_group) | |||||
| { | |||||
| if (name == NULL || name[0] == '\0') { | |||||
| return false; | |||||
| } | |||||
| const ListBase *defbase = BKE_id_defgroup_list_get(id); | const ListBase *defbase = BKE_id_defgroup_list_get(id); | ||||
| return BLI_findstringindex(defbase, name, offsetof(bDeformGroup, name)); | int index; | ||||
| LISTBASE_FOREACH_INDEX (bDeformGroup *, group, defbase, index) { | |||||
| if (STREQ(name, group->name)) { | |||||
| if (r_index != NULL) { | |||||
| *r_index = index; | |||||
| } | |||||
| if (r_group != NULL) { | |||||
| *r_group = group; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | } | ||||
| const ListBase *BKE_object_defgroup_list(const Object *ob) | const ListBase *BKE_object_defgroup_list(const Object *ob) | ||||
| { | { | ||||
| BLI_assert(BKE_object_supports_vertex_groups(ob)); | BLI_assert(BKE_object_supports_vertex_groups(ob)); | ||||
| return BKE_id_defgroup_list_get((const ID *)ob->data); | return BKE_id_defgroup_list_get((const ID *)ob->data); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,125 Lines • Show Last 20 Lines | |||||