[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45044] trunk/blender/source/blender/ editors/object/object_transform.c: patch [#30602] Wiki Quick Hack: Apply Transformation To Lattices

Campbell Barton ideasman42 at gmail.com
Wed Mar 21 00:09:29 CET 2012


Revision: 45044
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45044
Author:   campbellbarton
Date:     2012-03-20 23:09:28 +0000 (Tue, 20 Mar 2012)
Log Message:
-----------
patch [#30602] Wiki Quick Hack: Apply Transformation To Lattices
from Justin Dailey (dail) 

Modified Paths:
--------------
    trunk/blender/source/blender/editors/object/object_transform.c

Modified: trunk/blender/source/blender/editors/object/object_transform.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_transform.c	2012-03-20 22:56:26 UTC (rev 45043)
+++ trunk/blender/source/blender/editors/object/object_transform.c	2012-03-20 23:09:28 UTC (rev 45044)
@@ -40,6 +40,7 @@
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_group_types.h"
+#include "DNA_lattice_types.h"
 
 #include "BLI_math.h"
 #include "BLI_listbase.h"
@@ -398,6 +399,12 @@
 				return OPERATOR_CANCELLED;
 			}
 		}
+		else if (ob->type == OB_LATTICE) {
+			if(ID_REAL_USERS(ob->data) > 1) {
+				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user lattice, doing nothing");
+				return OPERATOR_CANCELLED;
+			}
+		}
 		else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
 			Curve *cu;
 
@@ -487,6 +494,16 @@
 		else if (ob->type==OB_ARMATURE) {
 			ED_armature_apply_transform(ob, mat);
 		}
+		else if (ob->type == OB_LATTICE) {
+			Lattice *lt = ob->data;
+			BPoint *bp = lt->def;
+			int a = lt->pntsu * lt->pntsv * lt->pntsw;
+			
+			while (a--) {
+				mul_m4_v3(mat, bp->vec);
+				bp++;
+			}
+		}
 		else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
 			Curve *cu= ob->data;
 




More information about the Bf-blender-cvs mailing list