Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-12-07 04:56:32 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-07 04:56:32 +0300
commit48614fbc2af024d613845b03d632e544f8127261 (patch)
tree41442fc6f5fe2b4ccef4f627429f740774abcdf9 /source/blender/blenkernel/intern/object.c
parentfe0f78a66978f52eac94199baffc577cbf7c1123 (diff)
Added an assert() check for normalized quats which exposed a number of bugs where normalized quat was incorrectly assumed.
This would have made bug #25003 very simple to find. - Objects had their quats normalized when calculating their matrix, this is inconstant with pose bones and isn't useful for animation. Also it wasn't normalizing the delta rotation so these would give bad rotations. - Converting between rotation modes BKE_rotMode_change_values() assumed normal length quat. changing quat to euler rotation for eg could change the bone. - Clear rotation and transform were not normalizing the quat when 4d loc was disabled on quat rotation, corrected and also made it so the quat scale is restored after conversion so animations curves dont jump. There is 1 case in mat3_to_quat_is_ok() where quat_to_mat3 on an unnormalized quat is needed, for this I had to add an ugly static function quat_to_mat3_no_assert(), but overall its worthwhile IMHO to be able to find incorrect use of rotation conversion.
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r--source/blender/blenkernel/intern/object.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 5f2a10c0b3e..b98927db877 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1668,9 +1668,13 @@ void object_rot_to_mat3(Object *ob, float mat[][3])
}
else {
/* quats are normalised before use to eliminate scaling issues */
- normalize_qt(ob->quat);
- quat_to_mat3( rmat,ob->quat);
- quat_to_mat3( dmat,ob->dquat);
+ float tquat[4];
+
+ normalize_qt_qt(tquat, ob->quat);
+ quat_to_mat3(rmat, tquat);
+
+ normalize_qt_qt(tquat, ob->quat);
+ quat_to_mat3(dmat, tquat);
}
/* combine these rotations */
@@ -1818,8 +1822,8 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
#else
quat_apply_track(quat, ob->trackflag, ob->upflag);
#endif
-
- quat_to_mat4(mat,quat);
+ normalize_qt(quat);
+ quat_to_mat4(mat, quat);
}
if(cu->flag & CU_PATH_RADIUS) {