diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-11 05:25:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-11 05:33:29 +0400 |
commit | a15b3c4d111613993eca23d5f99600c2052469e7 (patch) | |
tree | 18d4bcd4291013ecf12a24def023d6f7a73ebd65 /source/blender/editors/transform | |
parent | 52af5fa31fbc0a1855a28d957d4387e5d6a15170 (diff) |
Code cleanup: use bool
Diffstat (limited to 'source/blender/editors/transform')
4 files changed, 17 insertions, 10 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 5a8a84112d5..8b0667a8992 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2584,7 +2584,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) bConstraintTypeInfo *cti = BKE_get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT); bConstraintOb cob; bConstraint *con; - int do_limit = false; + bool do_limit = false; /* Evaluate valid constraints */ for (con = td->con; con; con = con->next) { @@ -4107,7 +4107,8 @@ static void headerTranslation(TransInfo *t, float vec[3], char str[MAX_INFO_LEN] dist = len_v3(vec); if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) { - int i, do_split = t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1 : 0; + const bool do_split = (t->scene->unit.flag & USER_UNIT_OPT_SPLIT) != 0; + int i; for (i = 0; i < 3; i++) { bUnit_AsString(&tvec[NUM_STR_REP_LEN * i], NUM_STR_REP_LEN, dvec[i] * t->scene->unit.scale_length, @@ -4121,13 +4122,18 @@ static void headerTranslation(TransInfo *t, float vec[3], char str[MAX_INFO_LEN] } } - if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) + if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) { + const bool do_split = (t->scene->unit.flag & USER_UNIT_OPT_SPLIT) != 0; bUnit_AsString(distvec, sizeof(distvec), dist * t->scene->unit.scale_length, 4, t->scene->unit.system, - B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, false); - else if (dist > 1e10f || dist < -1e10f) /* prevent string buffer overflow */ + B_UNIT_LENGTH, do_split, false); + } + else if (dist > 1e10f || dist < -1e10f) { + /* prevent string buffer overflow */ BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4e", dist); - else + } + else { BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4f", dist); + } if (t->flag & T_AUTOIK) { short chainlen = t->settings->autoik_chainlen; @@ -4571,7 +4577,8 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) { TransData *td; float ratio; - int i, initial_feather = false; + int i; + bool initial_feather = false; char str[MAX_INFO_LEN]; ratio = t->values[0]; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 455fa45d01b..6f0208175b1 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -6596,7 +6596,7 @@ static void MaskHandleToTransData(MaskSplinePoint *point, eMaskWhichHandle which /*const*/ float parent_inverse_matrix[3][3]) { BezTriple *bezt = &point->bezt; - short is_sel_any = MASKPOINT_ISSEL_ANY(point); + const bool is_sel_any = MASKPOINT_ISSEL_ANY(point); tdm->point = point; copy_m3_m3(tdm->vec, bezt->vec); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 2fa0b6b320f..08a291860f0 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -505,7 +505,7 @@ int calc_manipulator_stats(const bContext *C) else if (ob && (ob->mode & OB_MODE_POSE)) { bPoseChannel *pchan; int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed - int ok = false; + bool ok = false; if ((ob->lay & v3d->lay) == 0) return 0; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 1338a34749a..87b064acac7 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -858,7 +858,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], bArmature *arm = ob->data; bPoseChannel *pchan; float imat[3][3], mat[3][3]; - int ok = false; + bool ok = false; if (activeOnly && (pchan = BKE_pose_channel_active(ob))) { add_v3_v3(normal, pchan->pose_mat[2]); |