Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/armature/pose_group.c')
-rw-r--r--source/blender/editors/armature/pose_group.c60
1 files changed, 40 insertions, 20 deletions
diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c
index 0d100a09dfd..3ae9976c948 100644
--- a/source/blender/editors/armature/pose_group.c
+++ b/source/blender/editors/armature/pose_group.c
@@ -59,8 +59,9 @@ static int pose_group_add_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))
+ 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);
@@ -91,8 +92,9 @@ 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))
+ 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);
@@ -134,8 +136,9 @@ static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U
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;
/* If group index is set, try to use it! */
@@ -164,8 +167,9 @@ static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U
}
/* add entries for each group */
- for (grp = pose->agroups.first, i = 1; grp; grp = grp->next, i++)
+ 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);
@@ -187,8 +191,9 @@ static int pose_group_assign_exec(bContext *C, wmOperator *op)
bool done = false;
/* 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;
@@ -196,8 +201,9 @@ static int pose_group_assign_exec(bContext *C, wmOperator *op)
* - if 0 after this, make a new group...
*/
pose->active_group = RNA_int_get(op->ptr, "type");
- if (pose->active_group == 0)
+ 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) {
@@ -211,10 +217,12 @@ static int pose_group_assign_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
/* report done status */
- if (done)
+ if (done) {
return OPERATOR_FINISHED;
- else
+ }
+ else {
return OPERATOR_CANCELLED;
+ }
}
void POSE_OT_group_assign(wmOperatorType *ot)
@@ -242,8 +250,9 @@ static int pose_group_unassign_exec(bContext *C, wmOperator *UNUSED(op))
bool done = false;
/* 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;
+ }
/* find selected bones to remove from all bone groups */
FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN (ob, pchan) {
@@ -259,10 +268,12 @@ static int pose_group_unassign_exec(bContext *C, wmOperator *UNUSED(op))
DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
/* report done status */
- if (done)
+ if (done) {
return OPERATOR_FINISHED;
- else
+ }
+ else {
return OPERATOR_CANCELLED;
+ }
}
void POSE_OT_group_unassign(wmOperatorType *ot)
@@ -288,15 +299,18 @@ static int group_move_exec(bContext *C, wmOperator *op)
bActionGroup *grp;
int dir = RNA_enum_get(op->ptr, "direction");
- if (ELEM(NULL, ob, pose))
+ if (ELEM(NULL, ob, pose)) {
return OPERATOR_CANCELLED;
- if (pose->active_group <= 0)
+ }
+ if (pose->active_group <= 0) {
return OPERATOR_CANCELLED;
+ }
/* get group to move */
grp = BLI_findlink(&pose->agroups, pose->active_group - 1);
- if (grp == NULL)
+ if (grp == NULL) {
return OPERATOR_CANCELLED;
+ }
/* move bone group */
if (BLI_listbase_link_move(&pose->agroups, grp, dir)) {
@@ -374,10 +388,12 @@ static int group_sort_exec(bContext *C, wmOperator *UNUSED(op))
int agrp_count;
int i;
- if (ELEM(NULL, ob, pose))
+ if (ELEM(NULL, ob, pose)) {
return OPERATOR_CANCELLED;
- if (pose->active_group <= 0)
+ }
+ if (pose->active_group <= 0) {
return OPERATOR_CANCELLED;
+ }
/* create temporary array with bone groups and indices */
agrp_count = BLI_listbase_count(&pose->agroups);
@@ -439,12 +455,14 @@ static void pose_group_select(Object *ob, bool select)
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;
+ }
}
}
}
@@ -456,8 +474,9 @@ 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))
+ if (ELEM(NULL, ob, ob->pose)) {
return OPERATOR_CANCELLED;
+ }
pose_group_select(ob, 1);
@@ -489,8 +508,9 @@ 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))
+ if (ELEM(NULL, ob, ob->pose)) {
return OPERATOR_CANCELLED;
+ }
pose_group_select(ob, 0);