[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12327] branches/cloth/blender/source/ blender: Fixed read/writing of blendfiles with collision modifier ( saving not supported itm), also changed naming
Daniel Genrich
daniel.genrich at gmx.net
Sun Oct 21 18:53:25 CEST 2007
Revision: 12327
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12327
Author: genscher
Date: 2007-10-21 18:53:25 +0200 (Sun, 21 Oct 2007)
Log Message:
-----------
Fixed read/writing of blendfiles with collision modifier (saving not supported itm), also changed naming
Modified Paths:
--------------
branches/cloth/blender/source/blender/blenkernel/BKE_collisions.h
branches/cloth/blender/source/blender/blenkernel/intern/kdop.c
branches/cloth/blender/source/blender/blenkernel/intern/modifier.c
branches/cloth/blender/source/blender/blenloader/intern/readfile.c
branches/cloth/blender/source/blender/makesdna/DNA_modifier_types.h
Modified: branches/cloth/blender/source/blender/blenkernel/BKE_collisions.h
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/BKE_collisions.h 2007-10-21 16:48:12 UTC (rev 12326)
+++ branches/cloth/blender/source/blender/blenkernel/BKE_collisions.h 2007-10-21 16:53:25 UTC (rev 12327)
@@ -64,8 +64,8 @@
{
unsigned int numfaces;
unsigned int numverts;
- MVert *x; // position of verts at time n
- MVert *xold; // position of verts at time n-1
+ MVert *xnew; // position of verts at time n
+ MVert *x; // position of verts at time n-1
MFace *mfaces; // just a pointer to the original datastructure
struct LinkNode *tree;
TreeNode *root; // TODO: saving the root --> is this really needed? YES!
Modified: branches/cloth/blender/source/blender/blenkernel/intern/kdop.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/kdop.c 2007-10-21 16:48:12 UTC (rev 12326)
+++ branches/cloth/blender/source/blender/blenkernel/intern/kdop.c 2007-10-21 16:53:25 UTC (rev 12327)
@@ -387,7 +387,7 @@
void bvh_calc_DOP_hull_static(BVH * bvh, Tree **tri, int numfaces, float *bv)
{
- MVert *tempMVert = bvh->xold;
+ MVert *tempMVert = bvh->x;
MFace *tempMFace = bvh->mfaces;
float *tempBV = bv;
float newminmax;
@@ -426,8 +426,8 @@
void bvh_calc_DOP_hull_moving(BVH * bvh, Tree **tri, int numfaces, float *bv)
{
- MVert *tempMVert = bvh->xold;
- MVert *tempMVert2 = bvh->x;
+ MVert *tempMVert = bvh->x;
+ MVert *tempMVert2 = bvh->xnew;
MFace *tempMFace = bvh->mfaces;
float *tempBV = bv;
float newminmax;
@@ -538,7 +538,7 @@
return;
}
-BVH *bvh_build (DerivedMesh *dm, MVert *x, MVert *xold, unsigned int numverts, float epsilon)
+BVH *bvh_build (DerivedMesh *dm, MVert *x, MVert *xnew, unsigned int numverts, float epsilon)
{
unsigned int i = 0, j = 0, k = 0;
Tree **face_list=NULL;
@@ -569,8 +569,8 @@
mface = bvh->mfaces = dm->getFaceArray(dm);
bvh->numverts = numverts;
+ bvh->xnew = xnew;
bvh->x = x;
- bvh->xold = xold;
tree = (Tree *)MEM_callocN(sizeof(Tree), "Tree");
// TODO: check succesfull alloc
BLI_linklist_append(&bvh->tree, tree);
@@ -774,7 +774,7 @@
}
// update static bvh
-// needs new positions in bvh->x, bvh->xold
+// needs new positions in bvh->x, bvh->xnew
void bvh_update(DerivedMesh *dm, BVH * bvh, int moving)
{
TreeNode *leaf, *parent;
Modified: branches/cloth/blender/source/blender/blenkernel/intern/modifier.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/modifier.c 2007-10-21 16:48:12 UTC (rev 12326)
+++ branches/cloth/blender/source/blender/blenkernel/intern/modifier.c 2007-10-21 16:53:25 UTC (rev 12327)
@@ -4956,7 +4956,7 @@
CollisionModifierData *collmd = (CollisionModifierData*) md;
collmd->x = NULL;
- collmd->xold = NULL;
+ collmd->xnew = NULL;
collmd->time = -1;
collmd->numverts = 0;
collmd->tree = NULL;
@@ -4972,11 +4972,11 @@
bvh_free(collmd->tree);
if(collmd->x)
MEM_freeN(collmd->x);
- if(collmd->xold)
- MEM_freeN(collmd->xold);
+ if(collmd->xnew)
+ MEM_freeN(collmd->xnew);
collmd->x = NULL;
- collmd->xold = NULL;
+ collmd->xnew = NULL;
collmd->time = -1;
collmd->numverts = 0;
collmd->tree = NULL;
@@ -5018,26 +5018,26 @@
if(collmd->time == -1) // first time
{
collmd->x = dm->dupVertArray(dm);
- collmd->xold = dm->dupVertArray(dm);
+ collmd->xnew = dm->dupVertArray(dm);
collmd->numverts = numverts;
// TODO: epsilon
// create bounding box hierarchy
- collmd->tree = bvh_build(dm, collmd->x, collmd->xold, numverts, 0.01);
+ collmd->tree = bvh_build(dm, collmd->x, collmd->xnew, numverts, 0.01);
}
else if(numverts == collmd->numverts)
{
// put positions to old positions
- tempVert = collmd->xold;
- collmd->xold = collmd->x;
- collmd->x = tempVert;
+ tempVert = collmd->x;
+ collmd->x = collmd->xnew;
+ collmd->xnew = tempVert;
- memcpy(collmd->x, dm->getVertArray(dm), numverts*sizeof(MVert));
+ memcpy(collmd->xnew, dm->getVertArray(dm), numverts*sizeof(MVert));
for ( i = 0; i < numverts; i++ )
{
// we save global positions
- Mat4MulVecfl ( ob->obmat, collmd->x[i].co );
+ Mat4MulVecfl ( ob->obmat, collmd->xnew[i].co );
}
bvh_update(dm, collmd->tree, 0); // recalc static bounding boxes
Modified: branches/cloth/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/cloth/blender/source/blender/blenloader/intern/readfile.c 2007-10-21 16:48:12 UTC (rev 12326)
+++ branches/cloth/blender/source/blender/blenloader/intern/readfile.c 2007-10-21 16:53:25 UTC (rev 12327)
@@ -2888,6 +2888,15 @@
printf ("direct_link_modifiers: read cloth baked_data.\n");
}
}
+ else if (md->type==eModifierType_Collision) {
+ CollisionModifierData *collmd = (CollisionModifierData*) md;
+
+ collmd->x = NULL;
+ collmd->xnew = NULL;
+ collmd->time = -1;
+ collmd->numverts = 0;
+ collmd->tree = NULL;
+ }
else if (md->type==eModifierType_Hook) {
HookModifierData *hmd = (HookModifierData*) md;
Modified: branches/cloth/blender/source/blender/makesdna/DNA_modifier_types.h
===================================================================
--- branches/cloth/blender/source/blender/makesdna/DNA_modifier_types.h 2007-10-21 16:48:12 UTC (rev 12326)
+++ branches/cloth/blender/source/blender/makesdna/DNA_modifier_types.h 2007-10-21 16:53:25 UTC (rev 12327)
@@ -351,7 +351,7 @@
ModifierData modifier;
struct MVert *x;
- struct MVert *xold;
+ struct MVert *xnew;
unsigned int numverts;
float time;
More information about the Bf-blender-cvs
mailing list