diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:39:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:39:04 +0300 |
commit | 95011f6d484b369db92ae13c674a6522d664ea8f (patch) | |
tree | 91ba2719c9f3096fad0f1f768aa7b1c4d79aa32a /source/blender/editors/armature/pose_group.c | |
parent | 0911acb5cf49c5ba05b1df045b41697704aa288a (diff) | |
parent | 44505b38df557a5711703613685a1dec9fc2c3d9 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/armature/pose_group.c')
-rw-r--r-- | source/blender/editors/armature/pose_group.c | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index 62fd0966c53..aefca13d66c 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -68,13 +68,13 @@ static int pose_group_add_exec(bContext *C, wmOperator *UNUSED(op)) /* only continue if there's an object and pose */ if (ELEM(NULL, ob, ob->pose)) return OPERATOR_CANCELLED; - + /* for now, just call the API function for this */ BKE_pose_add_group(ob->pose, NULL); - + /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); - + return OPERATOR_FINISHED; } @@ -84,11 +84,11 @@ void POSE_OT_group_add(wmOperatorType *ot) ot->name = "Add Bone Group"; ot->idname = "POSE_OT_group_add"; ot->description = "Add a new bone group"; - + /* api callbacks */ ot->exec = pose_group_add_exec; ot->poll = ED_operator_posemode_context; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -97,18 +97,18 @@ void POSE_OT_group_add(wmOperatorType *ot) static int pose_group_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_pose_object_from_context(C); - + /* only continue if there's an object and pose */ if (ELEM(NULL, ob, ob->pose)) return OPERATOR_CANCELLED; - + /* for now, just call the API function for this */ BKE_pose_remove_group_index(ob->pose, ob->pose->active_group); - + /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE); - + return OPERATOR_FINISHED; } @@ -118,11 +118,11 @@ void POSE_OT_group_remove(wmOperatorType *ot) ot->name = "Remove Bone Group"; ot->idname = "POSE_OT_group_remove"; ot->description = "Remove the active bone group"; - + /* api callbacks */ ot->exec = pose_group_remove_exec; ot->poll = ED_operator_posemode_context; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -135,14 +135,14 @@ static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U Object *ob = ED_pose_object_from_context(C); bPose *pose; PropertyRNA *prop = RNA_struct_find_property(op->ptr, "type"); - + uiPopupMenu *pup; uiLayout *layout; bActionGroup *grp; int i; - + /* only continue if there's an object, and a pose there too */ - if (ELEM(NULL, ob, ob->pose)) + if (ELEM(NULL, ob, ob->pose)) return OPERATOR_CANCELLED; pose = ob->pose; @@ -156,28 +156,28 @@ static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U return op->type->exec(C, op); } } - + /* if there's no active group (or active is invalid), create a new menu to find it */ if (pose->active_group <= 0) { /* create a new menu, and start populating it with group names */ pup = UI_popup_menu_begin(C, op->type->name, ICON_NONE); layout = UI_popup_menu_layout(pup); - - /* special entry - allow to create new group, then use that + + /* special entry - allow to create new group, then use that * (not to be used for removing though) */ if (strstr(op->idname, "assign")) { uiItemIntO(layout, "New Group", ICON_NONE, op->idname, "type", 0); uiItemS(layout); } - + /* add entries for each group */ for (grp = pose->agroups.first, i = 1; grp; grp = grp->next, i++) uiItemIntO(layout, grp->name, ICON_NONE, op->idname, "type", i); - + /* finish building the menu, and process it (should result in calling self again) */ UI_popup_menu_end(C, pup); - + return OPERATOR_INTERFACE; } else { @@ -199,14 +199,14 @@ static int pose_group_assign_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; 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... */ pose->active_group = RNA_int_get(op->ptr, "type"); if (pose->active_group == 0) BKE_pose_add_group(ob->pose, NULL); - + /* add selected bones to group then */ FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN (ob, pchan) { @@ -218,7 +218,7 @@ static int pose_group_assign_exec(bContext *C, wmOperator *op) /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE); - + /* report done status */ if (done) return OPERATOR_FINISHED; @@ -232,15 +232,15 @@ void POSE_OT_group_assign(wmOperatorType *ot) ot->name = "Add Selected to Bone Group"; ot->idname = "POSE_OT_group_assign"; ot->description = "Add selected bones to the chosen bone group"; - + /* api callbacks */ ot->invoke = pose_groups_menu_invoke; ot->exec = pose_group_assign_exec; ot->poll = ED_operator_posemode_context; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + /* properties */ RNA_def_int(ot->srna, "type", 0, 0, INT_MAX, "Bone Group Index", "", 0, 10); } @@ -250,11 +250,11 @@ static int pose_group_unassign_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_pose_object_from_context(C); bool done = false; - + /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) return OPERATOR_CANCELLED; - + /* find selected bones to remove from all bone groups */ FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN (ob, pchan) { @@ -264,11 +264,11 @@ static int pose_group_unassign_exec(bContext *C, wmOperator *UNUSED(op)) } } FOREACH_PCHAN_SELECTED_IN_OBJECT_END; - + /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE); - + /* report done status */ if (done) return OPERATOR_FINISHED; @@ -282,11 +282,11 @@ void POSE_OT_group_unassign(wmOperatorType *ot) ot->name = "Remove Selected from Bone Groups"; ot->idname = "POSE_OT_group_unassign"; ot->description = "Remove selected bones from all bone groups"; - + /* api callbacks */ ot->exec = pose_group_unassign_exec; ot->poll = ED_operator_posemode_context; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -442,16 +442,16 @@ void POSE_OT_group_sort(wmOperatorType *ot) static void pose_group_select(Object *ob, bool select) { bPose *pose = ob->pose; - + FOREACH_PCHAN_VISIBLE_IN_OBJECT_BEGIN (ob, pchan) { if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) { if (select) { - if (pchan->agrp_index == pose->active_group) + if (pchan->agrp_index == pose->active_group) pchan->bone->flag |= BONE_SELECTED; } else { - if (pchan->agrp_index == pose->active_group) + if (pchan->agrp_index == pose->active_group) pchan->bone->flag &= ~BONE_SELECTED; } } @@ -462,16 +462,16 @@ static void pose_group_select(Object *ob, bool select) static int pose_group_select_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_pose_object_from_context(C); - + /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) return OPERATOR_CANCELLED; - + pose_group_select(ob, 1); - + /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); - + return OPERATOR_FINISHED; } @@ -481,11 +481,11 @@ void POSE_OT_group_select(wmOperatorType *ot) ot->name = "Select Bones of Bone Group"; ot->idname = "POSE_OT_group_select"; ot->description = "Select bones in active Bone Group"; - + /* api callbacks */ ot->exec = pose_group_select_exec; ot->poll = ED_operator_posemode_context; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -493,16 +493,16 @@ void POSE_OT_group_select(wmOperatorType *ot) static int pose_group_deselect_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_pose_object_from_context(C); - + /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) return OPERATOR_CANCELLED; - + pose_group_select(ob, 0); - + /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); - + return OPERATOR_FINISHED; } @@ -512,11 +512,11 @@ void POSE_OT_group_deselect(wmOperatorType *ot) ot->name = "Deselect Bone Group"; ot->idname = "POSE_OT_group_deselect"; ot->description = "Deselect bones of active Bone Group"; - + /* api callbacks */ ot->exec = pose_group_deselect_exec; ot->poll = ED_operator_posemode_context; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } |