[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43777] trunk/blender/source/blender/ blenkernel/intern/constraint.c: Fix #30019: Copy rotation from a vertex group

Sergey Sharybin sergey.vfx at gmail.com
Mon Jan 30 20:46:21 CET 2012


Revision: 43777
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43777
Author:   nazgul
Date:     2012-01-30 19:46:15 +0000 (Mon, 30 Jan 2012)
Log Message:
-----------
Fix #30019: Copy rotation from a vertex group

It was incorrect behavior of contarget_get_mesh_mat in cases when
object's Y axis is co-linear to average vertex group normal.
Use object's X axis for plane definition in such cases.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/constraint.c

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c	2012-01-30 19:02:10 UTC (rev 43776)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c	2012-01-30 19:46:15 UTC (rev 43777)
@@ -504,14 +504,18 @@
 			normalize_v3(normal);
 			copy_v3_v3(plane, tmat[1]);
 			
-			copy_v3_v3(tmat[2], normal);
-			cross_v3_v3v3(tmat[0], normal, plane);
-			cross_v3_v3v3(tmat[1], tmat[2], tmat[0]);
-			
-			copy_m4_m3(mat, tmat);
+			cross_v3_v3v3(mat[0], normal, plane);
+			if(len_v3(mat[0]) < 1e-3) {
+				copy_v3_v3(plane, tmat[0]);
+				cross_v3_v3v3(mat[0], normal, plane);
+			}
+
+			copy_v3_v3(mat[2], normal);
+			cross_v3_v3v3(mat[1], mat[2], mat[0]);
+
 			normalize_m4(mat);
+
 			
-			
 			/* apply the average coordinate as the new location */
 			mul_v3_m4v3(mat[3], ob->obmat, vec);
 		}



More information about the Bf-blender-cvs mailing list