diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2009-04-27 20:44:02 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2009-04-27 20:44:02 +0400 |
commit | 352eaccd5d991ad8966d686ae0954c7a0b03345c (patch) | |
tree | 40151c894e6b681ee158b8da72361b76bfa6447e /source/blender | |
parent | c56ee09c48b4d29dabe1c7daa2133777c27944f6 (diff) |
BGE: Add soft body welding parameter to the Advanced Settings panel. The values are very small so I chose to use logarithmic scale. Should be fine, it's an advanced setting after all.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/bullet.c | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_force.h | 2 | ||||
-rw-r--r-- | source/blender/src/buttons_logic.c | 20 |
3 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/bullet.c b/source/blender/blenkernel/intern/bullet.c index b389f8c0536..657507ee048 100644 --- a/source/blender/blenkernel/intern/bullet.c +++ b/source/blender/blenkernel/intern/bullet.c @@ -82,6 +82,7 @@ BulletSoftBody *bsbNew(void) bsb->collisionflags = 0; //bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS; bsb->numclusteriterations = 64; + bsb->welding = -4.f; return bsb; } diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 49435000820..73dd8b28d15 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -119,7 +119,7 @@ typedef struct BulletSoftBody { float kAHR; /* Anchors hardness [0,1] */ int collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */ int numclusteriterations; /* number of iterations to refine collision clusters*/ - + float welding; /* welding limit to remove duplicate/nearby vertices, 0.0000001..0.01 */ } BulletSoftBody; /* BulletSoftBody.flag */ diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c index 0a7bbf656b3..8b6cc457994 100644 --- a/source/blender/src/buttons_logic.c +++ b/source/blender/src/buttons_logic.c @@ -3073,19 +3073,19 @@ static uiBlock *advanced_bullet_menu(void *arg_ob) { uiBlock *block; Object *ob = arg_ob; - short yco = 20, xco = 0; + short yco, xco = 0; block= uiNewBlock(&curarea->uiblocks, "advanced_bullet_options", UI_EMBOSS, UI_HELV, curarea->win); /* use this for a fake extra empy space around the buttons */ if (ob->gameflag & OB_SOFT_BODY) { - uiDefBut(block, LABEL, 0, "", -10, -10, 380, 60, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, LABEL, 0, "", -10, -10, 380, 80, NULL, 0, 0, 0, 0, ""); if (ob->bsoft) { - + yco = 40; uiBlockBeginAlign(block); uiDefButBitI(block, TOG, OB_BSB_COL_CL_RS, 0, "Cluster Collision RS", xco, yco, 180, 19, &ob->bsoft->collisionflags, 0, 0, 0, 0, @@ -3102,6 +3102,14 @@ static uiBlock *advanced_bullet_menu(void *arg_ob) xco+=180, yco, 180, 19, &ob->bsoft->piterations, 0, 10, 0, 0, "Position solver iterations"); uiBlockEndAlign(block); + yco -= 20; + xco = 0; + if (ob->bsoft->welding == 0.f) + ob->bsoft->welding = -4.f; + + uiDefButF(block, NUMSLI, 0, "Welding(10^) ", + xco, yco, 360, 19, &ob->bsoft->welding, -7.f, -2.f, 10, 2, + "Threshold to remove duplicate/nearby vertices. Displayed in logarithmic scale for readability: linear values from 0.0000001 to 0.01"); /* //too complex tweaking, disable for now @@ -3131,7 +3139,7 @@ static uiBlock *advanced_bullet_menu(void *arg_ob) if (ob->gameflag & OB_DYNAMIC) { - yco = 100; + yco = 80; uiDefBut(block, LABEL, 0, "", -10, -10, 380, 120, NULL, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); if (ob->margin < 0.001f) @@ -3173,7 +3181,7 @@ static uiBlock *advanced_bullet_menu(void *arg_ob) uiBlockEndAlign(block); - uiDefBut(block, LABEL, 0, "Clamp Velocity (zero disables)", xco, yco, 180*2, 19, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, LABEL, 0, "Clamp Velocity (0=disabled)", xco, yco, 180*2, 19, NULL, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); @@ -3215,7 +3223,7 @@ static uiBlock *advanced_bullet_menu(void *arg_ob) } else { - + yco = 20; uiDefBut(block, LABEL, 0, "", -10, -10, 380, 60, NULL, 0, 0, 0, 0, ""); uiDefButF(block, NUM, 0, "Margin", xco, yco, 180, 19, &ob->margin, 0.0, 1.0, 1, 0, |