forked from bartvdbraak/blender
Cloth: 1. fix problem with pinning (reported by ZanQdo), 2. fix cache protected + 'not saved' gui message bug (reported by Tobias Regenbrecht)
This commit is contained in:
parent
db6cef5602
commit
eb281bff39
@ -761,8 +761,8 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd,Object *ob, DerivedMesh *d
|
||||
return result;
|
||||
}
|
||||
|
||||
// check for autoprotection
|
||||
if(framenr >= clmd->sim_parms->autoprotect)
|
||||
// check for autoprotection, but only if cache active
|
||||
if((framenr >= clmd->sim_parms->autoprotect) && (G.relbase_valid))
|
||||
{
|
||||
if(G.rt > 0)
|
||||
printf("fr#: %f, auto: %d\n", framenr, clmd->sim_parms->autoprotect);
|
||||
@ -1073,7 +1073,9 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
|
||||
|
||||
verts->goal = ( float ) pow ( verts->goal , 4.0f );
|
||||
if ( verts->goal >=SOFTGOALSNAP )
|
||||
verts->flags |= CLOTH_VERT_FLAG_PINNED;
|
||||
{
|
||||
verts->flags |= CLOTH_VERT_FLAG_PINNED;
|
||||
}
|
||||
}
|
||||
|
||||
if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING )
|
||||
@ -1089,11 +1091,13 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
|
||||
verts->bend_stiff = dvert->dw [j].weight;
|
||||
}
|
||||
}
|
||||
|
||||
if( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_mass-1))
|
||||
/*
|
||||
// for later
|
||||
if( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_weight-1))
|
||||
{
|
||||
verts->mass = dvert->dw [j].weight;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BIF_editdeform.h"
|
||||
#include "BIF_editdeform.h"
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -111,9 +111,6 @@ double itval()
|
||||
}
|
||||
#endif
|
||||
|
||||
/* callbacks for errors and interrupts and some goo */
|
||||
static int (*CT_localInterruptCallBack)(void) = NULL;
|
||||
|
||||
static float I[3][3] = {{1,0,0},{0,1,0},{0,0,1}};
|
||||
static float ZERO[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}};
|
||||
|
||||
@ -783,7 +780,7 @@ int implicit_init (Object *ob, ClothModifierData *clmd)
|
||||
{
|
||||
id->A[i].r = id->A[i].c = id->dFdV[i].r = id->dFdV[i].c = id->dFdX[i].r = id->dFdX[i].c = id->P[i].c = id->P[i].r = id->Pinv[i].c = id->Pinv[i].r = id->bigI[i].c = id->bigI[i].r = id->M[i].r = id->M[i].c = i;
|
||||
|
||||
if(verts [i].goal >= SOFTGOALSNAP)
|
||||
if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
|
||||
{
|
||||
id->S[pinned].pinned = 1;
|
||||
id->S[pinned].c = id->S[pinned].r = i;
|
||||
@ -1337,6 +1334,7 @@ void cloth_calc_force(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVec
|
||||
submul_lfvectorS(lF, lV, spring_air, numverts);
|
||||
|
||||
/* do goal stuff */
|
||||
/*
|
||||
if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL)
|
||||
{
|
||||
for(i = 0; i < numverts; i++)
|
||||
@ -1353,15 +1351,13 @@ void cloth_calc_force(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVec
|
||||
VECADDS(lF[i], lF[i], auxvect, -ks);
|
||||
|
||||
// calulate damping forces generated by goals
|
||||
|
||||
VECSUB(velgoal,verts[i].xold, verts[i].xconst);
|
||||
kd = clmd->sim_parms->goalfrict * 0.01f; // friction force scale taken from SB
|
||||
VECSUBADDSS(lF[i], velgoal, kd, lV[i], kd);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/* handle external forces like wind */
|
||||
if(effectors)
|
||||
@ -1459,7 +1455,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
|
||||
for(i = 0; i < numverts; i++)
|
||||
{
|
||||
// update velocities with constrained velocities from pinned verts
|
||||
if(verts [i].goal >= SOFTGOALSNAP)
|
||||
if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
|
||||
{
|
||||
VECSUB(id->V[i], verts[i].xconst, verts[i].xold);
|
||||
// VecMulf(id->V[i], 1.0 / dt);
|
||||
@ -1500,7 +1496,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
|
||||
|
||||
if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL)
|
||||
{
|
||||
if(verts [i].goal >= SOFTGOALSNAP)
|
||||
if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
|
||||
{
|
||||
float tvect[3] = {.0,.0,.0};
|
||||
// VECSUB(tvect, id->Xnew[i], verts[i].xold);
|
||||
@ -1528,7 +1524,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
|
||||
|
||||
if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL)
|
||||
{
|
||||
if(verts [i].goal >= SOFTGOALSNAP)
|
||||
if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -1580,12 +1576,6 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
|
||||
|
||||
if(effectors) pdEndEffectors(effectors);
|
||||
|
||||
/* ask for user break */
|
||||
/*
|
||||
don't work very well, gives problems with ctrl-a + esc
|
||||
if (CT_localInterruptCallBack && CT_localInterruptCallBack())
|
||||
return 0;
|
||||
*/
|
||||
}
|
||||
|
||||
for(i = 0; i < numverts; i++)
|
||||
@ -1631,8 +1621,3 @@ void implicit_set_positions (ClothModifierData *clmd)
|
||||
printf("implicit_set_positions\n");
|
||||
}
|
||||
|
||||
/* Cloth global visible functions */
|
||||
void clmdSetInterruptCallBack(int (*f)(void))
|
||||
{
|
||||
CT_localInterruptCallBack = f;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user