Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/pose_group.c
| Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
| /* ********************************************** */ | /* ********************************************** */ | ||||
| /* Bone Groups */ | /* Bone Groups */ | ||||
| static int pose_group_add_exec(bContext *C, wmOperator *UNUSED(op)) | static int pose_group_add_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Object *ob = ED_pose_object_from_context(C); | Object *ob = ED_pose_object_from_context(C); | ||||
| /* only continue if there's an object */ | /* only continue if there's an object and pose */ | ||||
| if (ob == NULL) | if (ELEM(NULL, ob, ob->pose)) | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| /* for now, just call the API function for this */ | /* for now, just call the API function for this */ | ||||
| BKE_pose_add_group(ob); | BKE_pose_add_group(ob->pose, NULL); | ||||
| /* notifiers for updates */ | /* notifiers for updates */ | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void POSE_OT_group_add(wmOperatorType *ot) | void POSE_OT_group_add(wmOperatorType *ot) | ||||
| Show All 11 Lines | void POSE_OT_group_add(wmOperatorType *ot) | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| static int pose_group_remove_exec(bContext *C, wmOperator *UNUSED(op)) | static int pose_group_remove_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Object *ob = ED_pose_object_from_context(C); | Object *ob = ED_pose_object_from_context(C); | ||||
| /* only continue if there's an object */ | /* only continue if there's an object and pose */ | ||||
| if (ob == NULL) | if (ELEM(NULL, ob, ob->pose)) | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| /* for now, just call the API function for this */ | /* for now, just call the API function for this */ | ||||
| BKE_pose_remove_group(ob); | BKE_pose_remove_group_index(ob->pose, ob->pose->active_group); | ||||
| /* notifiers for updates */ | /* notifiers for updates */ | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void POSE_OT_group_remove(wmOperatorType *ot) | void POSE_OT_group_remove(wmOperatorType *ot) | ||||
| ▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | static int pose_group_assign_exec(bContext *C, wmOperator *op) | ||||
| pose = ob->pose; | pose = ob->pose; | ||||
| /* set the active group number to the one from operator props | /* set the active group number to the one from operator props | ||||
| * - if 0 after this, make a new group... | * - if 0 after this, make a new group... | ||||
| */ | */ | ||||
| pose->active_group = RNA_int_get(op->ptr, "type"); | pose->active_group = RNA_int_get(op->ptr, "type"); | ||||
| if (pose->active_group == 0) | if (pose->active_group == 0) | ||||
| BKE_pose_add_group(ob); | BKE_pose_add_group(ob->pose, NULL); | ||||
| /* add selected bones to group then */ | /* add selected bones to group then */ | ||||
| CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) | CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) | ||||
| { | { | ||||
| pchan->agrp_index = pose->active_group; | pchan->agrp_index = pose->active_group; | ||||
| done = true; | done = true; | ||||
| } | } | ||||
| CTX_DATA_END; | CTX_DATA_END; | ||||
| ▲ Show 20 Lines • Show All 323 Lines • Show Last 20 Lines | |||||