Revision: 27126
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27126
Author:   campbellbarton
Date:     2010-02-24 19:06:51 +0100 (Wed, 24 Feb 2010)

Log Message:
-----------
hair was running collision functions (copy to/from collision arrays), even when 
collision could not be done.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/collision.c
    trunk/blender/source/blender/blenkernel/intern/implicit.c

Modified: trunk/blender/source/blender/blenkernel/intern/collision.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/collision.c  2010-02-24 
17:27:29 UTC (rev 27125)
+++ trunk/blender/source/blender/blenkernel/intern/collision.c  2010-02-24 
18:06:51 UTC (rev 27126)
@@ -1550,8 +1550,8 @@
 // cloth - object collisions
 int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, 
float dt )
 {
-       Cloth *cloth=NULL;
-       BVHTree *cloth_bvh=NULL;
+       Cloth *cloth= clmd->clothObject;
+       BVHTree *cloth_bvh= cloth->bvhtree;
        int i=0, numfaces = 0, numverts = 0, k, l, j;
        int rounds = 0; // result counts applied collisions; ic is for debug 
output;
        ClothVertex *verts = NULL;
@@ -1559,16 +1559,12 @@
        Object **collobjs = NULL;
        int numcollobj = 0;
 
-       if ( ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ ) || ! ( 
( ( Cloth * ) clmd->clothObject )->bvhtree ) )
-       {
+       if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ) || 
cloth_bvh==NULL)
                return 0;
-       }
 
-       cloth = clmd->clothObject;
        verts = cloth->verts;
-       cloth_bvh = ( BVHTree * ) cloth->bvhtree;
-       numfaces = clmd->clothObject->numfaces;
-       numverts = clmd->clothObject->numverts;
+       numfaces = cloth->numfaces;
+       numverts = cloth->numverts;
 
        ////////////////////////////////////////////////////////////
        // static collisions
@@ -1672,8 +1668,8 @@
                                // collisions = 1;
                                verts = cloth->verts; // needed for openMP
        
-                               numfaces = clmd->clothObject->numfaces;
-                               numverts = clmd->clothObject->numverts;
+                               numfaces = cloth->numfaces;
+                               numverts = cloth->numverts;
        
                                verts = cloth->verts;
        

Modified: trunk/blender/source/blender/blenkernel/intern/implicit.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/implicit.c   2010-02-24 
17:27:29 UTC (rev 27125)
+++ trunk/blender/source/blender/blenkernel/intern/implicit.c   2010-02-24 
18:06:51 UTC (rev 27126)
@@ -1689,8 +1689,8 @@
                        
                        VECCOPY(verts[i].txold, id->X[i]);
                }
-               
-               if(clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED)
+
+               if(clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED && 
clmd->clothObject->bvhtree)
                {
                        float temp = clmd->sim_parms->stepsPerFrame;
                        /* not too nice hack, but collisions need this 
correction -jahka */


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to