[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14099] trunk/blender/source/blender/ blenkernel: Cloth header cleanup, bugfix (again) in wind calculation, bugfix for not working fields mindist GUI option

Daniel Genrich daniel.genrich at gmx.net
Thu Mar 13 23:45:36 CET 2008


Revision: 14099
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14099
Author:   genscher
Date:     2008-03-13 23:45:36 +0100 (Thu, 13 Mar 2008)

Log Message:
-----------
Cloth header cleanup, bugfix (again) in wind calculation, bugfix for not working fields mindist GUI option

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_cloth.h
    trunk/blender/source/blender/blenkernel/intern/cloth.c
    trunk/blender/source/blender/blenkernel/intern/collision.c
    trunk/blender/source/blender/blenkernel/intern/effect.c
    trunk/blender/source/blender/blenkernel/intern/implicit.c
    trunk/blender/source/blender/blenkernel/intern/kdop.c

Modified: trunk/blender/source/blender/blenkernel/BKE_cloth.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_cloth.h	2008-03-13 21:41:28 UTC (rev 14098)
+++ trunk/blender/source/blender/blenkernel/BKE_cloth.h	2008-03-13 22:45:36 UTC (rev 14099)
@@ -35,19 +35,23 @@
 #define BKE_CLOTH_H
 
 #include "float.h"
-#include "BLI_editVert.h"
+
 #include "BLI_linklist.h"
-
-#include "BKE_collision.h"
 #include "BKE_customdata.h"
 #include "BKE_DerivedMesh.h"
 
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_edgehash.h"
+
 #include "DNA_cloth_types.h"
 #include "DNA_customdata_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
 
+#include "BKE_collision.h"
+
 struct Object;
 struct Cloth;
 struct MFace;

Modified: trunk/blender/source/blender/blenkernel/intern/cloth.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/cloth.c	2008-03-13 21:41:28 UTC (rev 14098)
+++ trunk/blender/source/blender/blenkernel/intern/cloth.c	2008-03-13 22:45:36 UTC (rev 14099)
@@ -28,52 +28,22 @@
 * ***** END GPL/BL DUAL LICENSE BLOCK *****
 */
 
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "MEM_guardedalloc.h"
 
-/* types */
-#include "DNA_curve_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
+#include "BKE_cloth.h"
+
 #include "DNA_cloth_types.h"
-#include "DNA_key_types.h"
 #include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_lattice_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_modifier_types.h"
 
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_edgehash.h"
-#include "BLI_linklist.h"
-
-#include "BKE_curve.h"
 #include "BKE_deform.h"
 #include "BKE_DerivedMesh.h"
 #include "BKE_cdderivedmesh.h"
-#include "BKE_displist.h"
 #include "BKE_effect.h"
 #include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_mesh.h"
 #include "BKE_object.h"
-#include "BKE_cloth.h"
 #include "BKE_modifier.h"
 #include "BKE_utildefines.h"
-#include "BKE_DerivedMesh.h"
-#include "BIF_editdeform.h"
-#include "BIF_editkey.h"
-#include "DNA_screen_types.h"
-#include "BSE_headerbuttons.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "mydevice.h"
 
 #include "BKE_pointcache.h"
 
@@ -287,97 +257,6 @@
 	bvh_update(bvh, moving);
 }
 
-DerivedMesh *CDDM_create_tearing ( ClothModifierData *clmd, DerivedMesh *dm )
-{
-	DerivedMesh *result = NULL;
-	unsigned int i = 0, a = 0, j=0;
-	int numverts = dm->getNumVerts ( dm );
-	int numfaces = dm->getNumFaces ( dm );
-
-	MVert *mvert = CDDM_get_verts ( dm );
-	MFace *mface = CDDM_get_faces ( dm );
-
-	MVert *mvert2;
-	MFace *mface2;
-	EdgeHash *edgehash = NULL;
-	Cloth *cloth = clmd->clothObject;
-	ClothSpring *springs = (ClothSpring *)cloth->springs;
-	unsigned int numsprings = cloth->numsprings;
-
-	// create spring tearing hash
-	edgehash = BLI_edgehash_new();
-
-	for ( i = 0; i < numsprings; i++ )
-	{
-		if ( ( springs[i].flags & CLOTH_SPRING_FLAG_DEACTIVATE )
-		&& ( !BLI_edgehash_haskey ( edgehash, springs[i].ij, springs[i].kl ) ) )
-		{
-			BLI_edgehash_insert ( edgehash, springs[i].ij, springs[i].kl, NULL );
-			BLI_edgehash_insert ( edgehash, springs[i].kl, springs[i].ij, NULL );
-			j++;
-		}
-	}
-
-	// printf("found %d tears\n", j);
-
-	result = CDDM_from_template ( dm, numverts, 0, numfaces );
-
-	if ( !result )
-		return NULL;
-
-	// do verts
-	mvert2 = CDDM_get_verts ( result );
-	for ( a=0; a<numverts; a++ )
-	{
-		MVert *inMV;
-		MVert *mv = &mvert2[a];
-
-		inMV = &mvert[a];
-
-		DM_copy_vert_data ( dm, result, a, a, 1 );
-		*mv = *inMV;
-	}
-
-
-	// do faces
-	mface2 = CDDM_get_faces ( result );
-	for ( a=0, i=0; a<numfaces; a++ )
-	{
-		MFace *mf = &mface2[i];
-		MFace *inMF;
-		inMF = &mface[a];
-
-		/*
-		DM_copy_face_data(dm, result, a, i, 1);
-
-		*mf = *inMF;
-		*/
-
-		if ( ( !BLI_edgehash_haskey ( edgehash, mface[a].v1, mface[a].v2 ) )
-				      && ( !BLI_edgehash_haskey ( edgehash, mface[a].v2, mface[a].v3 ) )
-				      && ( !BLI_edgehash_haskey ( edgehash, mface[a].v3, mface[a].v4 ) )
-				      && ( !BLI_edgehash_haskey ( edgehash, mface[a].v4, mface[a].v1 ) ) )
-		{
-			mf->v1 = mface[a].v1;
-			mf->v2 = mface[a].v2;
-			mf->v3 = mface[a].v3;
-			mf->v4 = mface[a].v4;
-
-			test_index_face ( mf, NULL, 0, 4 );
-
-			i++;
-		}
-	}
-
-	CDDM_lower_num_faces ( result, i );
-	CDDM_calc_edges ( result );
-	CDDM_calc_normals ( result );
-
-	BLI_edgehash_free ( edgehash, NULL );
-
-	return result;
-}
-
 int modifiers_indexInObject(Object *ob, ModifierData *md_seek);
 
 int cloth_read_cache(Object *ob, ClothModifierData *clmd, float framenr)

Modified: trunk/blender/source/blender/blenkernel/intern/collision.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/collision.c	2008-03-13 21:41:28 UTC (rev 14098)
+++ trunk/blender/source/blender/blenkernel/intern/collision.c	2008-03-13 22:45:36 UTC (rev 14099)
@@ -30,32 +30,17 @@
 * ***** END GPL/BL DUAL LICENSE BLOCK *****
 */
 
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
 #include "MEM_guardedalloc.h"
-/* types */
-#include "DNA_curve_types.h"
+
+#include "BKE_cloth.h"
+
 #include "DNA_group_types.h"
 #include "DNA_object_types.h"
-#include "DNA_object_force.h"
 #include "DNA_cloth_types.h"	
-#include "DNA_key_types.h"
 #include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_lattice_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_modifier_types.h"
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_edgehash.h"
-#include "BLI_linklist.h"
-#include "BKE_curve.h"
-#include "BKE_deform.h"
+
 #include "BKE_DerivedMesh.h"
-#include "BKE_cdderivedmesh.h"
-#include "BKE_displist.h"
-#include "BKE_effect.h"
 #include "BKE_global.h"
 #include "BKE_mesh.h"
 #include "BKE_object.h"
@@ -63,10 +48,6 @@
 #include "BKE_modifier.h"
 #include "BKE_utildefines.h"
 #include "BKE_DerivedMesh.h"
-#include "DNA_screen_types.h"
-#include "BSE_headerbuttons.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
 #include "mydevice.h"
 
 #include "Bullet-C-Api.h"

Modified: trunk/blender/source/blender/blenkernel/intern/effect.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/effect.c	2008-03-13 21:41:28 UTC (rev 14098)
+++ trunk/blender/source/blender/blenkernel/intern/effect.c	2008-03-13 22:45:36 UTC (rev 14099)
@@ -522,6 +522,8 @@
 			
 		if((pd->flag & PFIELD_USEMAX) && distance>pd->maxdist && pd->forcefield != PFIELD_GUIDE)
 			;	/* don't do anything */
