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-10-19 09:36:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-19 09:36:16 +0400
commit0aa2eee3eff83cc4a6160a292219b20ac579481a (patch)
treea72d4c82a8097ba83060c80edc5f1206258dadc3
parent62aacd1aa784834ff7688d25142b88506febb27e (diff)
bugfix with applying the object matrix with negative scales.
--- fixes report by ronan ducluzeau Scale default cube on X axis to -1. Rotate it on X axis to 33°. Parent cube to lamp. Clear parent and keep offset. Cube's scaling value on X axis pass from -1 to 1 Cube's rotation value on Z axis pass from 0° to 180°
-rw-r--r--source/blender/blenkernel/intern/object.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index b91a66fd69f..142e41918dd 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1704,12 +1704,18 @@ void object_apply_mat4(Object *ob, float mat[][4])
/* location */
copy_v3_v3(ob->loc, mat[3]);
-
- /* rotation */
+
+ /* rotation & scale are linked, we need to create the mat's
+ * for these together since they are related. */
copy_m3_m4(mat3, mat);
/* so scale doesnt interfear with rotation [#24291] */
normalize_m3_m3(mat3_n, (const float(*)[3])mat3);
+ if(mat3_n[0][0] < 0.0f) negate_v3(mat3_n[0]);
+ if(mat3_n[1][1] < 0.0f) negate_v3(mat3_n[1]);
+ if(mat3_n[2][2] < 0.0f) negate_v3(mat3_n[2]);
+
+ /* rotation */
object_mat3_to_rot(ob, mat3_n, 0);
/* scale */