[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11656] branches/particles/source/blender: *bugs fixed

Janne Karhu jhkarh at utu.fi
Sat Aug 18 17:36:26 CEST 2007


Revision: 11656
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11656
Author:   jhk
Date:     2007-08-18 17:36:25 +0200 (Sat, 18 Aug 2007)

Log Message:
-----------
*bugs fixed
	-freeing hair particles bake didn't set automatic hair calculation back on correctly
	-bake mode "show times" had wrong tooltip
	-particles weren't updated properly in object edit mode
	-freeing hair with hair sb baked did strange things
	-hair sb crashed on bake with the sb active in bake mode
	-object sb had wrong name in bake mode menu
	-soft body point indexes didn't get saved properly
	-editing hair structure once hair sb is baked disabled
	-changes in vertex groups didn't start autobake
	-preview render crashed on rendering particle strands

Modified Paths:
--------------
    branches/particles/source/blender/blenkernel/intern/dynamics_bake.c
    branches/particles/source/blender/blenkernel/intern/modifier.c
    branches/particles/source/blender/blenkernel/intern/particle.c
    branches/particles/source/blender/blenkernel/intern/softbody.c
    branches/particles/source/blender/blenloader/intern/readfile.c
    branches/particles/source/blender/blenloader/intern/writefile.c
    branches/particles/source/blender/include/BIF_editbake.h
    branches/particles/source/blender/render/intern/source/convertblender.c
    branches/particles/source/blender/src/buttons_editing.c
    branches/particles/source/blender/src/buttons_object.c
    branches/particles/source/blender/src/drawobject.c
    branches/particles/source/blender/src/editbake.c

Modified: branches/particles/source/blender/blenkernel/intern/dynamics_bake.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/dynamics_bake.c	2007-08-18 08:31:48 UTC (rev 11655)
+++ branches/particles/source/blender/blenkernel/intern/dynamics_bake.c	2007-08-18 15:36:25 UTC (rev 11656)
@@ -814,6 +814,10 @@
 		MEM_freeN(bsys->bp_key_index);
 	bsys->bp_key_index=0;
 
+	if(bsys->soft){
+		DB_free_bake(DB_find_bsys(&bsys->ob->bakeable,bsys->soft));
+	}
+
 	bsys->flag &= ~BSYS_DONE;
 }
 void DB_free_bsys(BakeableSystem *bsys)
@@ -1267,6 +1271,8 @@
 
 	if(sb->particles)
 		sprintf(name,"Soft %s",access_BakeableSystem(sb->particles)->name(sb->particles));
+	else
+		sprintf(name,"Soft Body");
 
 	return name;
 }

Modified: branches/particles/source/blender/blenkernel/intern/modifier.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/modifier.c	2007-08-18 08:31:48 UTC (rev 11655)
+++ branches/particles/source/blender/blenkernel/intern/modifier.c	2007-08-18 15:36:25 UTC (rev 11656)
@@ -6375,7 +6375,8 @@
 		mti = INIT_TYPE(ParticleSystem);
 		mti->type = eModifierTypeType_OnlyDeform;
 		mti->flags = eModifierTypeFlag_AcceptsMesh
-					|eModifierTypeFlag_SupportsEditmode;
+					|eModifierTypeFlag_SupportsEditmode
+					|eModifierTypeFlag_EnableInEditmode;
 		mti->initData = particleSystemModifier_initData;
 		mti->freeData = particleSystemModifier_freeData;
 		mti->copyData = particleSystemModifier_copyData;

Modified: branches/particles/source/blender/blenkernel/intern/particle.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/particle.c	2007-08-18 08:31:48 UTC (rev 11655)
+++ branches/particles/source/blender/blenkernel/intern/particle.c	2007-08-18 15:36:25 UTC (rev 11656)
@@ -283,6 +283,10 @@
 {
 	BakeBase *bbase;
 	if(psys){
+		bbase=DB_find_bbase(&ob->bakeable,psys);
+		BLI_remlink(&ob->bakeable,bbase);
+		DB_free_bbase(bbase);
+
 		if(psys->particles){
 			MEM_freeN(psys->particles);
 			psys->particles=0;
@@ -305,9 +309,6 @@
 			MEM_freeN(psys);
 		}
 
-		bbase=DB_find_bbase(&ob->bakeable,psys);
-		BLI_remlink(&ob->bakeable,bbase);
-		DB_free_bbase(bbase);
 	}
 }
 /************************************************/
@@ -1999,7 +2000,6 @@
 	BakeableSystem *bsys;
 
 	/* update all that have same particle settings */
