Commit: 13818c47cfb946950c8f3e97209076a9e43db4a7
Author: Luca Rood
Date:   Thu Jul 19 16:02:49 2018 +0200
Branches: cloth-improvements
https://developer.blender.org/rB13818c47cfb946950c8f3e97209076a9e43db4a7

Merge branch 'master' into cloth-improvements

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



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

diff --cc release/datafiles/locale
index c93ed11a47b,d3349b42856..2b3c19f5f61
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit c93ed11a47b3016cf59711ec16de2e2e94c30e99
 -Subproject commit d3349b42856d00c278f72f2a5909a6c96b9cdb5e
++Subproject commit 2b3c19f5f61fc72dba56a7edfdc4e55e2327dc1f
diff --cc release/scripts/addons
index 371960484a3,9ae033c49c1..51e18ead5d6
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit 371960484a38fc64e0a2635170a41a0d8ab2f6bd
 -Subproject commit 9ae033c49c1b16718eac6306bdc271a5e6e6bf38
++Subproject commit 51e18ead5d66e91ad161b971eeacc93e7cd91942
diff --cc release/scripts/addons_contrib
index a8515cfdfe9,f178e6c933a..a52733b58d9
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit a8515cfdfe9a98127b592f36fcbe51b7e23b969a
 -Subproject commit f178e6c933a25c621a5cc7d92935b66cd2ec2f5d
++Subproject commit a52733b58d95ce60ecde95a9eca242e7319c285a
diff --cc source/blender/blenkernel/BKE_cloth.h
index e9f629847fa,6b76ec33c06..fdc06d76706
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@@ -137,24 -132,17 +137,24 @@@ ClothVertex
  typedef struct ClothSpring {
        int     ij;             /* Pij from the paper, one end of the spring.   
*/
        int     kl;             /* Pkl from the paper, one end of the spring.   
*/
 -      int mn;
 -      float   restlen;        /* The original length of the spring.   */
 +      int mn;         /* For hair springs: third vertex index; For bending 
springs: edge index */
 +      int *pa;        /* array of vert indices for poly a (for bending 
springs) */
 +      int *pb;        /* array of vert indices for poly b (for bending 
springs) */
 +      int la;         /* length of *pa */
 +      int lb;         /* length of *pb */
 +      float restlen;  /* The original length of the spring */
 +      float restang;  /* The original angle of the bending springs */
 +      float lenfact;  /* Factor of restlen used for plasticity */
 +      float angoffset;        /* Offset of restang used for plasticity */
        int     type;           /* types defined in BKE_cloth.h ("springType") 
*/
        int     flags;          /* defined in BKE_cloth.h, e.g. deactivated due 
to tearing */
 -      float   stiffness;      /* stiffness factor from the vertex groups */
 -      float editrestlen;
 +      float lin_stiffness;    /* linear stiffness factor from the vertex 
groups */
 +      float ang_stiffness;    /* angular stiffness factor from the vertex 
groups */
 +      float planarity;
-       
+ 
        /* angular bending spring target and derivatives */
        float target[3];
 -}
 -ClothSpring;
 +} ClothSpring;
  
  // some macro enhancements for vector treatment
  #define VECADDADD(v1,v2,v3)   {*(v1)+= *(v2) + *(v3); *(v1+1)+= *(v2+1) + 
