diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-26 12:02:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-26 12:02:52 +0300 |
commit | 9352c9f0c14aff78ad7c9eba980528bcb1be1575 (patch) | |
tree | aee48e0e5fb34b2b5de31d2c1e327ad383d39ef6 /source/blender/editors | |
parent | 2cf6141e7ca40daeaae845246ffa22258eefc579 (diff) |
use negate_v3 rather then multiplying a vector by -1.0 (no functional changes)
Diffstat (limited to 'source/blender/editors')
5 files changed, 17 insertions, 22 deletions
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index a9be4b346f0..b3960c3cfd5 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -186,12 +186,12 @@ float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float qrot[4], if (dot_v3v3(new_up_axis, x_axis) < 0) { - mul_v3_fl(x_axis, -1); + negate_v3(x_axis); } if (dot_v3v3(new_up_axis, z_axis) < 0) { - mul_v3_fl(z_axis, -1); + negate_v3(z_axis); } if (angle_normalized_v3v3(x_axis, new_up_axis) < angle_normalized_v3v3(z_axis, new_up_axis)) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index c07d457f164..f09b127bfdd 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -334,8 +334,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) VECCOPY(vod->ofs, rv3d->ofs); /* If there's no selection, lastofs is unmodified and last value since static */ calculateTransformCenter(C, V3D_CENTROID, lastofs); - VECCOPY(vod->dyn_ofs, lastofs); - mul_v3_fl(vod->dyn_ofs, -1.0f); + negate_v3_v3(vod->dyn_ofs, lastofs); } else if (U.uiflag & USER_ORBIT_ZBUF) { diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index cbebbd5cc91..1674c135008 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -161,11 +161,9 @@ static void view_settings_from_ob(Object *ob, float *ofs, float *quat, float *di if (!ob) return; /* Offset */ - if (ofs) { - VECCOPY(ofs, ob->obmat[3]); - mul_v3_fl(ofs, -1.0f); /*flip the vector*/ - } - + if (ofs) + negate_v3_v3(ofs, ob->obmat[3]); + /* Quat */ if (quat) { copy_m4_m4(bmat, ob->obmat); @@ -2053,8 +2051,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even fly->obtfm= object_tfm_backup(ob_back); where_is_object(fly->scene, fly->v3d->camera); - copy_v3_v3(fly->rv3d->ofs, fly->v3d->camera->obmat[3]); - mul_v3_fl(fly->rv3d->ofs, -1.0f); /*flip the vector*/ + negate_v3_v3(fly->rv3d->ofs, fly->v3d->camera->obmat[3]); fly->rv3d->dist=0.0; } else { @@ -2527,6 +2524,8 @@ static int flyApply(FlyInfo *fly) ID *id_key; /* transform the parent or the camera? */ if(fly->root_parent) { + Object *ob_update; + float view_mat[4][4]; float prev_view_imat[4][4]; float diff_mat[4][4]; @@ -2540,10 +2539,10 @@ static int flyApply(FlyInfo *fly) // where_is_object(scene, fly->root_parent); - Object *up= v3d->camera->parent; - while(up) { - DAG_id_flush_update(&up->id, OB_RECALC_OB); - up= up->parent; + ob_update= v3d->camera->parent; + while(ob_update) { + DAG_id_flush_update(&ob_update->id, OB_RECALC_OB); + ob_update= ob_update->parent; } copy_m4_m4(prev_view_mat, view_mat); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 6013ff5f105..f19265679f9 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2718,8 +2718,7 @@ void initRotation(TransInfo *t) if (t->flag & T_2D_EDIT) t->flag |= T_NO_CONSTRAINT; - VECCOPY(t->axis, t->viewinv[2]); - mul_v3_fl(t->axis, -1.0f); + negate_v3_v3(t->axis, t->viewinv[2]); normalize_v3(t->axis); } @@ -2977,8 +2976,7 @@ int Rotation(TransInfo *t, short mval[2]) t->con.applyRot(t, NULL, t->axis, &final); } else { /* reset axis if constraint is not set */ - VECCOPY(t->axis, t->viewinv[2]); - mul_v3_fl(t->axis, -1.0f); + negate_v3_v3(t->axis, t->viewinv[2]); normalize_v3(t->axis); } diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 76df012565e..db7d31bae56 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -818,9 +818,8 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], quat_to_mat4( mat,ml_sel->quat); VECCOPY(normal, mat[2]); - VECCOPY(plane, mat[1]); - mul_v3_fl(plane, -1.0); + negate_v3_v3(plane, mat[1]); result = ORIENTATION_NORMAL; } @@ -888,7 +887,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], add_v3_v3v3(plane, plane, pchan->pose_mat[1]); } } - mul_v3_fl(plane, -1.0); + negate_v3(plane); /* we need the transpose of the inverse for a normal... */ copy_m3_m4(imat, ob->obmat); |