-	/* ..could/should be added to depgraph? */
 	for(base = G.scene->base.first; base; base= base->next) {
 		if(base->object->particlesystem.first) {
 			ob=base->object;

Modified: branches/particles/source/blender/blenkernel/intern/softbody.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/softbody.c	2007-08-18 08:31:48 UTC (rev 11655)
+++ branches/particles/source/blender/blenkernel/intern/softbody.c	2007-08-18 15:36:25 UTC (rev 11656)
@@ -3011,54 +3011,12 @@
 	float data[4], sfra, efra, cfra, dfra, fac;	/* start, end, current, delta */
 	int ofs1, a;
 
-	/* precondition check */
-	//if(sb==NULL || sb->keys==NULL || sb->totkey==0) return 0;
 	/* so we got keys, but no bodypoints... even without simul we need it for the bake */	 
 	if(sb->bpoint==NULL) sb->bpoint= MEM_callocN( sb->totpoint*sizeof(BodyPoint), "bodypoint");	 
  	
 	/* convert cfra time to system time */
-	//sfra= (float)sb->sfra;
 	cfra= bsystem_time(ob, framenr, 0.0);
-	//efra= (float)sb->efra;
-	//dfra= (float)sb->interval;
 
-	///* offset in keys array */
-	//ofs1= (int)floor( (cfra-sfra)/dfra );
-
-	//if(ofs1 < 0) {
-	//	key0=key1=key2=key3= *sb->keys;
-	//}
-	//else if(ofs1 >= sb->totkey-1) {
-	//	key0=key1=key2=key3= *(sb->keys+sb->totkey-1);
-	//}
-	//else {
-	//	key1= *(sb->keys+ofs1);
-	//	key2= *(sb->keys+ofs1+1);
-
-	//	if(ofs1>0) key0= *(sb->keys+ofs1-1);
-	//	else key0= key1;
-	//	
-	//	if(ofs1<sb->totkey-2) key3= *(sb->keys+ofs1+2);
-	//	else key3= key2;
-	//}
-	//
-	//sb->ctime= cfra;	/* needed? */
-	//
-	///* timing */
-	//fac= ((cfra-sfra)/dfra) - (float)ofs1;
-	//CLAMP(fac, 0.0, 1.0);
-	//set_four_ipo(fac, data, KEY_BSPLINE);
-	//if (key0&&key1&&key2&&key3) // may be null because we SHIFT_ESCAPED 
-	//for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++, key0++, key1++, key2++, key3++) {
-	//	bp->pos[0]= data[0]*key0->vec[0] +  data[1]*key1->vec[0] + data[2]*key2->vec[0] + data[3]*key3->vec[0];
-	//	bp->pos[1]= data[0]*key0->vec[1] +  data[1]*key1->vec[1] + data[2]*key2->vec[1] + data[3]*key3->vec[1];
-	//	bp->pos[2]= data[0]*key0->vec[2] +  data[1]*key1->vec[2] + data[2]*key2->vec[2] + data[3]*key3->vec[2];
-	//}
-
-	//for(a=sb->totpoint-1, bp= sb->bpoint; a>=0; a--, bp++) {
-	//	DB_get_key_at_time(bsys,a,cfra,&key,0);
-	//	VECCOPY(bp->pos,key.co);
-	//}
 	for(a=0, bp= sb->bpoint; a<sb->totpoint; a++, bp++) {
 		DB_get_key_at_time(bsys,a,cfra,&key,0);
 		VECCOPY(bp->pos,key.co);
@@ -3068,6 +3026,8 @@
 		softbody_to_object(ob, vertexCos, numVerts, sb->local);
 
 	if(ob==OBACT && G.f & G_BAKEEDIT && bsys->flag&BSYS_CURRENT){
+		if(bsys->edit==0)
+			EB_create_BakeEdit(bsys);
 		EB_iterate_lengths(bsys);
 		EB_apply_lengths(bsys);
 		EB_recalc_wcos(bsys);

Modified: branches/particles/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/particles/source/blender/blenloader/intern/readfile.c	2007-08-18 08:31:48 UTC (rev 11655)
+++ branches/particles/source/blender/blenloader/intern/readfile.c	2007-08-18 15:36:25 UTC (rev 11656)
@@ -2707,11 +2707,11 @@
 	int i;
 
 	for(bbase=bakeable->first; bbase; bbase=bbase->next){
-		bsys=bbase->bsys=newdataadr(fd,bbase->bsys);
+		bsys=bbase->bsys = newdataadr(fd,bbase->bsys);
 		bsys->system = newdataadr(fd, bsys->system);
 		if(bsys->elements){
 			BakeElement *bel;
-			bsys->elements= newdataadr(fd, bsys->elements);
+			bsys->elements = newdataadr(fd, bsys->elements);
 
 			for(i=0,bel=bsys->elements; i<bsys->totbel; i++,bel++){
 				bel->keys=newdataadr(fd, bel->keys);
@@ -2720,12 +2720,12 @@
 		}
 		bsys->soft = newdataadr(fd, bsys->soft);
 		if(bsys->soft) {
-			SoftBody *sb= bsys->soft;		
+			SoftBody *sb = bsys->soft;		
 			
-			sb->bpoint= NULL;	// init pointers so it gets rebuilt nicely
-			sb->bspring= NULL;
-			sb->scratch= NULL;
-			sb->particles=bsys;
+			sb->bpoint = NULL;	// init pointers so it gets rebuilt nicely
+			sb->bspring = NULL;
+			sb->scratch = NULL;
+			sb->particles = bsys;
 
 			
 			sb->keys= newdataadr(fd, sb->keys);
@@ -2736,12 +2736,24 @@
 					sb->keys[a]= newdataadr(fd, sb->keys[a]);
 				}
 			}
+
+			if(bsys->bp_key_index)
+				bsys->bp_key_index = newdataadr(fd, bsys->bp_key_index);
+
+			if(bsys->bp_key_index==0){ /* recreate indexes */
+				BakeElement *bel;
+				int a, *bpi=bsys->bp_key_index=MEM_callocN(bsys->totbel*sizeof(int),"bp key indexes");
+
+				*bpi=0;
+				bpi++;
+				for(a=0, bel=bsys->elements; a<bsys->totbel-1; a++, bel++, bpi++)
+					*bpi=*(bpi-1)+bel->totkey;
+			}
 		}
 
-		bsys->pathcache=bsys->childcache=0;
-		bsys->totcached=bsys->totchildcache=0;
-		bsys->edit=0;
-		bsys->bp_key_index=0;
+		bsys->pathcache = bsys->childcache = 0;
+		bsys->totcached = bsys->totchildcache = 0;
+		bsys->edit = 0;
 	}
 }
 static void lib_link_bakeable(FileData *fd, ID *id, ListBase *bakeable)

Modified: branches/particles/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/particles/source/blender/blenloader/intern/writefile.c	2007-08-18 08:31:48 UTC (rev 11655)
+++ branches/particles/source/blender/blenloader/intern/writefile.c	2007-08-18 15:36:25 UTC (rev 11656)
@@ -909,6 +909,8 @@
 					writestruct(wd, DATA, "SBVertex", sb->totpoint, sb->keys[a]);
 				}
 			}