*(v3+1); *(v1+2)+= *(v2+2) + *(v3+2);}
diff --cc source/blender/blenkernel/intern/cloth.c
index e98f873fd60,26f998b3cb4..8f460e12bb8
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@@ -513,7 -549,11 +514,7 @@@ void cloth_free_modifier(ClothModifierD
                // we save our faces for collision objects
                if (cloth->tri)
                        MEM_freeN(cloth->tri);
-               
+ 
 -              if (cloth->edgeset)
 -                      BLI_edgeset_free(cloth->edgeset);
 -
 -
                /*
                if (clmd->clothObject->facemarks)
                MEM_freeN(clmd->clothObject->facemarks);
@@@ -719,21 -723,16 +720,21 @@@ static void cloth_apply_vgroup(ClothMod
                                                if ( verts->goal >= 
SOFTGOALSNAP )
                                                        verts->flags |= 
CLOTH_VERT_FLAG_PINNED;
                                        }
-                                       
+ 
 -                                      if (clmd->sim_parms->flags & 
CLOTH_SIMSETTINGS_FLAG_SCALING ) {
 -                                              if ( dvert->dw[j].def_nr == 
(clmd->sim_parms->vgroup_struct-1)) {
 -                                                      verts->struct_stiff = 
dvert->dw [j].weight;
 -                                                      verts->shear_stiff = 
dvert->dw [j].weight;
 -                                              }
 +                                      if ( dvert->dw[j].def_nr == 
(clmd->sim_parms->vgroup_struct-1)) {
 +                                              verts->struct_stiff = dvert->dw 
[j].weight;
 +                                      }
  
 -                                              if ( dvert->dw[j].def_nr == 
(clmd->sim_parms->vgroup_bend-1)) {
 -                                                      verts->bend_stiff = 
dvert->dw [j].weight;
 -                                              }
 +                                      if ( dvert->dw[j].def_nr == 
(clmd->sim_parms->vgroup_shear-1)) {
 +                                              verts->shear_stiff = dvert->dw 
[j].weight;
 +                                      }
 +
 +                                      if ( dvert->dw[j].def_nr == 
(clmd->sim_parms->vgroup_bend-1)) {
 +                                              verts->bend_stiff = dvert->dw 
[j].weight;
 +                                      }
 +
 +                                      if ( dvert->dw[j].def_nr == 
(clmd->sim_parms->vgroup_planar - 1)) {
 +                                              verts->planarity = 
dvert->dw[j].weight;
                                        }
  
                                        if (clmd->coll_parms->flags & 
CLOTH_COLLSETTINGS_FLAG_SELF ) {
@@@ -777,8 -781,10 +778,8 @@@ static int cloth_from_object(Object *ob
        ClothVertex *verts = NULL;
        float (*shapekey_rest)[3] = NULL;
        float tnull[3] = {0, 0, 0};
 -      Cloth *cloth = NULL;
 -      float maxdist = 0;
  
-       // If we have a clothObject, free it. 
+       // If we have a clothObject, free it.
        if ( clmd->clothObject != NULL ) {
                cloth_free_modifier ( clmd );
                if (G.debug_value > 0)
@@@ -852,16 -832,15 +852,16 @@@
                                copy_v3_v3(verts->xrest, shapekey_rest[i]);
                                mul_m4_v3(ob->obmat, verts->xrest);
                        }
 -                      else
 +                      else {
                                copy_v3_v3(verts->xrest, verts->x);
 +                      }
                }
-               
+ 
                /* no GUI interface yet */
-               verts->mass = clmd->sim_parms->mass; 
+               verts->mass = clmd->sim_parms->mass;
                verts->impulse_count = 0;
  
 -              if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
 +              if ( clmd->sim_parms->vgroup_mass>0 )
                        verts->goal= clmd->sim_parms->defgoal;
                else
                        verts->goal= 0.0f;
@@@ -877,13 -856,11 +877,13 @@@
  
                verts->impulse_count = 0;
                copy_v3_v3 ( verts->impulse, tnull );
 +
 +              verts->col_trouble = 0.0f;
        }
-       
+ 
        // apply / set vertex groups
        // has to be happen before springs are build!
 -      cloth_apply_vgroup (clmd, dm);
 +      cloth_apply_vgroup(clmd, dm, ob);
  
        if ( !cloth_build_springs ( clmd, dm ) ) {
                cloth_free_modifier ( clmd );
@@@ -898,9 -875,13 +898,9 @@@
        if (!first)
                BKE_cloth_solver_set_positions(clmd);
  
 -      clmd->clothObject->bvhtree = bvhtree_build_from_cloth ( clmd, 
MAX2(clmd->coll_parms->epsilon, clmd->coll_parms->distance_repel) );
 +      clmd->clothObject->bvhtree = bvhtree_build_from_cloth ( clmd, 
clmd->coll_parms->epsilon );
-       
+ 
 -      for (i = 0; i < dm->getNumVerts(dm); i++) {
 -              maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( 
cloth->verts[i].avg_spring_len*2.0f));
 -      }
 -
 -      clmd->clothObject->bvhselftree = bvhselftree_build_from_cloth ( clmd, 
maxdist );
 +      clmd->clothObject->bvhselftree = bvhtree_build_from_cloth ( clmd, 
clmd->coll_parms->selfepsilon );
  
        return 1;
  }
@@@ -957,39 -938,6 +957,39 @@@ BLI_INLINE void spring_verts_ordered_se
        }
  }
  
 +// be careful: implicit solver has to be resettet when using this one!
 +// --> only for implicit handling of this spring!
 +#if 0 // Unused for now, but might come in handy when implementing something 
