diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2016-04-18 18:48:22 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2016-05-06 11:40:19 +0300 |
commit | 2a9ddc808de117786c354a2a6b72c68437d18808 (patch) | |
tree | ae12548cd93d8dc6657dbb631c101971034ff1ac /source/blender/blenkernel | |
parent | fcfbe27826bf900e8ecc10927b6415edfc316e78 (diff) |
Cloth: Change ClothVertex::xrest to actually store the rest position.
Originally the value was only needed when building the springs,
so a pointer to the input data was somewhat ok. However, recalculating
spring length dynamically requires keeping the actual value around.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_cloth.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index 28de270bbd1..50fcbd8e139 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -115,7 +115,7 @@ typedef struct ClothVertex { float mass; /* mass / weight of the vertex */ float goal; /* goal, from SB */ float impulse[3]; /* used in collision.c */ - float *xrest; /* temporary valid for building springs */ + float xrest[3]; /* rest position of the vertex */ unsigned int impulse_count; /* same as above */ float avg_spring_len; /* average length of connected springs */ float struct_stiff; diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index a133f379c7f..0954ac945b8 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -819,11 +819,11 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d mul_m4_v3(ob->obmat, verts->x); if ( shapekey_rest ) { - verts->xrest= shapekey_rest[i]; + copy_v3_v3(verts->xrest, shapekey_rest[i]); mul_m4_v3(ob->obmat, verts->xrest); } else - verts->xrest = verts->x; + copy_v3_v3(verts->xrest, verts->x); } /* no GUI interface yet */ |