[Bf-blender-cvs] [6559ab2] master: 3D View roll & orbit were scaling view-quat length

Campbell Barton noreply at git.blender.org
Wed Dec 28 07:47:46 CET 2016


Commit: 6559ab2d511b1c0c1845342133505139166da4b3
Author: Campbell Barton
Date:   Wed Dec 28 17:44:36 2016 +1100
Branches: master
https://developer.blender.org/rB6559ab2d511b1c0c1845342133505139166da4b3

3D View roll & orbit were scaling view-quat length

Over time roll and orbit would scale the quaternion
which is documented as unit length.

In practice any errors would be subtle,
but better normalize as other operators do.

===================================================================

M	source/blender/editors/space_view3d/view3d_edit.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 620bbf0..2b53eb7 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -4064,6 +4064,9 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
 
 			mul_qt_qtqt(quat_new, rv3d->viewquat, quat_mul);
 
+			/* avoid precision loss over time */
+			normalize_qt(quat_new);
+
 			if (view_opposite != RV3D_VIEW_USER) {
 				rv3d->view = view_opposite;
 				/* avoid float in-precision, just get a new orientation */
@@ -4130,6 +4133,10 @@ static void view_roll_angle(ARegion *ar, float quat[4], const float orig_quat[4]
 	axis_angle_normalized_to_quat(quat_mul, dvec, angle);
 
 	mul_qt_qtqt(quat, orig_quat, quat_mul);
+
+	/* avoid precision loss over time */
+	normalize_qt(quat);
+
 	rv3d->view = RV3D_VIEW_USER;
 }




More information about the Bf-blender-cvs mailing list