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

Janne Karhu jhkarh at utu.fi
Tue Jul 17 19:51:12 CEST 2007


Revision: 11298
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11298
Author:   jhk
Date:     2007-07-17 19:51:11 +0200 (Tue, 17 Jul 2007)

Log Message:
-----------
*bugs fixed:
	-billboard target object wasn't loaded correctly
	-boids didn't die properly if they were killed by predators
	-baking in object/geometry space updated emitter location
	-drawing/rendering baked steps didn't work properly
	-"none" physics killed particles on backwards timestep
*new things:
	-vgroup channels to control tangential initial velocity & direction (for direction 0.5 weight is the "normal" direction)
	-particles update better on vgroup changes
	-autobaking in object & geometry space has option to re-bake on frame changes too (should be quite equal to the old particles' "animated statics")
	-code cleanup

Modified Paths:
--------------
    branches/particles/source/blender/blenkernel/BKE_particle.h
    branches/particles/source/blender/blenkernel/intern/depsgraph.c
    branches/particles/source/blender/blenkernel/intern/modifier.c
    branches/particles/source/blender/blenkernel/intern/object.c
    branches/particles/source/blender/blenkernel/intern/particle.c
    branches/particles/source/blender/blenkernel/intern/particle_edit.c
    branches/particles/source/blender/blenkernel/intern/particle_system.c
    branches/particles/source/blender/blenloader/intern/readfile.c
    branches/particles/source/blender/include/butspace.h
    branches/particles/source/blender/makesdna/DNA_particle_types.h
    branches/particles/source/blender/src/buttons_editing.c
    branches/particles/source/blender/src/buttons_object.c
    branches/particles/source/blender/src/drawobject.c

Modified: branches/particles/source/blender/blenkernel/BKE_particle.h
===================================================================
--- branches/particles/source/blender/blenkernel/BKE_particle.h	2007-07-17 12:09:36 UTC (rev 11297)
+++ branches/particles/source/blender/blenkernel/BKE_particle.h	2007-07-17 17:51:11 UTC (rev 11298)
@@ -210,7 +210,7 @@
 
 /* particle_system.c */
 void initialize_particle(struct ParticleData *pa, int p, Object *ob, struct ParticleSystem *psys, struct ParticleSystemModifierData *psmd);
-void reset_particle(struct ParticleData *pa, struct ParticleSystem *psys, struct ParticleSystemModifierData *psmd, struct Object *ob, float dtime, float cfra, float *vg_vel);
+void reset_particle(struct ParticleData *pa, struct ParticleSystem *psys, struct ParticleSystemModifierData *psmd, struct Object *ob, float dtime, float cfra, float *vg_vel, float *vg_tan, float *vg_rot);
 
 /* particle_edit.c */
 void pe_free_edit_path(struct ParticleSystem *psys);

Modified: branches/particles/source/blender/blenkernel/intern/depsgraph.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/depsgraph.c	2007-07-17 12:09:36 UTC (rev 11297)
+++ branches/particles/source/blender/blenkernel/intern/depsgraph.c	2007-07-17 17:51:11 UTC (rev 11298)
@@ -1805,15 +1805,6 @@
 	}
 	else if(modifiers_isSoftbodyEnabled(ob)) ob->recalc |= OB_RECALC_DATA;
 	else if(object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
-	else if(ob->totpart){
-		int i;
-		for(i=0; i<ob->totpart; i++){
-			if(ob->particleSystem[i]->flag & PSYS_ENABLED){
-				ob->recalc |= OB_RECALC_DATA;
-				break;
-			}
-		}
-	}
 	else {
 		Mesh *me;
 		Curve *cu;
@@ -1874,6 +1865,16 @@
 				if(ob->transflag & OB_DUPLI) ob->recalc |= OB_RECALC_DATA;
 				break;
 		}
+
+		if(ob->totpart){
+			int i;
+			for(i=0; i<ob->totpart; i++){
+				if(ob->particleSystem[i]->flag & PSYS_ENABLED){
+					ob->recalc |= OB_RECALC_DATA;
+					break;
+				}
+			}
+		}
 	}		
 }
 

Modified: branches/particles/source/blender/blenkernel/intern/modifier.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/modifier.c	2007-07-17 12:09:36 UTC (rev 11297)
+++ branches/particles/source/blender/blenkernel/intern/modifier.c	2007-07-17 17:51:11 UTC (rev 11298)
@@ -4961,7 +4961,7 @@
 	else
 		return;
 	
-	if(psys->flag & PSYS_NO_STEP || (psys->flag&PSYS_ENABLED)==0)
+	if((psys->flag&PSYS_ENABLED)==0)
 		return;
 
 	if(dm==0){

Modified: branches/particles/source/blender/blenkernel/intern/object.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/object.c	2007-07-17 12:09:36 UTC (rev 11297)
+++ branches/particles/source/blender/blenkernel/intern/object.c	2007-07-17 17:51:11 UTC (rev 11298)
@@ -2211,7 +2211,7 @@
 				int i;
 				for(i=0; i<ob->totpart; i++){
 					ParticleSystem *psys=ob->particleSystem[i];
-					if((psys->flag & PSYS_NO_STEP)==0)
+					if(psys->flag & PSYS_ENABLED)
 						particle_system_update(ob,psys);
 				}
 			}
