[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21361] branches/blender2.5/blender: A bunch of fun stuff now possible because of new pointcache code:

Janne Karhu jhkarh at utu.fi
Sat Jul 4 05:50:14 CEST 2009


Revision: 21361
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21361
Author:   jhk
Date:     2009-07-04 05:50:12 +0200 (Sat, 04 Jul 2009)

Log Message:
-----------
A bunch of fun stuff now possible because of new pointcache code:
* Baked normal particles can now use the "Path" visualization.
* Path "max length" & "abs length" are now history:
	- New option to set path start & end times + random variation to length.
	- Much more flexible (and calculated better) than previous options.
	- This works with parents, children, hair & normal particles unlike old length option.
	- Only known issue for now is that children from faces don't get calculated correctly when using path start time.
* New option "trails" for "halo", "line" and "billboard" visualizations:
	- Draws user controllable number of particle instances along particles path backwards from current position.
	- Works with children too for cool/weird visualizations that weren't possible before.
* Normal particle children's velocities are now approximated better when needed so that "line" visualization trails will look nice.
* New particle instance modifier options:
	- "path"-option works better and has controllable (max)position along path (with random variation possible).
	- "keep shape"-option for hair, keyed, or baked particles allows to place the instances to a single point (with random variation possible) along particle path.
	- "axis" option to make rotation handling better (still not perfect, but will have to do for now).

Some fixes & cleanup done along the way:
* Random path length didn't work for non-child particles.
* Cached & unborn particles weren't reset to emit locations.
* Particle numbers weren't drawn in the correct place.
* Setting proper render & draw visualizations was lost somewhere when initializing new particle settings.
* Changing child mode wasn't working correctly.
* Some cleanup & modularization of particle child effector code and particle drawing & rendering code.
* Object & group visualizations didn't work.
* Child simplification didn't work.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_data_modifier.py
    branches/blender2.5/blender/release/ui/buttons_particle.py
    branches/blender2.5/blender/source/blender/blenkernel/BKE_particle.h
    branches/blender2.5/blender/source/blender/blenkernel/intern/anim.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/depsgraph.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/modifier.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/particle.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/particle_system.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/pointcache.c
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_templates.c
    branches/blender2.5/blender/source/blender/editors/object/object_modifier.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/drawobject.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_modifier_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_particle_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_modifier.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_particle.c
    branches/blender2.5/blender/source/blender/render/intern/source/convertblender.c

Modified: branches/blender2.5/blender/release/ui/buttons_data_modifier.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_modifier.py	2009-07-04 00:33:50 UTC (rev 21360)
+++ branches/blender2.5/blender/release/ui/buttons_data_modifier.py	2009-07-04 03:50:12 UTC (rev 21361)
@@ -300,10 +300,19 @@
 		col.itemR(md, "normal")
 		col.itemR(md, "children")
 		col.itemR(md, "path")
+		if md.path:
+			col.itemR(md, "keep_shape")
 		col.itemR(md, "unborn")
 		col.itemR(md, "alive")
 		col.itemR(md, "dead")
+		if md.path:
+			col.itemR(md, "axis", text="")
 		
+		if md.path:
+			row = layout.row()
+			row.itemR(md, "position", slider=True)
+			row.itemR(md, "random_position", text = "Random", slider=True)
+		
 	def particlesystem(self, layout, ob, md):
 		layout.itemL(text="See Particle panel.")
 		

Modified: branches/blender2.5/blender/release/ui/buttons_particle.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_particle.py	2009-07-04 00:33:50 UTC (rev 21360)
+++ branches/blender2.5/blender/release/ui/buttons_particle.py	2009-07-04 03:50:12 UTC (rev 21361)
@@ -353,19 +353,14 @@
 			colsub.itemR(part, "adaptive_pix")
 			sub.itemR(part, "hair_bspline")
 			sub.itemR(part, "render_step", text="Steps")
-			sub = split.column()
-			sub.itemL(text="Length:")
-			sub.itemR(part, "abs_length", text="Absolute")
-			sub.itemR(part, "absolute_length", text="Maximum")
+			sub = split.column()	
+
+			sub.itemL(text="Timing:")
+			sub.itemR(part, "abs_path_time")
+			sub.itemR(part, "path_start", text="Start", slider= not part.abs_path_time)
+			sub.itemR(part, "path_end", text="End", slider= not part.abs_path_time)		
 			sub.itemR(part, "random_length", text="Random", slider=True)
 			
