Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/deform.c
| Show First 20 Lines • Show All 546 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| bDeformGroup *BKE_object_defgroup_find_name(const Object *ob, const char *name) | bDeformGroup *BKE_object_defgroup_find_name(const Object *ob, const char *name) | ||||
| { | { | ||||
| if (name == NULL || name[0] == '\0') { | 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); | ||||
| if (defbase == NULL) { | |||||
| return NULL; | |||||
| } | |||||
| 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') { | if (name == NULL || name[0] == '\0') { | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| 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)); | return BLI_findstringindex(defbase, name, offsetof(bDeformGroup, name)); | ||||
| } | } | ||||
| 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)); | if (!BKE_object_supports_vertex_groups(ob)) { | ||||
| return NULL; | |||||
| } | |||||
| return BKE_id_defgroup_list_get((const ID *)ob->data); | return BKE_id_defgroup_list_get((const ID *)ob->data); | ||||
| } | } | ||||
| int BKE_object_defgroup_name_index(const Object *ob, const char *name) | int BKE_object_defgroup_name_index(const Object *ob, const char *name) | ||||
| { | { | ||||
| return BKE_id_defgroup_name_index((ID *)ob->data, name); | return BKE_id_defgroup_name_index((ID *)ob->data, name); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,120 Lines • Show Last 20 Lines | |||||