[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13729] trunk/blender/source/blender: " From particles" children are again allowed for non-hair/keyed particles, although with some limitations like no separate render amount or rough/ branching values.

Janne Karhu jhkarh at utu.fi
Sun Feb 17 19:33:22 CET 2008


Revision: 13729
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13729
Author:   jhk
Date:     2008-02-17 19:33:20 +0100 (Sun, 17 Feb 2008)

Log Message:
-----------
"From particles" children are again allowed for non-hair/keyed particles, although with some limitations like no separate render amount or rough/branching values.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/particle.c
    trunk/blender/source/blender/src/buttons_object.c

Modified: trunk/blender/source/blender/blenkernel/intern/particle.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle.c	2008-02-17 18:09:53 UTC (rev 13728)
+++ trunk/blender/source/blender/blenkernel/intern/particle.c	2008-02-17 18:33:20 UTC (rev 13729)
@@ -465,6 +465,8 @@
 		return;
 	if(psys->renderdata)
 		return;
+	if(psys->part->draw_as!=PART_DRAW_PATH)
+		return;
 
 	data= MEM_callocN(sizeof(ParticleRenderData), "ParticleRenderData");
 
@@ -505,6 +507,8 @@
 	data= psys->renderdata;
 	if(!data)
 		return;
+	if(psys->part->draw_as!=PART_DRAW_PATH)
+		return;
 	
 	if(data->elems)
 		MEM_freeN(data->elems);
@@ -3580,32 +3584,34 @@
 		return 1;
 	}
 	else{
-		//if(psys->totchild && p>=psys->totpart){
-		//	ChildParticle *cpa=psys->child+p-psys->totpart;
-		//	ParticleKey *key1, skey;
-		//	float t=(cfra-pa->time)/pa->lifetime, clump;
+		if(between)
+			return 0; /* currently not supported */
+		else if(psys->totchild && p>=psys->totpart){
+			ChildParticle *cpa=psys->child+p-psys->totpart;
+			ParticleKey *key1, skey;
+			float t = (cfra - pa->time + pa->loop * pa->lifetime) / pa->lifetime, clump;
 
-		//	pa=psys->particles+cpa->parent;
+			pa = psys->particles + cpa->parent;
 
-		//	if(pa->alive==PARS_DEAD && part->flag&PART_STICKY && pa->flag&PARS_STICKY && pa->stick_ob){
-		//		key1=&skey;
-		//		copy_particle_key(key1,&pa->state,0);
-		//		key_from_object(pa->stick_ob,key1);
-		//	}
-		//	else{
-		//		key1=&pa->state;
-		//	}
-		//	
-		//	offset_child(cpa, key1, state, part->childflat, part->childrad);
-		//	
-		//	CLAMP(t,0.0,1.0);
-		//	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);
-		//}
-		//else{
+			if(pa->alive==PARS_DEAD && part->flag&PART_STICKY && pa->flag&PARS_STICKY && pa->stick_ob) {
+				key1 = &skey;
+				copy_particle_key(key1,&pa->state,0);
+				key_from_object(pa->stick_ob,key1);
+			}
+			else {
+				key1=&pa->state;
+			}
+			
+			offset_child(cpa, key1, state, part->childflat, part->childrad);
+			
+			CLAMP(t,0.0,1.0);
+			if(part->kink)			/* TODO: part->kink_freq*pa_kink */
+				do_prekink(state,key1,key1->rot,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,1.0);
+		}
+		else{
 			if (pa) { /* TODO PARTICLE - should this ever be NULL? - Campbell */
 				copy_particle_key(state,&pa->state,0);
 
@@ -3616,7 +3622,7 @@
 				if(psys->lattice)
 					calc_latt_deform(state->co,1.0f);
 			}
-		//}
+		}
 		
 		return 1;
 	}

Modified: trunk/blender/source/blender/src/buttons_object.c
===================================================================
--- trunk/blender/source/blender/src/buttons_object.c	2008-02-17 18:09:53 UTC (rev 13728)
+++ trunk/blender/source/blender/src/buttons_object.c	2008-02-17 18:33:20 UTC (rev 13729)
@@ -3983,7 +3983,7 @@
 
 	if(part->childtype==0) return;
 
