[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42142] trunk/blender/source/blender: Fix part of #29310: secondary point caches for cloth did not get steps

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Nov 24 21:46:07 CET 2011


Revision: 42142
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42142
Author:   blendix
Date:     2011-11-24 20:46:00 +0000 (Thu, 24 Nov 2011)
Log Message:
-----------
Fix part of #29310: secondary point caches for cloth did not get steps
set to correct default, was 10 when supposed to be 1.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_pointcache.h
    trunk/blender/source/blender/blenkernel/intern/pointcache.c
    trunk/blender/source/blender/editors/physics/physics_pointcache.c
    trunk/blender/source/blender/makesrna/intern/rna_object_force.c

Modified: trunk/blender/source/blender/blenkernel/BKE_pointcache.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_pointcache.h	2011-11-24 20:24:03 UTC (rev 42141)
+++ trunk/blender/source/blender/blenkernel/BKE_pointcache.h	2011-11-24 20:46:00 UTC (rev 42142)
@@ -127,6 +127,9 @@
 	unsigned int stack_index;
 	unsigned int flag;
 
+	unsigned int default_step;
+	unsigned int max_step;
+
 	/* flags defined in DNA_object_force.h */
 	unsigned int data_types, info_types;
 

Modified: trunk/blender/source/blender/blenkernel/intern/pointcache.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/pointcache.c	2011-11-24 20:24:03 UTC (rev 42141)
+++ trunk/blender/source/blender/blenkernel/intern/pointcache.c	2011-11-24 20:46:00 UTC (rev 42142)
@@ -770,6 +770,9 @@
 	pid->info_types= 0;
 
 	pid->stack_index = pid->cache->index;
+
+	pid->default_step = 10;
+	pid->max_step = 20;
 }
 void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *psys)
 {
@@ -820,6 +823,9 @@
 		pid->data_types|= (1<<BPHYS_DATA_ROTATION);
 
 	pid->info_types= (1<<BPHYS_DATA_TIMES);
+
+	pid->default_step = 10;
+	pid->max_step = 20;
 }
 void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *clmd)
 {
@@ -850,6 +856,9 @@
 
 	pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY) | (1<<BPHYS_DATA_XCONST);
 	pid->info_types= 0;
+
+	pid->default_step = 1;
+	pid->max_step = 1;
 }
 void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd)
 {
@@ -890,6 +899,9 @@
 		pid->data_types |= (1<<BPHYS_DATA_SMOKE_LOW);
 	if(sds->wt)
 		pid->data_types |= (1<<BPHYS_DATA_SMOKE_HIGH);
+
+	pid->default_step = 1;
+	pid->max_step = 1;
 }
 
 void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid, Object *ob, DynamicPaintSurface *surface)
@@ -923,6 +935,9 @@
 	pid->info_types= 0;
 
 	pid->stack_index = pid->cache->index;
+
+	pid->default_step = 1;
+	pid->max_step = 1;
 }
 
 void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int duplis)

Modified: trunk/blender/source/blender/editors/physics/physics_pointcache.c
===================================================================
--- trunk/blender/source/blender/editors/physics/physics_pointcache.c	2011-11-24 20:24:03 UTC (rev 42141)
+++ trunk/blender/source/blender/editors/physics/physics_pointcache.c	2011-11-24 20:46:00 UTC (rev 42142)
@@ -321,7 +321,9 @@
 	
 	for(pid=pidlist.first; pid; pid=pid->next) {
 		if(pid->cache == cache) {
-			*(pid->cache_ptr) = BKE_ptcache_add(pid->ptcaches);
+			PointCache *cache = BKE_ptcache_add(pid->ptcaches);
+			cache->step = pid->default_step;
+			*(pid->cache_ptr) = cache;
 			break;
 		}
 	}

Modified: trunk/blender/source/blender/makesrna/intern/rna_object_force.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_object_force.c	2011-11-24 20:24:03 UTC (rev 42141)
+++ trunk/blender/source/blender/makesrna/intern/rna_object_force.c	2011-11-24 20:46:00 UTC (rev 42142)
@@ -214,21 +214,16 @@
 
 static void rna_Cache_list_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Object *ob = ptr->id.data;
 	PointCache *cache= ptr->data;
-	PTCacheID *pid;
-	ListBase pidlist;
+	ListBase lb;
 
-	BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
+	while(cache->prev)
+		cache= cache->prev;
 
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pid->cache == cache) {
-			rna_iterator_listbase_begin(iter, pid->ptcaches, NULL);
-			break;
-		}
-	}
+	lb.first= cache;
+	lb.last= NULL; /* not used by listbase_begin */
 
-	BLI_freelistN(&pidlist);
+	rna_iterator_listbase_begin(iter, &lb, NULL);
 }
 static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min, int *max)
 {
@@ -308,8 +303,7 @@
 	
 	for(pid=pidlist.first; pid; pid=pid->next) {
 		if(pid->cache == cache) {
-			if(ELEM3(pid->type, PTCACHE_TYPE_CLOTH, PTCACHE_TYPE_SMOKE_DOMAIN, PTCACHE_TYPE_SMOKE_HIGHRES))
-				*max= 1;
+			*max= pid->max_step;
 			break;
 		}
 	}




More information about the Bf-blender-cvs mailing list