-			#row = layout.row()
-			#row.itemR(part, "timed_path")
-			#col = row.column(align=True)
-			#col.active = part.timed_path == True
-			#col.itemR(part, "line_length_tail", text="Start")
-			#col.itemR(part, "line_length_head", text="End")
-			
 			row = layout.row()
 			col = row.column()
 			
@@ -384,7 +379,6 @@
 			
 
 		elif part.ren_as == 'OBJECT':
-			#sub = split.column()
 			sub.itemR(part, "dupli_object")
 		elif part.ren_as == 'GROUP':
 			sub.itemR(part, "dupli_group")
@@ -428,7 +422,19 @@
 			row.itemR(part, "billboard_animation", expand=True)
 			row.itemL(text="Offset:")
 			row.itemR(part, "billboard_split_offset", expand=True)
-		
+		if part.ren_as == 'HALO' or part.ren_as == 'LINE' or part.ren_as=='BILLBOARD':
+			row = layout.row()
+			col = row.column()
+			col.itemR(part, "trail_count")
+			if part.trail_count > 1:
+				col.itemR(part, "abs_path_time", text="Length in frames")
+				col = row.column()
+				col.itemR(part, "path_end", text="Length", slider=not part.abs_path_time)
+				col.itemR(part, "random_length", text="Random", slider=True)
+			else:
+				col = row.column()
+				col.itemL(text="")
+				
 class PARTICLE_PT_draw(ParticleButtonsPanel):
 	__idname__= "PARTICLE_PT_draw"
 	__label__ = "Display"
@@ -475,11 +481,12 @@
 			col.itemR(part, "draw_health")
 		
 		col = row.column()
+		col.itemR(part, "material_color", text="Use material color")
+		
 		if (path):
 			box = col.box()				
 			box.itemR(part, "draw_step")
 		else:
-			col.itemR(part, "material_color", text="Use material color")
 			subcol = col.column()
 			subcol.active = part.material_color==False
 			#subcol.itemL(text="color")

Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_particle.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_particle.h	2009-07-04 00:33:50 UTC (rev 21360)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_particle.h	2009-07-04 03:50:12 UTC (rev 21361)
@@ -91,7 +91,8 @@
 	float ivel;							/* used in reset */
 	float time, life, exist, size;		/* used in init */
 	float pvel[3];						/* used in physics */
