Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r--source/blender/blenkernel/intern/cloth.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index be1552a882d..e7e94c407f1 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -87,7 +87,7 @@ static CM_SOLVER_DEF solvers [] =
/* Prototypes for internal functions.
*/
static void cloth_to_object (Object *ob, ClothModifierData *clmd, DerivedMesh *dm);
-static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *dm );
+static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm );
static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float framenr, int first);
static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm );
static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm );
@@ -423,7 +423,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
/************************************************
* clothModifier_do - main simulation function
************************************************/
-DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc)
+DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, DerivedMesh *dm, int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
{
DerivedMesh *result;
PointCache *cache;
@@ -446,7 +446,9 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
return dm;
}
- if(clmd->sim_parms->reset || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0))
+ if(clmd->sim_parms->reset
+ || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0)
+ || (clmd->clothObject && result->getNumVerts(result) != clmd->clothObject->numverts))
{
clmd->sim_parms->reset = 0;
cache->flag |= PTCACHE_OUTDATED;
@@ -457,17 +459,6 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
return result;
}
- /* verify we still have the same number of vertices, if not do nothing.
- * note that this should only happen if the number of vertices changes
- * during an animation due to a preceding modifier, this should not
- * happen because of object changes! */
- if(clmd->clothObject) {
- if(result->getNumVerts(result) != clmd->clothObject->numverts) {
- BKE_ptcache_invalidate(cache);
- return result;
- }
- }
-
// unused in the moment, calculated separately in implicit.c
clmd->sim_parms->dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame;
@@ -555,7 +546,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
}
/* frees all */
-void cloth_free_modifier ( Object *ob, ClothModifierData *clmd )
+void cloth_free_modifier(ClothModifierData *clmd )
{
Cloth *cloth = NULL;
@@ -813,7 +804,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
}
}
-static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float framenr, int first)
+static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float UNUSED(framenr), int first)
{
int i = 0;
MVert *mvert = NULL;
@@ -826,7 +817,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
// If we have a clothObject, free it.
if ( clmd->clothObject != NULL )
{
- cloth_free_modifier ( ob, clmd );
+ cloth_free_modifier ( clmd );
if(G.rt > 0)
printf("cloth_free_modifier cloth_from_object\n");
}
@@ -850,7 +841,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
if ( !dm )
return 0;
- cloth_from_mesh ( ob, clmd, dm );
+ cloth_from_mesh ( clmd, dm );
// create springs
clmd->clothObject->springs = NULL;
@@ -906,7 +897,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
if ( !cloth_build_springs ( clmd, dm ) )
{
- cloth_free_modifier ( ob, clmd );
+ cloth_free_modifier ( clmd );
modifier_setError ( & ( clmd->modifier ), "Can't build springs." );
printf("cloth_free_modifier cloth_build_springs\n");
return 0;
@@ -940,7 +931,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
return 1;
}
-static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *dm )
+static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
{
unsigned int numverts = dm->getNumVerts ( dm );
unsigned int numfaces = dm->getNumFaces ( dm );
@@ -952,7 +943,7 @@ static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *
clmd->clothObject->verts = MEM_callocN ( sizeof ( ClothVertex ) * clmd->clothObject->numverts, "clothVertex" );
if ( clmd->clothObject->verts == NULL )
{
- cloth_free_modifier ( ob, clmd );
+ cloth_free_modifier ( clmd );
modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->verts." );
printf("cloth_free_modifier clmd->clothObject->verts\n");
return;
@@ -963,7 +954,7 @@ static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *
clmd->clothObject->mfaces = MEM_callocN ( sizeof ( MFace ) * clmd->clothObject->numfaces, "clothMFaces" );
if ( clmd->clothObject->mfaces == NULL )
{
- cloth_free_modifier ( ob, clmd );
+ cloth_free_modifier ( clmd );
modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->mfaces." );
printf("cloth_free_modifier clmd->clothObject->mfaces\n");
return;
@@ -1015,7 +1006,7 @@ int cloth_add_spring ( ClothModifierData *clmd, unsigned int indexA, unsigned in
return 0;
}
-static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *edgehash, LinkNode **edgelist)
+static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), LinkNode **edgelist)
{
unsigned int i = 0;