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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-05-27 17:33:09 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-05-27 17:33:09 +0400
commita1091fbfa6b37d192c90866c7115a789d15de37b (patch)
tree88e8c38e69364e7d2e5677b86e63b1c82d5ccf7b /source/blender/blenkernel/intern/softbody.c
parent1e450423967fcd76cd25f8e8d0c0e3ec25b433f4 (diff)
Fix #26876: Soft Body ignores Goal on Lattice
Patch by Arno Mayrhofer (aka azrael3000) with only slight code style modifications, thanks!
Diffstat (limited to 'source/blender/blenkernel/intern/softbody.c')
-rw-r--r--source/blender/blenkernel/intern/softbody.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 5abc4bc3830..63f0a29821f 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -3514,7 +3514,9 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
{
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,18 +3533,17 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
/* 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;
+ }
}
}