diff options
author | over0219 <over0219@umn.edu> | 2020-06-22 22:26:23 +0300 |
---|---|---|
committer | over0219 <over0219@umn.edu> | 2020-06-22 22:26:23 +0300 |
commit | c214acce20b6066dd8b0f70dfa16a597059358a6 (patch) | |
tree | 34a48d8e1ad91a9be0b80e0b80f2c263528ac4c3 /intern | |
parent | 688643c9fdf19802fe7c3bb4e6b53754fa9e7cca (diff) |
fixed issue with rand causing mem error
Diffstat (limited to 'intern')
-rw-r--r-- | intern/softbody/admmpd_api.cpp | 8 | ||||
-rw-r--r-- | intern/softbody/admmpd_api.h | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/intern/softbody/admmpd_api.cpp b/intern/softbody/admmpd_api.cpp index 1895b973fef..cdcede4ca72 100644 --- a/intern/softbody/admmpd_api.cpp +++ b/intern/softbody/admmpd_api.cpp @@ -47,9 +47,7 @@ void admmpd_dealloc(ADMMPDInterfaceData *iface) if (iface==NULL) return; - iface->totverts = 0; - iface->mesh_totverts = 0; - iface->mesh_totfaces = 0; + iface->totverts = 0; // output vertices if (iface->data) { @@ -144,7 +142,6 @@ static int admmpd_init_with_lattice( int admmpd_init(ADMMPDInterfaceData *iface, float *in_verts, unsigned int *in_faces) { - if (iface==NULL) return 0; if (in_verts==NULL || in_faces==NULL) @@ -152,6 +149,9 @@ int admmpd_init(ADMMPDInterfaceData *iface, float *in_verts, unsigned int *in_fa if (iface->mesh_totverts<=0 || iface->mesh_totfaces<=0) return 0; + // Delete any existing data + admmpd_dealloc(iface); + // Generate solver data iface->data = new ADMMPDInternalData(); iface->data->options = new admmpd::Options(); diff --git a/intern/softbody/admmpd_api.h b/intern/softbody/admmpd_api.h index b90a89360bd..e08e527b0e1 100644 --- a/intern/softbody/admmpd_api.h +++ b/intern/softbody/admmpd_api.h @@ -57,7 +57,10 @@ void admmpd_copy_from_bodypoint(ADMMPDInterfaceData*, const BodyPoint *pts); // Copies internal vertex position and velocity data // to BodyPoints (from SoftBody) AND surface mesh vertices. // If pts or vertexCos is null, its skipped -void admmpd_copy_to_bodypoint_and_object(ADMMPDInterfaceData*, BodyPoint *pts, float (*vertexCos)[3]); +void admmpd_copy_to_bodypoint_and_object( + ADMMPDInterfaceData*, + BodyPoint *pts, + float (*vertexCos)[3]); // Copies out_verts and out_verts to internal data // Performs solve over the time step |