+		else if((pd->flag & PFIELD_USEMIN) && distance<pd->mindist && pd->forcefield != PFIELD_GUIDE)
+			;	/* don't do anything */
 		else if(pd->forcefield == PFIELD_WIND) {
 			VECCOPY(force_vec, ob->obmat[2]);
 			

Modified: trunk/blender/source/blender/blenkernel/intern/implicit.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/implicit.c	2008-03-13 21:41:28 UTC (rev 14098)
+++ trunk/blender/source/blender/blenkernel/intern/implicit.c	2008-03-13 22:45:36 UTC (rev 14099)
@@ -29,38 +29,19 @@
 *
 * ***** END GPL/BL DUAL LICENSE BLOCK *****
 */
-#include "math.h"
-#include "float.h"
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
+
 #include "MEM_guardedalloc.h"
-/* types */
-#include "DNA_curve_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"	
+
+#include "BKE_cloth.h"
+
 #include "DNA_cloth_types.h"	
-#include "DNA_key_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_lattice_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_modifier_types.h"
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_threads.h"
-#include "BKE_curve.h"
-#include "BKE_displist.h"
+
+
 #include "BKE_effect.h"
 #include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_object.h"
 #include "BKE_cloth.h"
-#include "BKE_modifier.h"
 #include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BIF_editdeform.h"
 
 
 #ifdef _WIN32
@@ -1446,6 +1427,7 @@
 				VECADDS(lF[mfaces[i].v1], lF[mfaces[i].v1], wind_normalized, 1.0 / 3.0);
 			}
 			
+			speed[0] = speed[1] = speed[2] = 0.0;
 			pdDoEffectors(effectors, lX[mfaces[i].v2], force, speed, (float)G.scene->r.cfra, 0.0f, PE_WIND_AS_SPEED);
 			VECCOPY(wind_normalized, speed);
 			Normalize(wind_normalized);
@@ -1458,7 +1440,8 @@
 			{
 				VECADDS(lF[mfaces[i].v2], lF[mfaces[i].v2], wind_normalized, 1.0 / 3.0);
 			}
-				
+			
+			speed[0] = speed[1] = speed[2] = 0.0;
 			pdDoEffectors(effectors, lX[mfaces[i].v3], force, speed, (float)G.scene->r.cfra, 0.0f, PE_WIND_AS_SPEED);
 			VECCOPY(wind_normalized, speed);
 			Normalize(wind_normalized);
@@ -1472,6 +1455,7 @@
 				VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], wind_normalized, 1.0 / 3.0);
 			}
 			
+			speed[0] = speed[1] = speed[2] = 0.0;
 			if(mfaces[i].v4)
 			{
 				pdDoEffectors(effectors, lX[i], force, speed, (float)G.scene->r.cfra, 0.0f, PE_WIND_AS_SPEED);

Modified: trunk/blender/source/blender/blenkernel/intern/kdop.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/kdop.c	2008-03-13 21:41:28 UTC (rev 14098)
+++ trunk/blender/source/blender/blenkernel/intern/kdop.c	2008-03-13 22:45:36 UTC (rev 14099)
@@ -30,50 +30,23 @@
 * ***** END GPL/BL DUAL LICENSE BLOCK *****
 */
 
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
 #include "MEM_guardedalloc.h"
-/* types */
-#include "DNA_curve_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
-#include "DNA_cloth_types.h"	
-#include "DNA_key_types.h"
+
+#include "BKE_cloth.h"
+
+#include "DNA_cloth_types.h"
 #include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_lattice_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_modifier_types.h"
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_edgehash.h"
-#include "BLI_linklist.h"
-#include "BKE_curve.h"
+
 #include "BKE_deform.h"
 #include "BKE_DerivedMesh.h"
 #include "BKE_cdderivedmesh.h"
-#include "BKE_displist.h"
 #include "BKE_effect.h"
 #include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_mesh.h"
 #include "BKE_object.h"
-#include "BKE_cloth.h"
 #include "BKE_modifier.h"
 #include "BKE_utildefines.h"
-#include "BKE_DerivedMesh.h"
-#include "BIF_editdeform.h"
-#include "BIF_editkey.h"

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list