@@ -2222,12 +2222,12 @@
 		/* every time an update for particles comes along. This has to be after modifier stack	*/
 		/* so that mesh changes are updated to the particles system allways -jahka				*/
 /*
-		if(ob->recalc & OB_RECALC_PART){
+		if(ob->recalc & OB_RECALC_PHYS){
 			if(ob->particleSystem){
 				int i;
 				for(i=0; i<ob->totpart; i++){
 					ParticleSystem *psys=ob->particleSystem[i];
-					if((psys->flag & PSYS_NO_STEP)==0)
+					if(psys->flag & PSYS_ENABLED)
 						particle_system_update(ob,psys);
 				}
 			}

Modified: branches/particles/source/blender/blenkernel/intern/particle.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/particle.c	2007-07-17 12:09:36 UTC (rev 11297)
+++ branches/particles/source/blender/blenkernel/intern/particle.c	2007-07-17 17:51:11 UTC (rev 11298)
@@ -980,7 +980,7 @@
 
 	CLAMP(time,0.0,1.0);
 
-	if(shape!=0.0f && (type&PART_KINK_BRAID)==0) {
+	if(shape!=0.0f && type!=PART_KINK_BRAID) {
 		if(shape<0.0f)
 			time= (float)pow(time, 1.0+shape);
 		else
@@ -3015,24 +3015,13 @@
 			offset_child(cpa, key1, state, part->childflat, part->childrad);
 			
 			CLAMP(t,0.0,1.0);
-			if(part->kink)			/*TODO: part->kink_freq*pa_kink*/
+			if(part->kink)			/* TODO: part->kink_freq*pa_kink */
 				do_prekink(state,key1,t,part->kink_freq,part->kink_shape,part->kink_amp,part->kink,part->kink_axis,ob->obmat);
+			
+			/* TODO: pa_clump vgroup */
+			do_clump(state,key1,t,part->clumpfac,part->clumppow,0);
 
-			if(part->clumpfac!=0.0){/*TODO_*pa_clump*/
-				float clumppow;
-				if(part->clumppow<0.0)
-					clumppow=1.0f+part->clumppow;
-				else
-					clumppow=1.0f+9.0f*part->clumppow;
-
-				if(part->clumpfac<0.0)
-					clump= -part->clumpfac*(float)pow(1.0-(double)t,(double)clumppow);
-				else
-					clump= part->clumpfac*(float)pow((double)t,(double)clumppow);
-				VecLerpf(state->co,state->co,key1->co,clump);
-			}
-
-			if(part->kink)			/*TODO: part->kink_freq*pa_kink*/
+			if(part->kink)			/* TODO: part->kink_freq*pa_kink */
 				do_postkink(state,key1,t,part->kink_freq,part->kink_shape,part->kink_amp,part->kink,part->kink_axis,ob->obmat);
 
 		}

Modified: branches/particles/source/blender/blenkernel/intern/particle_edit.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/particle_edit.c	2007-07-17 12:09:36 UTC (rev 11297)
+++ branches/particles/source/blender/blenkernel/intern/particle_edit.c	2007-07-17 17:51:11 UTC (rev 11298)
@@ -896,7 +896,7 @@
 	else G.f |= G_PARTICLEEDIT;
 
 	allqueue(REDRAWVIEW3D, 1);	/* including header */
-	allqueue(REDRAWBUTSEDIT, 0);
+	allqueue(REDRAWBUTSOBJECT, 0);
 
 	if(G.f & G_PARTICLEEDIT){
 		pe_create_edit_path(ob,psys,1);
@@ -1836,7 +1836,7 @@
 			mface=psmd->dm->getFaceData(psmd->dm,pa->num,CD_MFACE);
 			
 			initialize_particle(pa,i,ob,psys,psmd);
-			reset_particle(pa,psys,psmd,ob,0.0,1.0,0);
+			reset_particle(pa,psys,psmd,ob,0.0,1.0,0,0,0);
 			
 			framestep = pa->lifetime/(float)(ep->totaddkey-1);
 

Modified: branches/particles/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/particle_system.c	2007-07-17 12:09:36 UTC (rev 11297)
+++ branches/particles/source/blender/blenkernel/intern/particle_system.c	2007-07-17 17:51:11 UTC (rev 11298)
@@ -1164,12 +1164,13 @@
 	}
 }
 /* sets particle to the emitter surface with initial velocity & rotation */