-	if((psys->flag&(PSYS_HAIR_DONE|PSYS_KEYED))==0) {
+	if(part->childtype==PART_CHILD_FACES && (psys->flag&(PSYS_HAIR_DONE|PSYS_KEYED))==0) {
 		uiDefBut(block, LABEL, 0, "Hair or keyed",	butx,(buty-=2*buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
 		uiDefBut(block, LABEL, 0, "particles needed!",	butx,(buty-=2*buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
 		return;
@@ -3994,7 +3994,9 @@
 	buty -= buth/2;
 	
 	uiDefButI(block, NUM, B_PART_ALLOC_CHILD, "Amount:", butx,(buty-=buth),butw,buth, &part->child_nbr, 0.0, MAX_PART_CHILDREN, 0, 0, "Amount of children/parent");
-	uiDefButI(block, NUM, B_DIFF, "Render Amount:", butx,(buty-=buth),butw,buth, &part->ren_child_nbr, 0.0, MAX_PART_CHILDREN, 0, 0, "Amount of children/parent for rendering");
+	if(psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED))
+		uiDefButI(block, NUM, B_DIFF, "Render Amount:", butx,(buty-=buth),butw,buth, &part->ren_child_nbr, 0.0, MAX_PART_CHILDREN, 0, 0, "Amount of children/parent for rendering");
+
 	if(part->from!=PART_FROM_PARTICLE && part->childtype==PART_CHILD_FACES) {
 		uiDefButF(block, NUMSLI, B_PART_DISTR_CHILD, "VParents:",		butx,(buty-=buth),butw,buth, &part->parents, 0.0, 1.0, 1, 3, "Relative amount of virtual parents");
 		}
@@ -4015,9 +4017,11 @@
 	buty -= buth/2;
 
 	uiBlockBeginAlign(block);
-	uiDefButF(block, NUM, B_PART_REDRAW, "Size:",		butx,(buty-=buth),butw/2,buth, &part->childsize, 0.01, 100, 10, 1, "A multiplier for the child particle size");
-	uiDefButF(block, NUM, B_PART_REDRAW, "Rand:",		butx+butw/2,buty,butw/2,buth, &part->childrandsize, 0.0, 1.0, 10, 1, "Random variation to the size of the child particles");
-	if(part->childtype==PART_CHILD_FACES) {
+	if(part->draw_as != PART_DRAW_PATH) {
+		uiDefButF(block, NUM, B_PART_REDRAW, "Size:",		butx,(buty-=buth),butw/2,buth, &part->childsize, 0.01, 100, 10, 1, "A multiplier for the child particle size");
+		uiDefButF(block, NUM, B_PART_REDRAW, "Rand:",		butx+butw/2,buty,butw/2,buth, &part->childrandsize, 0.0, 1.0, 10, 1, "Random variation to the size of the child particles");
+	}
+	if(part->childtype == PART_CHILD_FACES) {
 		uiDefButF(block, NUM, B_PART_REDRAW, "Spread:",butx,(buty-=buth),butw/2,buth, &part->childspread, -1.0, 1.0, 10, 1, "Spread children from the faces");
 		uiDefButBitI(block, TOG, PART_CHILD_SEAMS, B_PART_DISTR_CHILD, "Use Seams",	 butx+butw/2,buty,butw/2,buth, &part->flag, 0, 0, 0, 0, "Use seams to determine parents");
 	}
@@ -4026,9 +4030,12 @@
 	butx=160;
 	buty=180;
 
-	uiDefButBitS(block, TOG, 1, B_PART_REDRAW, "Kink/Branch",	 butx,(buty-=buth),butw,buth, &kink_ui, 0, 0, 0, 0, "Show kink and branch options");
+	if(psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED))
+		uiDefButBitS(block, TOG, 1, B_PART_REDRAW, "Kink/Branch",	 butx,(buty-=buth),butw,buth, &kink_ui, 0, 0, 0, 0, "Show kink and branch options");
+	else
+		buty-=buth;
 
-	if(kink_ui) {
+	if(kink_ui || (psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED)) == 0) {
 		buty -= buth/2;
 
 		/* kink */
@@ -4046,7 +4053,7 @@
 		}
 		uiBlockEndAlign(block);
 
-		if(part->childtype==PART_CHILD_PARTICLES) {
+		if(part->childtype==PART_CHILD_PARTICLES && psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED)) {
 			if(part->flag & PART_BRANCHING) {
 				uiDefButBitI(block, TOG, PART_BRANCHING, B_PART_RECALC_CHILD, "Branching",	butx,(buty-=2*buth),butw,buth, &part->flag, 0, 0, 0, 0, "Branch child paths from eachother");
 				uiDefButBitI(block, TOG, PART_ANIM_BRANCHING, B_PART_RECALC_CHILD, "Animated",	butx,(buty-=buth),butw/2,buth, &part->flag, 0, 0, 0, 0, "Animate branching");
@@ -4323,7 +4330,7 @@
 				}
 			}
 			else {
-				uiDefBut(block, LABEL, 0, "Baked or keyed",	butx,(buty-=2*buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
+				uiDefBut(block, LABEL, 0, "Hair or keyed",	butx,(buty-=2*buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
 				uiDefBut(block, LABEL, 0, "particles needed!",	butx,(buty-=2*buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
 			}
 			break;





More information about the Bf-blender-cvs mailing list