-	float length, clump, kink, rough;	/* used in path caching */
+	float length, clump, kink, effector;/* used in path caching */
+	float rough1, rough2, roughe;		/* used in path caching */
 } ParticleTexture;
 
 typedef struct BoidVecFunc{
@@ -270,7 +271,7 @@
 int do_guide(struct Scene *scene, struct ParticleKey *state, int pa_num, float time, struct ListBase *lb);
 float psys_get_size(struct Object *ob, struct Material *ma, struct ParticleSystemModifierData *psmd, struct IpoCurve *icu_size, struct ParticleSystem *psys, struct ParticleSettings *part, struct ParticleData *pa, float *vg_size);
 float psys_get_timestep(struct ParticleSettings *part);
-float psys_get_child_time(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra);
+float psys_get_child_time(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *birthtime, float *dietime);
 float psys_get_child_size(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *pa_time);
 void psys_get_particle_on_path(struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, int pa_num, struct ParticleKey *state, int vel);
 int psys_get_particle_state(struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, int p, struct ParticleKey *state, int always);

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/anim.c	2009-07-04 00:33:50 UTC (rev 21360)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/anim.c	2009-07-04 03:50:12 UTC (rev 21361)
@@ -786,8 +786,9 @@
 	BLI_srandom(31415926 + psys->seed);
 	
 	lay= scene->lay;
-	if((part->draw_as == PART_DRAW_OB && part->dup_ob) ||
-		(part->draw_as == PART_DRAW_GR && part->dup_group && part->dup_group->gobject.first)) {
+	if((psys->renderdata || part->draw_as==PART_DRAW_REND) &&
+		((part->ren_as == PART_DRAW_OB && part->dup_ob) ||
+		(part->ren_as == PART_DRAW_GR && part->dup_group && part->dup_group->gobject.first))) {
 
 		/* if we have a hair particle system, use the path cache */
 		if(part->type == PART_HAIR) {
@@ -804,7 +805,7 @@
 		psys->lattice = psys_get_lattice(scene, par, psys);
 
 		/* gather list of objects or single object */
-		if(part->draw_as==PART_DRAW_GR) {
+		if(part->ren_as==PART_DRAW_GR) {
 			group_handle_recalc_and_update(scene, par, part->dup_group);
 
 			for(go=part->dup_group->gobject.first; go; go=go->next)
@@ -850,7 +851,7 @@
 				size = psys_get_child_size(psys, cpa, ctime, 0);
 			}
 
-			if(part->draw_as==PART_DRAW_GR) {
+			if(part->ren_as==PART_DRAW_GR) {
 				/* for groups, pick the object based on settings */
 				if(part->draw&PART_DRAW_RAND_GR)
 					b= BLI_rand() % totgroup;
@@ -894,7 +895,7 @@
 				pamat[3][3]= 1.0f;
 			}
 
-			if(part->draw_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
+			if(part->ren_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
 				for(go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) {
 					Mat4MulMat4(tmat, oblist[b]->obmat, pamat);
 					Mat4MulFloat3((float *)tmat, size*scale);
@@ -930,7 +931,7 @@
 		}
 
 		/* restore objects since they were changed in where_is_object_time */
-		if(part->draw_as==PART_DRAW_GR) {
+		if(part->ren_as==PART_DRAW_GR) {
 			for(a=0; a<totgroup; a++)
 				*(oblist[a])= obcopylist[a];
 		}

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/depsgraph.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/depsgraph.c	2009-07-04 00:33:50 UTC (rev 21360)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/depsgraph.c	2009-07-04 03:50:12 UTC (rev 21361)
@@ -568,14 +568,14 @@
 				dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Keyed Physics");
 			}
 
-			if(part->draw_as == PART_DRAW_OB && part->dup_ob) {
+			if(part->ren_as == PART_DRAW_OB && part->dup_ob) {
 				node2 = dag_get_node(dag, part->dup_ob);
 				dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Object Visualisation");
 				if(part->dup_ob->type == OB_MBALL)
 					dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA, "Particle Object Visualisation");
 			}
 
-			if(part->draw_as == PART_DRAW_GR && part->dup_group) {
+			if(part->ren_as == PART_DRAW_GR && part->dup_group) {
 				for(go=part->dup_group->gobject.first; go; go=go->next) {
 					node2 = dag_get_node(dag, go->ob);
 					dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Group Visualisation");

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/modifier.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/modifier.c	2009-07-04 00:33:50 UTC (rev 21360)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/modifier.c	2009-07-04 03:50:12 UTC (rev 21361)
@@ -6390,6 +6390,7 @@
 		  }
 
 		  if(psys){
+			  psmd->flag &= ~eParticleSystemFlag_psys_updated;
 			  particle_system_update(md->scene, ob, psys);
 			  psmd->flag |= eParticleSystemFlag_psys_updated;
 			  psmd->flag &= ~eParticleSystemFlag_DM_changed;
@@ -6421,6 +6422,8 @@
 	pimd->flag = eParticleInstanceFlag_Parents|eParticleInstanceFlag_Unborn|
 			eParticleInstanceFlag_Alive|eParticleInstanceFlag_Dead;
 	pimd->psys = 1;
+	pimd->position = 1.0f;
+	pimd->axis = 2;
 
 }
 static void particleInstanceModifier_copyData(ModifierData *md, ModifierData *target)
@@ -6431,6 +6434,8 @@
 	tpimd->ob = pimd->ob;
 	tpimd->psys = pimd->psys;
 	tpimd->flag = pimd->flag;
+	tpimd->position = pimd->position;
+	tpimd->random_position = pimd->random_position;
 }
 
 static int particleInstanceModifier_dependsOnTime(ModifierData *md) 
@@ -6470,7 +6475,7 @@
 	MFace *mface, *orig_mface;
 	MVert *mvert, *orig_mvert;
 	int i,totvert, totpart=0, totface, maxvert, maxface, first_particle=0;
-	short track=ob->trackflag%3, trackneg;
+	short track=ob->trackflag%3, trackneg, axis = pimd->axis;
 	float max_co=0.0, min_co=0.0, temp_co[3], cross[3];
 
 	trackneg=((ob->trackflag>2)?1:0);
@@ -6508,7 +6513,7 @@
 
 	psys->lattice=psys_get_lattice(md->scene, ob, psys);
 
-	if(psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED)){
+	if(psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED){
 
 		float min_r[3], max_r[3];
 		INIT_MINMAX(min_r, max_r);
@@ -6533,33 +6538,50 @@
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list