[Bf-blender-cvs] [4956a53c452] soc-2020-soft-body: added vertex groups for self collision

mattoverby noreply at git.blender.org
Wed Aug 12 20:54:17 CEST 2020


Commit: 4956a53c452bfba04d9795243a8642f224cb022a
Author: mattoverby
Date:   Wed Aug 12 13:54:12 2020 -0500
Branches: soc-2020-soft-body
https://developer.blender.org/rB4956a53c452bfba04d9795243a8642f224cb022a

added vertex groups for self collision

===================================================================

M	intern/softbody/admmpd_api.cpp
M	source/blender/blenkernel/intern/softbody.c

===================================================================

diff --git a/intern/softbody/admmpd_api.cpp b/intern/softbody/admmpd_api.cpp
index 63a884d5828..684b3efdbda 100644
--- a/intern/softbody/admmpd_api.cpp
+++ b/intern/softbody/admmpd_api.cpp
@@ -581,7 +581,7 @@ static inline void admmpd_update_goals(ADMMPDInterfaceData *iface, Object *ob, f
   for (int i=0; i<nv; i++) {
     double k = 0.1;
     if ((ob->softflag & OB_SB_GOAL) && (defgroup_index != -1)) {
-      MDeformWeight *dw = BKE_defvert_find_index(me->dvert, defgroup_index);
+      MDeformWeight *dw = BKE_defvert_find_index(&(me->dvert[i]), defgroup_index);
       k = dw ? dw->weight : 0.0f;
     }
 
@@ -631,12 +631,11 @@ static inline void update_selfcollision_group(ADMMPDInterfaceData *iface, Object
   // Otherwise, we need to set which vertices are to be tested.
   int nv = me->totvert;
   for (int i=0; i<nv; i++) {
-    MDeformWeight *dw = BKE_defvert_find_index(me->dvert, defgroup_idx_selfcollide);
+    MDeformWeight *dw = BKE_defvert_find_index(&(me->dvert[i]), defgroup_idx_selfcollide);
     float wi = dw ? dw->weight : 0.0f;
-    //printf("idx %d, w %f\n", i, wi);
-    //if (wi > 1e-2f) { // I guess we can use the weight as a threshold...
-    //  iface->idata->data->col.selfcollision_verts.emplace(i);
-    //}
+    if (wi > 1e-2f) { // I guess we can use the weight as a threshold...
+      iface->idata->data->col.selfcollision_verts.emplace(i);
+    }
   }
 }
 
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 76afbe03835..5a34196cad6 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -3647,8 +3647,9 @@ void sbCustomRead(struct Object *ob)
     return;
   }
 
+  // ADMM-PD data is not currently written to file.
+  // Instead, we'll create new data when a .blend file is loaded.
   sb->admmpd = MEM_callocN(sizeof(ADMMPDInterfaceData), "SoftBody_admmpd");
-  sb->admmpd->idata = NULL;
 }
 
 /* simulates one step. framenr is in frames */



More information about the Bf-blender-cvs mailing list