with dynamic spring count
 +static int cloth_add_spring(ClothModifierData *clmd, unsigned int indexA, 
unsigned int indexB, float restlength, int spring_type)
 +{
 +      Cloth *cloth = clmd->clothObject;
 +      ClothSpring *spring = NULL;
-       
++
 +      if (cloth && spring_type != CLOTH_SPRING_TYPE_BENDING) {
 +              // TODO: look if this spring is already there
-               
++
 +              spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), 
"cloth spring" );
-               
++
 +              if (!spring)
 +                      return 0;
-               
++
 +              spring->ij = indexA;
 +              spring->kl = indexB;
 +              spring->restlen =  restlength;
 +              spring->type = spring_type;
 +              spring->flags = 0;
 +              spring->lin_stiffness = 0.0f;
-               
++
 +              cloth->numsprings++;
-       
++
 +              BLI_linklist_prepend ( &cloth->springs, spring );
-               
++
 +              return 1;
 +      }
 +      return 0;
 +}
 +#endif
 +
  static void cloth_free_edgelist(LinkNodePair *edgelist, unsigned int 
mvert_num)
  {
        if (edgelist) {
@@@ -1101,11 -996,11 +1101,11 @@@ static void cloth_hair_update_bending_t
                ClothSpring *spring = search->link;
                ClothHairData *hair_ij, *hair_kl;
                bool is_root = spring->kl != prev_mn;
-               
+ 
 -              if (spring->type != CLOTH_SPRING_TYPE_BENDING_ANG) {
 +              if (spring->type != CLOTH_SPRING_TYPE_BENDING_HAIR) {
                        continue;
                }
-               
+ 
                hair_ij = &clmd->hairdata[spring->ij];
                hair_kl = &clmd->hairdata[spring->kl];
                if (is_root) {
@@@ -1176,11 -1071,11 +1176,11 @@@ static void cloth_hair_update_bending_r
                ClothSpring *spring = search->link;
                ClothHairData *hair_ij, *hair_kl;
                bool is_root = spring->kl != prev_mn;
-               
+ 
 -              if (spring->type != CLOTH_SPRING_TYPE_BENDING_ANG) {
 +              if (spring->type != CLOTH_SPRING_TYPE_BENDING_HAIR) {
                        continue;
                }
-               
+ 
                hair_ij = &clmd->hairdata[spring->ij];
                hair_kl = &clmd->hairdata[spring->kl];
                if (is_root) {
@@@ -1617,82 -1391,109 +1617,82 @@@ static int cloth_build_springs ( ClothM
                                                return 0;
                                        }
  
 -                                      spring_verts_ordered_set(spring, 
tspring2->ij, index2);
 -                                      shrink_factor = 
cloth_shrink_factor(clmd, cloth->verts, spring->ij, spring->kl);
 -                                      spring->restlen = 
len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest) * 
shrink_factor;
 -                                      spring->type = 
CLOTH_SPRING_TYPE_BENDING;
 -                                      spring->stiffness = 
(cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 
2.0f;
 -                                      BLI_edgeset_insert(edgeset, spring->ij, 
spring->kl);
 -                                      bend_springs++;
 +                                      tmp_loop = mloop + 
mpoly[curr_ref->index].loopstart;
  
 -                                      BLI_linklist_prepend ( &cloth->springs, 
spring );
 -                              }
 -                              search = search->next;
 -                      }
 -                      search2 = search2->next;
 -              }
 -      }
 -      else if (struct_springs > 2) {
 -              if (G.debug_value != 1112) {
 -                      search = cloth->springs;
 -                      search2 = search->next;
 -                      while (search && search2) {
 -                              tspring = search->link;
 -                              tspring2 = search2->link;
 +                                      for (k = 0; k < spring->la; k++, 
tmp_loop++) {
 +                                              spring->pa[k] = tmp_loop->v;
 +                                      }
  
 -                              if (tspring->ij == tspring2->kl) {
 -                                      spring = (ClothSpring *)MEM_callocN ( 
sizeof ( ClothSpring ), "cloth spring" );
 +                                      tmp_loop = mloop + mpoly[i].loopstart;
  
 -                                      if (!spring) {
 -                                              cloth_free_errorsprings(cloth, 
edgelist);
 -                                              return 0;
 +                                      for (k = 0; k < spring->lb; k++, 
tmp_loop++) {
 +                                              spring->pb[k] = tmp_loop->v;
                                        }
  
 -                                      spring->ij = tspring2->ij;
 -                                      spring->kl = tspring->ij;
 -                                      spring->mn = tspring->kl;
 -                                      spring->restlen = 
len_v3v3(cloth->verts[spring->kl].

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to