[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47075] trunk/blender/source/blender/ blenkernel/intern/softbody.c: Fix #26876: Soft Body ignores Goal on Lattice

Sergey Sharybin sergey.vfx at gmail.com
Sun May 27 15:33:09 CEST 2012


Revision: 47075
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47075
Author:   nazgul
Date:     2012-05-27 13:33:09 +0000 (Sun, 27 May 2012)
Log Message:
-----------
Fix #26876: Soft Body ignores Goal on Lattice

Patch by Arno Mayrhofer (aka azrael3000) with only slight code style modifications, thanks!

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

Modified: trunk/blender/source/blender/blenkernel/intern/softbody.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/softbody.c	2012-05-27 13:22:43 UTC (rev 47074)
+++ trunk/blender/source/blender/blenkernel/intern/softbody.c	2012-05-27 13:33:09 UTC (rev 47075)
@@ -3514,7 +3514,9 @@
 {
 	Lattice *lt= ob->data;
 	SoftBody *sb;
-	int totvert, totspring = 0;
+	int totvert, totspring = 0, a;
+	BodyPoint *bp;
+	BPoint *bpnt = lt->def;
 
 	totvert= lt->pntsu*lt->pntsv*lt->pntsw;
 
@@ -3531,19 +3533,18 @@
 	/* renew ends with ob->soft with points and edges, also checks & makes ob->soft */
 	renew_softbody(scene, ob, totvert, totspring);
 	sb= ob->soft;	/* can be created in renew_softbody() */
+	bp = sb->bpoint;
 
-	/* weights from bpoints, same code used as for mesh vertices */
-	/* if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { 2.4x one*/
-	/* new! take the weights from lattice vertex anyhow */
-	if (ob->softflag & OB_SB_GOAL) {
-		BodyPoint *bp= sb->bpoint;
-		BPoint *bpnt= lt->def;
-		/* jow_go_for2_5 */
-		int a;
-
-		for (a=0; a<totvert; a++, bp++, bpnt++) {
-			bp->goal= bpnt->weight;
+	/* same code used as for mesh vertices */
+	for (a = 0; a < totvert; a++, bp++, bpnt++) {
+		if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) {
+			get_scalar_from_vertexgroup(ob, a, (short) (sb->vertgroup - 1), &bp->goal);
 		}
+		else {
+			if (ob->softflag & OB_SB_GOAL) {
+				bp->goal = sb->defgoal;
+			}
+		}
 	}
 
 	/* create some helper edges to enable SB lattice to be useful at all */




More information about the Bf-blender-cvs mailing list