+			if(bsys->bp_key_index)
+				writedata(wd, DATA, sizeof(int)*bsys->totbel, bsys->bp_key_index);
 		}
 	}
 

Modified: branches/particles/source/blender/include/BIF_editbake.h
===================================================================
--- branches/particles/source/blender/include/BIF_editbake.h	2007-08-18 08:31:48 UTC (rev 11655)
+++ branches/particles/source/blender/include/BIF_editbake.h	2007-08-18 15:36:25 UTC (rev 11656)
@@ -103,6 +103,7 @@
 #define EB_SHOW_TIME		32
 #define EB_ROT_VEL			64
 #define EB_ROT_ROT			128
+#define EB_PARTICLES		256
 
 ///* ParticleEditPath->flag */
 //#define PSYS_EP_ROTVEL		1

Modified: branches/particles/source/blender/render/intern/source/convertblender.c
===================================================================
--- branches/particles/source/blender/render/intern/source/convertblender.c	2007-08-18 08:31:48 UTC (rev 11655)
+++ branches/particles/source/blender/render/intern/source/convertblender.c	2007-08-18 15:36:25 UTC (rev 11656)
@@ -1740,6 +1740,9 @@
 			return 1;
 	}
 
+	if(G.rendering==0)
+		totchild*=part->disp/100;
+
 	psys->flag|=PSYS_DRAWING;
 
 	psmd= psys_get_modifier(ob,psys);
@@ -1809,7 +1812,7 @@
 	}
 	if(part->draw_as==PART_DRAW_PATH){
 		if(path_possible){
-			path_nbr=(int)pow(2.0,(double)bsys->ren_step);
+			path_nbr=(int)pow(2.0,(double)(G.rendering?bsys->ren_step:bsys->draw_step));
 			//if(part->phystype==PART_PHYS_KEYED && (psys->flag&PSYS_BAKED)==0)
 			//	path_nbr*=psys->totkeyed;
 

Modified: branches/particles/source/blender/src/buttons_editing.c
===================================================================
--- branches/particles/source/blender/src/buttons_editing.c	2007-08-18 08:31:48 UTC (rev 11655)
+++ branches/particles/source/blender/src/buttons_editing.c	2007-08-18 15:36:25 UTC (rev 11656)
@@ -5628,23 +5628,25 @@
 
 		edit=bsys->edit;
 
-		uiDefBut(block, LABEL, 0, "Rotate",	butx,buty,butw,buth, NULL, 0.0, 0, 0, 0, "");
 		if(bsys->type==BAKEABLE_PARTICLE){
 			uiBlockBeginAlign(block);
+			uiDefBut(block, LABEL, 0, "Rotate",	butx,buty,butw,buth, NULL, 0.0, 0, 0, 0, "");
 			uiDefButBitS(block, TOG, EB_ROT_ROT, B_BAKE_REDRAWEDIT, "Rotation",	butx,(buty-=buth),butw/2,buth, &edit->flag, 0, 0, 0, 0, "Rotation affects particle rotation");
 			uiDefButBitS(block, TOG, EB_ROT_VEL, B_BAKE_REDRAWEDIT, "Velocity",	butx+butw/2,buty,butw/2,buth, &edit->flag, 0, 0, 0, 0, "Rotation affects particle velocity");
 			uiBlockEndAlign(block);
 		}
-		else
-			uiDefButBitS(block, TOG, EB_ROT_VEL, B_BAKE_REDRAWEDIT, "Velocity",	butx,buty,butw,buth, &edit->flag, 0, 0, 0, 0, "Rotation affects element velocity");
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list