-void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifierData *psmd, Object *ob, float dtime, float cfra, float *vg_vel){
+void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifierData *psmd, Object *ob,
+					float dtime, float cfra, float *vg_vel, float *vg_tan, float *vg_rot){
 	ParticleSettings *part;
 	ParticleTexture ptex;
 	ParticleKey state;
 	IpoCurve *icu=0;
-	float nor[3],loc[3],tloc[3],vel[3]={0.0,0.0,0.0},rot[4],*q2=0;
+	float fac, nor[3],loc[3],tloc[3],vel[3]={0.0,0.0,0.0},rot[4],*q2=0;
 	float r_vel[3],r_ave[3],r_rot[4],p_vel[3]={0.0,0.0,0.0};
 	float x_vec[3]={1.0,0.0,0.0}, utan[3]={0.0,1.0,0.0}, vtan[3]={0.0,0.0,1.0};
 
@@ -1208,7 +1209,7 @@
 	}
 	else{
 		/* get precise emitter matrix if particle is born */
-		if(pa->time < cfra && pa->time >= psys->cfra)
+		if(psys->bakespace==PSYS_SPACE_WORLD && pa->time < cfra && pa->time >= psys->cfra)
 			where_is_object_time(ob,pa->time);
 
 		/* get birth location from object		*/
@@ -1237,8 +1238,10 @@
 
 		/* -tangent								*/
 		if(part->tanfac!=0.0){
-			VecMulf(vtan,-(float)cos(M_PI*part->tanphase));
-			VECADDFAC(vtan,vtan,utan,-(float)sin(M_PI*part->tanphase));
+			float phase=vg_rot?2.0f*(psys_interpolate_value_from_verts(psmd->dm,part->from,pa->num,pa->fuv,vg_rot)-0.5f):0.0f;
+			VecMulf(vtan,-(float)cos(M_PI*(part->tanphase+phase)));
+			fac=-(float)sin(M_PI*(part->tanphase+phase));
+			VECADDFAC(vtan,vtan,utan,fac);
 
 			VECADD(vtan,tloc,vtan);
 			Mat4MulVecfl(ob->obmat,vtan);
@@ -1289,7 +1292,7 @@
 	
 	/*		*emitter tangent				*/
 	if(part->tanfac!=0.0)
-		VECADDFAC(vel,vel,vtan,part->tanfac);
+		VECADDFAC(vel,vel,vtan,part->tanfac*(vg_tan?psys_interpolate_value_from_verts(psmd->dm,part->from,pa->num,pa->fuv,vg_tan):1.0f));
 
 	/*		*texture						*/
 	/* TODO	*/
@@ -1390,9 +1393,11 @@
 	ParticleData *pa;
 	int p, totpart=psys->totpart;
 	float *vg_vel=psys_cache_vgroup(psmd->dm,psys,PSYS_VG_VEL);
+	float *vg_tan=psys_cache_vgroup(psmd->dm,psys,PSYS_VG_TAN);
+	float *vg_rot=psys_cache_vgroup(psmd->dm,psys,PSYS_VG_ROT);
 
 	for(p=from, pa=psys->particles+from; p<totpart; p++, pa++)
-		reset_particle(pa, psys, psmd, ob, dtime, cfra, vg_vel);
+		reset_particle(pa, psys, psmd, ob, dtime, cfra, vg_vel, vg_tan, vg_rot);
 
 	if(vg_vel)
 		MEM_freeN(vg_vel);
@@ -2129,7 +2134,7 @@
 				if(ec->ob->particleSystem){
 					/* temporarily disable object's particle systems */
 					for(i=0; i<ob->totpart; i++){
-						ob->particleSystem[i]->flag |= PSYS_NO_STEP;
+						ob->particleSystem[i]->flag &= ~PSYS_ENABLED;
 					}
 				}
 				dm=mesh_get_derived_final(ec->ob,0);
@@ -2137,7 +2142,7 @@
 				if(ec->ob->particleSystem){
 					/* enable object's particle systems again */
 					for(i=0; i<ob->totpart; i++){
-						ob->particleSystem[i]->flag &= ~PSYS_NO_STEP;
+						ob->particleSystem[i]->flag |= PSYS_ENABLED;
 					}
 				}
 			}
@@ -2256,7 +2261,7 @@
 			eob= ec->ob;
 			if(ec->type & PSYS_EC_EFFECTOR){
 				pd=eob->pd;
-				if(psys->part->integrator)
+				if(psys->bakespace==PSYS_SPACE_WORLD && psys->part->integrator)
 					where_is_object_time(eob,cfra);
 				/* Get IPO force strength and fall off values here */
 				//if (has_ipo_code(eob->ipo, OB_PD_FSTR))
@@ -2549,7 +2554,7 @@
 		if(ob->particleSystem){
 			/* temporarily disable object's particle systems */
 			for(i=0; i<ob->totpart; i++){
-				ob->particleSystem[i]->flag |= PSYS_NO_STEP;
+				ob->particleSystem[i]->flag &= ~PSYS_ENABLED;
 			}
 		}
 		dm=mesh_get_derived_final(ob,0);
@@ -2559,7 +2564,7 @@
 		if(ob->particleSystem){
 			/* enable object's particle systems again */
 			for(i=0; i<ob->totpart; i++){
-				ob->particleSystem[i]->flag &= ~PSYS_NO_STEP;
+				ob->particleSystem[i]->flag |= PSYS_ENABLED;
 			}
 		}
 
@@ -2773,7 +2778,7 @@
 				if(ob->particleSystem){

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list