diff options
6 files changed, 69 insertions, 69 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 3ec7e6eec2c..f1f49a6d88b 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1272,7 +1272,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) glEnd(); glTranslatef(mval[0], mval[1], 0); - glRotatef(-180 / M_PI * atan2f(cent[0] - t->mval[0], cent[1] - t->mval[1]), 0, 0, 1); + glRotatef(-RAD2DEGF(atan2f(cent[0] - t->mval[0], cent[1] - t->mval[1])), 0, 0, 1); setlinestyle(0); glLineWidth(3.0); @@ -1306,8 +1306,8 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) float dx = t->mval[0] - cent[0], dy = t->mval[1] - cent[1]; float angle = atan2f(dy, dx); float dist = sqrtf(dx*dx + dy*dy); - float delta_angle = MIN2(15 / dist, M_PI/4); - float spacing_angle = MIN2(5 / dist, M_PI/12); + float delta_angle = MIN2(15.0f / dist, (float)M_PI/4.0f); + float spacing_angle = MIN2(5.0f / dist, (float)M_PI/12.0f); UI_ThemeColor(TH_WIRE); setlinestyle(3); @@ -1326,14 +1326,14 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) glPushMatrix(); glTranslatef(cosf(angle - delta_angle) * dist, sinf(angle - delta_angle) * dist, 0); - glRotatef(180 / M_PI * (angle - delta_angle), 0, 0, 1); + glRotatef(RAD2DEGF(angle - delta_angle), 0, 0, 1); drawArrowHead(DOWN, 5); glPopMatrix(); glTranslatef(cosf(angle + delta_angle) * dist, sinf(angle + delta_angle) * dist, 0); - glRotatef(180 / M_PI * (angle + delta_angle), 0, 0, 1); + glRotatef(RAD2DEGF(angle + delta_angle), 0, 0, 1); drawArrowHead(UP, 5); @@ -1921,7 +1921,7 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl eulO_to_axis_angle( axis, angle,eul, EULER_ORDER_DEFAULT); /* when converting to axis-angle, we need a special exception for the case when there is no axis */ - if (IS_EQ(axis[0], axis[1]) && IS_EQ(axis[1], axis[2])) { + if (IS_EQF(axis[0], axis[1]) && IS_EQF(axis[1], axis[2])) { /* for now, rotate around y-axis then (so that it simply becomes the roll) */ axis[1]= 1.0f; } @@ -2237,8 +2237,8 @@ void initWarp(TransInfo *t) t->idx_max = 0; t->num.idx_max = 0; t->snap[0] = 0.0f; - t->snap[1] = 5.0f / 180 * M_PI; - t->snap[2] = 1.0f / 180 * M_PI; + t->snap[1] = 5.0f / 180.0f * (float)M_PI; + t->snap[2] = 1.0f / 180.0f * (float)M_PI; t->num.increment = 1.0f; @@ -2261,7 +2261,7 @@ void initWarp(TransInfo *t) mid_v3_v3v3(t->center, min, max); - if (max[0] == min[0]) max[0] += 0.1; /* not optimal, but flipping is better than invalid garbage (i.e. division by zero!) */ + if (max[0] == min[0]) max[0] += 0.1f; /* not optimal, but flipping is better than invalid garbage (i.e. division by zero!) */ t->val= (max[0]-min[0])/2.0f; /* t->val is X dimension projected boundbox */ } @@ -2325,11 +2325,11 @@ int Warp(TransInfo *t, short UNUSED(mval[2])) sprintf(str, "Warp: %s", c); - circumfac = circumfac / 180 * M_PI; + circumfac = DEG2RADF(circumfac); } else { /* default header print */ - sprintf(str, "Warp: %.3f", circumfac * 180 / M_PI); + sprintf(str, "Warp: %.3f", RAD2DEGF(circumfac)); } t->values[0] = circumfac; @@ -3180,16 +3180,16 @@ int Rotation(TransInfo *t, short UNUSED(mval[2])) sprintf(str, "Rot: %s %s %s", &c[0], t->con.text, t->proptext); /* Clamp between -180 and 180 */ - while (final >= 180.0) - final -= 360.0; + while (final >= 180.0f) + final -= 360.0f; - while (final <= -180.0) - final += 360.0; - - final *= (float)(M_PI / 180.0); + while (final <= -180.0f) + final += 360.0f; + + final = DEG2RADF(final); } else { - sprintf(str, "Rot: %.2f%s %s", 180.0*final/M_PI, t->con.text, t->proptext); + sprintf(str, "Rot: %.2f%s %s", RAD2DEGF(final), t->con.text, t->proptext); } if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) @@ -3289,11 +3289,11 @@ int Trackball(TransInfo *t, short UNUSED(mval[2])) sprintf(str, "Trackball: %s %s %s", &c[0], &c[20], t->proptext); - phi[0] *= (float)(M_PI / 180.0); - phi[1] *= (float)(M_PI / 180.0); + phi[0] = DEG2RADF(phi[0]); + phi[1] = DEG2RADF(phi[1]); } else { - sprintf(str, "Trackball: %.2f %.2f %s", 180.0*phi[0]/M_PI, 180.0*phi[1]/M_PI, t->proptext); + sprintf(str, "Trackball: %.2f %.2f %s", RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext); } vec_rot_to_mat3( smat,axis1, phi[0]); @@ -3382,7 +3382,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) { if(!(t->flag & T_2D_EDIT) && t->scene->unit.system) 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, 0); - else if( dist > 1e10 || dist < -1e10 ) /* prevent string buffer overflow */ + else if( dist > 1e10f || dist < -1e10f ) /* prevent string buffer overflow */ sprintf(distvec, "%.4e", dist); else sprintf(distvec, "%.4f", dist); @@ -3648,10 +3648,10 @@ int Tilt(TransInfo *t, short UNUSED(mval[2])) sprintf(str, "Tilt: %s %s", &c[0], t->proptext); - final *= (float)(M_PI / 180.0); + final = DEG2RADF(final); } else { - sprintf(str, "Tilt: %.2f %s", 180.0*final/M_PI, t->proptext); + sprintf(str, "Tilt: %.2f %s", RAD2DEGF(final), t->proptext); } for(i = 0 ; i < t->total; i++, td++) { @@ -4639,7 +4639,7 @@ static int createSlideVerts(TransInfo *t) } add_v3_v3(start, end); - mul_v3_fl(start, 0.5*(1.0/totvec)); + mul_v3_fl(start, 0.5f*(1.0f/totvec)); VECCOPY(vec, start); start[0] = t->mval[0]; start[1] = t->mval[1]; @@ -4923,8 +4923,8 @@ int doEdgeSlide(TransInfo *t, float perc) tempsv = BLI_ghash_lookup(vertgh,ev); edgelen = len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co); newlen = (edgelen != 0.0f)? (len / edgelen): 0.0f; - if(newlen > 1.0) {newlen = 1.0;} - if(newlen < 0.0) {newlen = 0.0;} + if(newlen > 1.0f) {newlen = 1.0;} + if(newlen < 0.0f) {newlen = 0.0;} if(flip == 0) { interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen)); if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) { @@ -5047,10 +5047,10 @@ int BoneRoll(TransInfo *t, short UNUSED(mval[2])) sprintf(str, "Roll: %s", &c[0]); - final *= (float)(M_PI / 180.0); + final = DEG2RADF(final); } else { - sprintf(str, "Roll: %.2f", 180.0*final/M_PI); + sprintf(str, "Roll: %.2f", RAD2DEGF(final)); } /* set roll values */ @@ -5358,8 +5358,8 @@ int SeqSlide(TransInfo *t, short UNUSED(mval[2])) applyNumInput(&t->num, t->values); } - t->values[0] = floor(t->values[0] + 0.5); - t->values[1] = floor(t->values[1] + 0.5); + t->values[0] = floor(t->values[0] + 0.5f); + t->values[1] = floor(t->values[1] + 0.5f); headerSeqSlide(t, t->values, str); applySeqSlide(t, t->values); @@ -5781,7 +5781,7 @@ int TimeSlide(TransInfo *t, short mval[2]) /* handle numeric-input stuff */ t->vec[0] = 2.0f*(cval[0]-sval[0]) / (maxx-minx); applyNumInput(&t->num, &t->vec[0]); - t->values[0] = (maxx-minx) * t->vec[0] / 2.0 + sval[0]; + t->values[0] = (maxx-minx) * t->vec[0] / 2.0f + sval[0]; headerTimeSlide(t, sval[0], str); applyTimeSlide(t, sval[0]); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 1e6fae7609e..0012334cf92 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -191,11 +191,11 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3 if(in[0]==0.0f && in[1]==0.0f && in[2]==0.0f) return; - angle = fabs(angle_v3v3(axis, t->viewinv[2])); - if (angle > M_PI / 2) { - angle = M_PI - angle; + angle = fabsf(angle_v3v3(axis, t->viewinv[2])); + if (angle > (float)M_PI / 2.0f) { + angle = (float)M_PI - angle; } - angle = 180.0f * angle / M_PI; + angle = RAD2DEGF(angle); /* For when view is parallel to constraint... will cause NaNs otherwise So we take vertical motion in 3D space and apply it to the @@ -228,12 +228,12 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3 /* give arbitrary large value if projection is impossible */ factor = dot_v3v3(axis, norm); - if (1 - fabs(factor) < 0.0002f) { + if (1.0f - fabsf(factor) < 0.0002f) { VECCOPY(out, axis); if (factor > 0) { - mul_v3_fl(out, 1000000000); + mul_v3_fl(out, 1000000000.0f); } else { - mul_v3_fl(out, -1000000000); + mul_v3_fl(out, -1000000000.0f); } } else { add_v3_v3v3(v2, t->con.center, axis); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 05bf96461a8..99214fe4780 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -356,7 +356,7 @@ static bKinematicConstraint *has_targetless_ik(bPoseChannel *pchan) bConstraint *con= pchan->constraints.first; for(;con; con= con->next) { - if(con->type==CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0)) { + if(con->type==CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) { bKinematicConstraint *data= con->data; if(data->tar==NULL) @@ -757,7 +757,7 @@ static void pchan_autoik_adjust (bPoseChannel *pchan, short chainlen) /* check if pchan has ik-constraint */ for (con= pchan->constraints.first; con; con= con->next) { - if (con->type == CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0)) { + if (con->type == CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) { bKinematicConstraint *data= con->data; /* only accept if a temporary one (for auto-ik) */ @@ -2802,7 +2802,7 @@ static void posttrans_fcurve_clean (FCurve *fcu) if (BEZSELECTED(bezt) == 0) { /* check beztriple should be removed according to cache */ for (index= 0; index < len; index++) { - if (IS_EQ(bezt->vec[1][0], selcache[index])) { + if (IS_EQF(bezt->vec[1][0], selcache[index])) { delete_fcurve_key(fcu, i, 0); break; } @@ -2975,7 +2975,7 @@ void flushTransGPactionData (TransInfo *t) /* flush data! */ for (i = 0; i < t->total; i++, tfd++) { - *(tfd->sdata)= (int)floor(tfd->val + 0.5); + *(tfd->sdata)= (int)floor(tfd->val + 0.5f); } } @@ -3358,8 +3358,8 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) mul_v3_fl(mtx[1], yscale); /* smtx is global (i.e. view) to data conversion */ - if (IS_EQ(xscale, 0.0f) == 0) mul_v3_fl(smtx[0], 1.0f/xscale); - if (IS_EQ(yscale, 0.0f) == 0) mul_v3_fl(smtx[1], 1.0f/yscale); + if (IS_EQF(xscale, 0.0f) == 0) mul_v3_fl(smtx[0], 1.0f/xscale); + if (IS_EQF(yscale, 0.0f) == 0) mul_v3_fl(smtx[1], 1.0f/yscale); } /* loop 2: build transdata arrays */ @@ -4137,7 +4137,7 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list) if (list) { for (con= list->first; con; con=con->next) { /* only consider constraint if it is enabled, and has influence on result */ - if ((con->flag & CONSTRAINT_DISABLE)==0 && (con->enforce!=0.0)) { + if ((con->flag & CONSTRAINT_DISABLE)==0 && (con->enforce!=0.0f)) { /* (affirmative) returns for specific constraints here... */ /* constraints that require this regardless */ if (con->type == CONSTRAINT_TYPE_CHILDOF) return 1; diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index e8d82fb211c..45ed983fce5 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -274,7 +274,7 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], floa mi->imval[1] = mval[1]; } - *angle += dphi; + *angle += (double)dphi; output[0] = *angle; } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index fcbe4171a08..da1a1b91654 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -560,29 +560,29 @@ static void test_manipulator_axis(const bContext *C) viewvector(rv3d, rv3d->twmat[3], vec); angle = fabs(angle_v3v3(rv3d->twmat[0], vec)); - if (angle > M_PI / 2) { - angle = M_PI - angle; + if (angle > (float)M_PI / 2.0f) { + angle = (float)M_PI - angle; } - angle = rv3d->twangle[0] = 180.0f * angle / M_PI; - if (angle < 5) { + angle = rv3d->twangle[0] = RAD2DEGF(angle); + if (angle < 5.0f) { rv3d->twdrawflag &= ~(MAN_TRANS_X|MAN_SCALE_X); } angle = fabs(angle_v3v3(rv3d->twmat[1], vec)); - if (angle > M_PI / 2) { - angle = M_PI - angle; + if (angle > (float)M_PI / 2.0f) { + angle = (float)M_PI - angle; } - angle = rv3d->twangle[1] = 180.0f * angle / M_PI; - if (angle < 5) { + angle = rv3d->twangle[1] = RAD2DEGF(angle); + if (angle < 5.0f) { rv3d->twdrawflag &= ~(MAN_TRANS_Y|MAN_SCALE_Y); } angle = fabs(angle_v3v3(rv3d->twmat[2], vec)); - if (angle > M_PI / 2) { - angle = M_PI - angle; + if (angle > (float)M_PI / 2.0f) { + angle = (float)M_PI - angle; } - angle = rv3d->twangle[2] = 180.0f * angle / M_PI; - if (angle < 5) { + angle = rv3d->twangle[2] = RAD2DEGF(angle); + if (angle < 5.0f) { rv3d->twdrawflag &= ~(MAN_TRANS_Z|MAN_SCALE_Z); } } @@ -832,7 +832,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, if(arcs) { /* clipplane makes nice handles, calc here because of multmatrix but with translate! */ VECCOPY(plane, rv3d->viewinv[2]); - plane[3]= -0.02*size; // clip just a bit more + plane[3]= -0.02f*size; // clip just a bit more glClipPlane(GL_CLIP_PLANE0, plane); } /* sets view screen aligned */ diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 44de86c1e30..022e09b3da4 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -645,7 +645,7 @@ float RotationBetween(TransInfo *t, float p1[3], float p2[3]) cross_v3_v3v3(tmp, start, end); - if (dot_v3v3(tmp, axis) < 0.0) + if (dot_v3v3(tmp, axis) < 0.0f) angle = -acos(dot_v3v3(start, end)); else angle = acos(dot_v3v3(start, end)); @@ -661,11 +661,11 @@ float RotationBetween(TransInfo *t, float p1[3], float p2[3]) angle = atan2(start[1],start[0]) - atan2(end[1],end[0]); } - if (angle > M_PI) { - angle = angle - 2 * M_PI; + if (angle > (float)M_PI) { + angle = angle - 2 * (float)M_PI; } - else if (angle < -(M_PI)) { - angle = 2 * M_PI + angle; + else if (angle < -((float)M_PI)) { + angle = 2.0f * (float)M_PI + angle; } return angle; @@ -1134,7 +1134,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh * this takes care of series of connected edges a bit slanted w.r.t the viewport * otherwise, it would stick to the verts of the closest edge and not slide along merrily * */ - if (new_dist <= *dist && new_depth < *depth * 1.001) + if (new_dist <= *dist && new_depth < *depth * 1.001f) { float n1[3], n2[3]; @@ -1670,7 +1670,7 @@ static void removeDoublesPeel(ListBase *depth_peels) { DepthPeel *next_peel = peel->next; - if (peel && next_peel && ABS(peel->depth - next_peel->depth) < 0.0015) + if (peel && next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f) { peel->next = next_peel->next; @@ -1939,7 +1939,7 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea float asp[3] = {1.0f, 1.0f, 1.0f}; // TODO: Remove hard coded limit here (3) // Early bailing out if no need to snap - if (fac[action] == 0.0) + if (fac[action] == 0.0f) return; /* evil hack - snapping needs to be adapted for image aspect ratio */ @@ -1948,6 +1948,6 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea } for (i=0; i<=max_index; i++) { - val[i]= fac[action]*asp[i]*(float)floor(val[i]/(fac[action]*asp[i]) +.5); + val[i]= fac[action]*asp[i]*(float)floor(val[i]/(fac[action]*asp[i]) +0.5f); } } |