diff options
Diffstat (limited to 'source/blender/editors/transform/transform_constraints.c')
-rw-r--r-- | source/blender/editors/transform/transform_constraints.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 017501bd78e..18e9c1a47b8 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -183,21 +183,21 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3]) { - if(t->spacetype == SPACE_VIEW3D) { + if (t->spacetype == SPACE_VIEW3D) { // View3D *v3d = t->sa->spacedata.first; const float min_dist= 1.0f; // v3d->near; float dir[3]; float l; sub_v3_v3v3(dir, t_con_center, t->viewinv[3]); - if(dot_v3v3(dir, t->viewinv[2]) < 0.0f) { + if (dot_v3v3(dir, t->viewinv[2]) < 0.0f) { negate_v3(dir); } project_v3_v3v3(dir, dir, t->viewinv[2]); l= len_v3(dir); - if(l < min_dist) { + if (l < min_dist) { float diff[3]; normalize_v3_v3(diff, t->viewinv[2]); mul_v3_fl(diff, min_dist - l); @@ -212,7 +212,7 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3 float norm[3], vec[3], factor, angle; float t_con_center[3]; - if(in[0]==0.0f && in[1]==0.0f && in[2]==0.0f) + if (in[0]==0.0f && in[1]==0.0f && in[2]==0.0f) return; copy_v3_v3(t_con_center, t->con.center); @@ -229,11 +229,11 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3 /* For when view is parallel to constraint... will cause NaNs otherwise * So we take vertical motion in 3D space and apply it to the * constraint axis. Nice for camera grab + MMB */ - if(angle < 5.0f) { + if (angle < 5.0f) { project_v3_v3v3(vec, in, t->viewinv[1]); factor = dot_v3v3(t->viewinv[1], vec) * 2.0f; /* since camera distance is quite relative, use quadratic relationship. holding shift can compensate */ - if(factor<0.0f) factor*= -factor; + if (factor<0.0f) factor*= -factor; else factor*= factor; copy_v3_v3(out, axis); @@ -261,10 +261,12 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3 copy_v3_v3(out, axis); if (factor > 0) { mul_v3_fl(out, 1000000000.0f); - } else { + } + else { mul_v3_fl(out, -1000000000.0f); } - } else { + } + else { add_v3_v3v3(v2, t_con_center, axis); add_v3_v3v3(v4, v, norm); @@ -276,9 +278,9 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3 /* possible some values become nan when * viewpoint and object are both zero */ - if(!finite(out[0])) out[0]= 0.0f; - if(!finite(out[1])) out[1]= 0.0f; - if(!finite(out[2])) out[2]= 0.0f; + if (!finite(out[0])) out[0]= 0.0f; + if (!finite(out[1])) out[1]= 0.0f; + if (!finite(out[2])) out[2]= 0.0f; } } } @@ -654,7 +656,7 @@ void drawConstraint(TransInfo *t) /* nasty exception for Z constraint in camera view */ // TRANSFORM_FIX_ME -// if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB) +// if ((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB) // return; if (tc->drawExtra) { @@ -676,7 +678,7 @@ void drawConstraint(TransInfo *t) glColor3ubv((GLubyte *)col2); depth_test_enabled = glIsEnabled(GL_DEPTH_TEST); - if(depth_test_enabled) + if (depth_test_enabled) glDisable(GL_DEPTH_TEST); setlinestyle(1); @@ -686,7 +688,7 @@ void drawConstraint(TransInfo *t) glEnd(); setlinestyle(0); - if(depth_test_enabled) + if (depth_test_enabled) glEnable(GL_DEPTH_TEST); } @@ -712,7 +714,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) UI_ThemeColor(TH_GRID); - if(t->spacetype == SPACE_VIEW3D && rv3d != NULL) { + if (t->spacetype == SPACE_VIEW3D && rv3d != NULL) { copy_m4_m4(tmat, rv3d->viewmat); invert_m4_m4(imat, tmat); } @@ -725,10 +727,10 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) copy_v3_v3(center, t->center); - if((t->spacetype == SPACE_VIEW3D) && t->obedit) { + if ((t->spacetype == SPACE_VIEW3D) && t->obedit) { mul_m4_v3(t->obedit->obmat, center); /* because t->center is in local space */ } - else if(t->spacetype == SPACE_IMAGE) { + else if (t->spacetype == SPACE_IMAGE) { float aspx, aspy; ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy); @@ -766,7 +768,7 @@ static void drawObjectConstraint(TransInfo *t) td++; - for(i=1;i<t->total;i++,td++) { + for (i=1;i<t->total;i++,td++) { if (t->con.mode & CON_AXIS0) { drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', 0); } |