[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12397] branches/cloth/blender/source/ blender/blenkernel: Fixed all known crashers, still have to verify a few things, and compiling works on gxx too, now
Daniel Genrich
daniel.genrich at gmx.net
Fri Oct 26 00:09:06 CEST 2007
Revision: 12397
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12397
Author: genscher
Date: 2007-10-26 00:09:06 +0200 (Fri, 26 Oct 2007)
Log Message:
-----------
Fixed all known crashers, still have to verify a few things, and compiling works on gxx too, now
Modified Paths:
--------------
branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h
branches/cloth/blender/source/blender/blenkernel/intern/cloth.c
Modified: branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h 2007-10-25 21:17:55 UTC (rev 12396)
+++ branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h 2007-10-25 22:09:06 UTC (rev 12397)
@@ -122,7 +122,7 @@
void implicit_set_positions ( ClothModifierData *clmd );
// from cloth.c, needed for modifier.c
-DerivedMesh *clothModifier_do(ClothModifierData *clmd, Object *ob, DerivedMesh *dm);
+DerivedMesh *clothModifier_do(ClothModifierData *clmd,Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc);
////////////////////////////////////////////////
Modified: branches/cloth/blender/source/blender/blenkernel/intern/cloth.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/cloth.c 2007-10-25 21:17:55 UTC (rev 12396)
+++ branches/cloth/blender/source/blender/blenkernel/intern/cloth.c 2007-10-25 22:09:06 UTC (rev 12397)
@@ -654,13 +654,7 @@
// Insure we have a clmd->clothObject, in case allocation failed.
if (clmd->clothObject != NULL)
- {
-
- cloth->mfaces = mface; // update face pointer
- ((BVH *)cloth->tree)->mfaces = mface;
- cloth->numfaces = numfaces;
- ((BVH *)cloth->tree)->numfaces = numfaces;
-
+ {
if(!cloth_cache_search_frame(clmd, framenr))
{
/* Force any pinned verts to their constrained location. */
@@ -747,35 +741,39 @@
// Free the verts.
if (cloth->verts != NULL)
MEM_freeN (cloth->verts);
+
+ // Free the faces.
+ if ( cloth->mfaces != NULL )
+ MEM_freeN ( cloth->mfaces );
// Free the verts.
- if ( cloth->x != NULL )
- MEM_freeN ( cloth->x );
-
- // Free the verts.
- if ( cloth->xnew != NULL )
- MEM_freeN ( cloth->xnew );
+ if ( cloth->x != NULL )
+ MEM_freeN ( cloth->x );
+
+ // Free the verts.
+ if ( cloth->xnew != NULL )
+ MEM_freeN ( cloth->xnew );
cloth->verts = NULL;
cloth->numverts = -1;
- // Free the springs.
- if ( cloth->springs != NULL )
+ // Free the springs.
+ if ( cloth->springs != NULL )
+ {
+ LinkNode *search = cloth->springs;
+ while(search)
{
- LinkNode *search = cloth->springs;
- while(search)
- {
- ClothSpring *spring = search->link;
-
- MEM_freeN ( spring );
- search = search->next;
- }
- BLI_linklist_free(cloth->springs, NULL);
-
- cloth->springs = NULL;
+ ClothSpring *spring = search->link;
+
+ MEM_freeN ( spring );
+ search = search->next;
}
+ BLI_linklist_free(cloth->springs, NULL);
+
+ cloth->springs = NULL;
+ }
- cloth->numsprings = -1;
+ cloth->numsprings = -1;
// free BVH collision tree
if(cloth->tree)
@@ -877,42 +875,7 @@
}
}
}
-
-// only meshes supported at the moment
-/* collision objects */
-static int collobj_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, DerivedMesh *olddm, float framenr)
-{
- unsigned int i;
- unsigned int numverts = dm->getNumVerts(dm);
- MVert *mvert = CDDM_get_verts(dm);
-
- switch (ob->type)
- {
- case OB_MESH:
- cloth_from_mesh (ob, clmd, dm, framenr);
- if (clmd->clothObject != NULL)
- {
-
- for (i = 0; i < numverts; ++i)
- {
- VECCOPY (clmd->clothObject->verts [i].x, mvert[i].co);
- Mat4MulVecfl(ob->obmat, clmd->clothObject->verts [i].x);
- clmd->clothObject->verts [i].flags = 0;
- VECCOPY(clmd->clothObject->verts [i].xold, clmd->clothObject->verts [i].x);
- VECCOPY(clmd->clothObject->verts [i].txold, clmd->clothObject->verts [i].x);
- VECCOPY(clmd->clothObject->verts [i].tx, clmd->clothObject->verts [i].x);
- VecMulf(clmd->clothObject->verts [i].v, 0.0f);
- }
- clmd->clothObject->tree = bvh_build(clmd, 0.001f);
-
- }
-
- return 1;
- default: return 0; // TODO - we do not support changing meshes
- }
-}
-
// only meshes supported at the moment
static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, DerivedMesh *olddm, float framenr)
{
@@ -928,15 +891,13 @@
clmd->clothObject = MEM_callocN (sizeof(Cloth), "cloth");
if (clmd->clothObject)
{
- clmd->clothObject->old_solver_type = -1;
+ clmd->clothObject->old_solver_type = 255;
}
else if (clmd->clothObject == NULL)
{
modifier_setError (&(clmd->modifier), "Out of memory on allocating clmd->clothObject.");
return 0;
}
-
- printf("cloth_from_object\n");
switch (ob->type)
{
@@ -979,20 +940,12 @@
if (solvers [clmd->sim_parms.solver_type].init)
solvers [clmd->sim_parms.solver_type].init (ob, clmd);
- clmd->clothObject->tree = bvh_build(clmd, clmd->coll_parms.epsilon);
+ clmd->clothObject->tree = NULL; // bvh_build(clmd, clmd->coll_parms.epsilon);
cloth_cache_set_frame(clmd, 1);
}
return 1;
- case OB_LATTICE:
- printf("OB_LATTICE\n");
- // lattice_to_softbody(ob);
- return 1;
- case OB_CURVE:
- case OB_SURF:
- printf("OB_SURF| OB_CURVE\n");
- return 1;
default: return 0; // TODO - we do not support changing meshes
}
@@ -1017,29 +970,15 @@
return;
}
- // collision objects need to cache face infos since they are needed during collision detection
- // TODO: maybe cache it for cloth objects, too
- if (clmd->sim_parms.flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ)
+ clmd->clothObject->numfaces = numfaces;
+ clmd->clothObject->mfaces = MEM_callocN (sizeof (MFace) * clmd->clothObject->numfaces, "clothMFaces");
+ if (clmd->clothObject->mfaces == NULL)
{
- clmd->clothObject->numfaces = numfaces;
- clmd->clothObject->mfaces = MEM_callocN (sizeof (MFace) * clmd->clothObject->numfaces, "clothMFaces");
- if (clmd->clothObject->mfaces == NULL)
- {
- cloth_free_modifier (clmd);
- modifier_setError (&(clmd->modifier), "Out of memory on allocating clmd->clothObject->mfaces.");
- return;
- }
- for(i = 0; i < numfaces; i++)
- memcpy(&clmd->clothObject->mfaces[i], &mface[i], sizeof(MFace));
+ cloth_free_modifier (clmd);
+ modifier_setError (&(clmd->modifier), "Out of memory on allocating clmd->clothObject->mfaces.");
+ return;
}
- else
- {
- clmd->clothObject->mfaces = mface; // update face pointer
- clmd->clothObject->numfaces = numfaces;
- }
-
- // for SIP code
- // clmd->clothObject->facemarks = MEM_callocN (sizeof (unsigned char) * clmd->clothObject->numfaces, "clothFaceMarks");
+ memcpy(clmd->clothObject->mfaces, mface, sizeof(MFace)*numfaces);
/* Free the springs since they can't be correct if the vertices
* changed.
@@ -1133,7 +1072,7 @@
BLI_linklist_append ( &cloth->springs, spring );
}
}
-
+
// shear springs
for ( i = 0; i < numfaces; i++ )
{
More information about the Bf-blender-cvs
mailing list