[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34667] trunk/blender/source/blender: bugfix [#25824] Quats + Camera + Fly = Madness

Campbell Barton ideasman42 at gmail.com
Sun Feb 6 10:01:01 CET 2011


Revision: 34667
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34667
Author:   campbellbarton
Date:     2011-02-06 09:01:01 +0000 (Sun, 06 Feb 2011)
Log Message:
-----------
bugfix [#25824] Quats + Camera + Fly = Madness
ensure quat, delta rotation is set to a unit quaternion on older files.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_math_vector.h
    trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_vector.h	2011-02-06 06:59:11 UTC (rev 34666)
+++ trunk/blender/source/blender/blenlib/BLI_math_vector.h	2011-02-06 09:01:01 UTC (rev 34667)
@@ -123,6 +123,7 @@
 /********************************* Comparison ********************************/
 
 MINLINE int is_zero_v3(const float a[3]);
+MINLINE int is_zero_v4(const float a[4]);
 MINLINE int is_one_v3(const float a[3]);
 
 MINLINE int equals_v2v2(const float *v1, const float *v2);

Modified: trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_vector_inline.c	2011-02-06 06:59:11 UTC (rev 34666)
+++ trunk/blender/source/blender/blenlib/intern/math_vector_inline.c	2011-02-06 09:01:01 UTC (rev 34667)
@@ -427,11 +427,16 @@
 
 /********************************* Comparison ********************************/
 
-MINLINE int is_zero_v3(const float *v)
+MINLINE int is_zero_v3(const float v[3])
 {
 	return (v[0] == 0 && v[1] == 0 && v[2] == 0);
 }
 
+MINLINE int is_zero_v4(const float v[4])
+{
+	return (v[0] == 0 && v[1] == 0 && v[2] == 0 && v[3] == 0);
+}
+
 MINLINE int is_one_v3(const float *v)
 {
 	return (v[0] == 1 && v[1] == 1 && v[2] == 1);

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2011-02-06 06:59:11 UTC (rev 34666)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2011-02-06 09:01:01 UTC (rev 34667)
@@ -11323,12 +11323,24 @@
 		/* fix for bones that didn't have arm_roll before */
 		bArmature* arm;
 		Bone* bone;
+		Object *ob;
 
 		for (arm = main->armature.first; arm; arm = arm->id.next)
 			for (bone = arm->bonebase.first; bone; bone = bone->next)
 				do_version_bone_roll_256(bone);
+
+		/* fix for objects which have zero dquat's
+		 * since this is multiplied with the quat rather then added */
+		for(ob= main->object.first; ob; ob= ob->id.next) {
+			if(is_zero_v4(ob->dquat)) {
+				unit_qt(ob->dquat);
+			}
+			if(is_zero_v3(ob->drotAxis) && ob->drotAngle == 0.0f) {
+				unit_axis_angle(ob->drotAxis, &ob->drotAngle);
+			}
+		}
 	}
-				
+
 	/* put compatibility code here until next subversion bump */
 	
 	{




More information about the Bf-blender-cvs mailing list