diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-25 23:39:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-25 23:39:14 +0400 |
commit | 63caaa2b12edf0e0a47764156416fac9d43d3664 (patch) | |
tree | 39d9455df141edc2f232240da34514b0468dcc28 /source/blender/editors/armature | |
parent | 5928af11ef97d6d9318d3a06fe32f0d77fc48e9c (diff) |
Code Cleanup: rename vars for detecting change to be more consistent
rename change/is_change/is_changed/modified -> changed
also use bools over int/short/char and once accidental float.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/armature_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_select.c | 14 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature_retarget.c | 10 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_lib.c | 8 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_select.c | 26 |
5 files changed, 32 insertions, 32 deletions
diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 55764a8919f..e5fc6c910c0 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -1117,7 +1117,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *op) EditBone *curBone, *ebone_next; bConstraint *con; Object *obedit = CTX_data_edit_object(C); // XXX get from context - int removed_num = 0; + int removed_tot = 0; arm = obedit->data; /* cancel if nothing selected */ @@ -1174,12 +1174,12 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *op) if (curBone->flag & BONE_SELECTED) { if (curBone == arm->act_edbone) arm->act_edbone = NULL; ED_armature_edit_bone_remove(arm, curBone); - removed_num++; + removed_tot++; } } } - BKE_reportf(op->reports, RPT_INFO, "Deleted %d bones", removed_num); + BKE_reportf(op->reports, RPT_INFO, "Deleted %d bones", removed_tot); ED_armature_sync_selection(arm->edbo); diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index 0bc6f1e037c..ed2d1388196 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -174,7 +174,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, const wmEv { bArmature *arm; EditBone *bone, *curBone, *next; - int extend = RNA_boolean_get(op->ptr, "extend"); + const bool extend = RNA_boolean_get(op->ptr, "extend"); Object *obedit = CTX_data_edit_object(C); arm = obedit->data; @@ -1157,7 +1157,7 @@ static int armature_shortest_path_pick_invoke(bContext *C, wmOperator *op, const EditBone *ebone_src, *ebone_dst; EditBone *ebone_isect_parent = NULL; EditBone *ebone_isect_child[2]; - bool change; + bool changed; view3d_operator_needs_opengl(C); @@ -1195,25 +1195,25 @@ static int armature_shortest_path_pick_invoke(bContext *C, wmOperator *op, const { armature_shortest_path_select(arm, ebone_isect_parent, ebone_src, false, false); armature_shortest_path_select(arm, ebone_isect_parent, ebone_dst, false, false); - change = true; + changed = true; } else { /* unselectable */ - change = false; + changed = false; } } else { if (armature_shortest_path_select(arm, ebone_src, ebone_dst, true, true)) { armature_shortest_path_select(arm, ebone_src, ebone_dst, true, false); - change = true; + changed = true; } else { /* unselectable */ - change = false; + changed = false; } } - if (change) { + if (changed) { arm->act_edbone = ebone_dst; ED_armature_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index c03e7861307..2c00c5e646c 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -697,7 +697,7 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link) static void RIG_reconnectControlBones(RigGraph *rg) { RigControl *ctrl; - int change = 1; + bool changed = true; /* first pass, link to deform bones */ for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) { @@ -812,8 +812,8 @@ static void RIG_reconnectControlBones(RigGraph *rg) /* second pass, make chains in control bones */ - while (change) { - change = 0; + while (changed) { + changed = false; for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) { /* if control is not linked yet */ @@ -865,7 +865,7 @@ static void RIG_reconnectControlBones(RigGraph *rg) /* check if parent is already linked */ if (ctrl_parent && ctrl_parent->link) { RIG_parentControl(ctrl, ctrl_parent->bone); - change = 1; + changed = true; } else { /* check childs */ @@ -873,7 +873,7 @@ static void RIG_reconnectControlBones(RigGraph *rg) /* if a child is linked, link to that one */ if (ctrl_child->link && ctrl_child->bone->parent == ctrl->bone) { RIG_parentControl(ctrl, ctrl_child->bone); - change = 1; + changed = true; break; } } diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 69ee794e1d9..ce10214c2ee 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -105,7 +105,7 @@ static int poselib_get_free_index(bAction *act) { TimeMarker *marker; int low = 0, high = 0; - short changed = 0; + bool changed = false; /* sanity checks */ if (ELEM(NULL, act, act->markers.first)) return 1; @@ -115,7 +115,7 @@ static int poselib_get_free_index(bAction *act) * Prevents problems with deleting then trying to add new poses [#27412] */ do { - changed = 0; + changed = false; for (marker = act->markers.first; marker; marker = marker->next) { /* only increase low if value is 1 greater than low, to find "gaps" where @@ -123,13 +123,13 @@ static int poselib_get_free_index(bAction *act) */ if (marker->frame == (low + 1)) { low++; - changed = 1; + changed = true; } /* value replaces high if it is the highest value encountered yet */ if (marker->frame > high) { high = marker->frame; - changed = 1; + changed = true; } } } while (changed != 0); diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 42d55712b03..34023d365ca 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -266,7 +266,7 @@ static int pose_select_connected_invoke(bContext *C, wmOperator *op, const wmEve Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm = (bArmature *)ob->data; Bone *bone, *curBone, *next = NULL; - int extend = RNA_boolean_get(op->ptr, "extend"); + const bool extend = RNA_boolean_get(op->ptr, "extend"); view3d_operator_needs_opengl(C); @@ -628,13 +628,13 @@ void POSE_OT_select_hierarchy(wmOperatorType *ot) /* -------------------------------------- */ -static short pose_select_same_group(bContext *C, Object *ob, bool extend) +static bool pose_select_same_group(bContext *C, Object *ob, bool extend) { bArmature *arm = (ob) ? ob->data : NULL; bPose *pose = (ob) ? ob->pose : NULL; char *group_flags; int numGroups = 0; - short changed = 0, tagged = 0; + bool changed = false, tagged = false; /* sanity checks */ if (ELEM3(NULL, ob, pose, arm)) @@ -656,7 +656,7 @@ static short pose_select_same_group(bContext *C, Object *ob, bool extend) /* keep track of group as group to use later? */ if (pchan->bone->flag & BONE_SELECTED) { group_flags[pchan->agrp_index] = 1; - tagged = 1; + tagged = true; } /* deselect all bones before selecting new ones? */ @@ -674,7 +674,7 @@ static short pose_select_same_group(bContext *C, Object *ob, bool extend) /* check if the group used by this bone is counted */ if (group_flags[pchan->agrp_index]) { pchan->bone->flag |= BONE_SELECTED; - changed = 1; + changed = true; } } } @@ -687,11 +687,11 @@ static short pose_select_same_group(bContext *C, Object *ob, bool extend) return changed; } -static short pose_select_same_layer(bContext *C, Object *ob, bool extend) +static bool pose_select_same_layer(bContext *C, Object *ob, bool extend) { bPose *pose = (ob) ? ob->pose : NULL; bArmature *arm = (ob) ? ob->data : NULL; - short changed = 0; + bool changed = false; int layers = 0; if (ELEM3(NULL, ob, pose, arm)) @@ -718,7 +718,7 @@ static short pose_select_same_layer(bContext *C, Object *ob, bool extend) /* if bone is on a suitable layer, and the bone can have its selection changed, select it */ if ((layers & pchan->bone->layer) && (pchan->bone->flag & BONE_UNSELECTABLE) == 0) { pchan->bone->flag |= BONE_SELECTED; - changed = 1; + changed = true; } } CTX_DATA_END; @@ -726,14 +726,14 @@ static short pose_select_same_layer(bContext *C, Object *ob, bool extend) return changed; } -static int pose_select_same_keyingset(bContext *C, Object *ob, bool extend) +static bool pose_select_same_keyingset(bContext *C, Object *ob, bool extend) { KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C)); KS_Path *ksp; bArmature *arm = (ob) ? ob->data : NULL; bPose *pose = (ob) ? ob->pose : NULL; - short changed = 0; + bool changed = false; /* sanity checks: validate Keying Set and object */ if ((ks == NULL) || (ANIM_validate_keyingset(C, NULL, ks) != 0)) @@ -768,7 +768,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, bool extend) /* select if bone is visible and can be affected */ if (PBONE_SELECTABLE(arm, pchan->bone)) { pchan->bone->flag |= BONE_SELECTED; - changed = 1; + changed = true; } } @@ -786,8 +786,8 @@ static int pose_select_grouped_exec(bContext *C, wmOperator *op) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm = (bArmature *)ob->data; - short extend = RNA_boolean_get(op->ptr, "extend"); - short changed = 0; + const bool extend = RNA_boolean_get(op->ptr, "extend"); + bool changed = false; /* sanity check */ if (ob->pose == NULL) |