[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12603] branches/particles/source/blender:

Brecht Van Lommel brechtvanlommel at pandora.be
Fri Nov 16 10:54:29 CET 2007


Revision: 12603
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12603
Author:   blendix
Date:     2007-11-16 10:54:28 +0100 (Fri, 16 Nov 2007)

Log Message:
-----------

Particle Branch
===============

A few small fixes:
- Don't move 3d cursor after using a brush.
- Fix missing updates for key position display in editmode on
  e.g. modifier changes, and do correct updates after delete and
  add particles (own mistakes).
- Don't recalc child particle cache on every redraw in editmode,
  only when it is missing (don't know why it was there in the
  first place, but seems to be working without it).
- Draw proportional edit circle (but the transform center is still
  wrong).

Modified Paths:
--------------
    branches/particles/source/blender/blenkernel/BKE_bad_level_calls.h
    branches/particles/source/blender/blenkernel/bad_level_call_stubs/stubs.c
    branches/particles/source/blender/blenkernel/intern/particle.c
    branches/particles/source/blender/include/BIF_editparticle.h
    branches/particles/source/blender/src/buttons_editing.c
    branches/particles/source/blender/src/drawobject.c
    branches/particles/source/blender/src/drawview.c
    branches/particles/source/blender/src/editparticle.c
    branches/particles/source/blender/src/space.c

Modified: branches/particles/source/blender/blenkernel/BKE_bad_level_calls.h
===================================================================
--- branches/particles/source/blender/blenkernel/BKE_bad_level_calls.h	2007-11-16 00:37:28 UTC (rev 12602)
+++ branches/particles/source/blender/blenkernel/BKE_bad_level_calls.h	2007-11-16 09:54:28 UTC (rev 12603)
@@ -236,6 +236,7 @@
 
 void PE_free_particle_edit(struct ParticleSystem *psys);
 void PE_get_colors(char sel[4], char nosel[4]);
+void PE_recalc_world_cos(struct Object *ob, struct ParticleSystem *psys);
 
 #endif
 

Modified: branches/particles/source/blender/blenkernel/bad_level_call_stubs/stubs.c
===================================================================
--- branches/particles/source/blender/blenkernel/bad_level_call_stubs/stubs.c	2007-11-16 00:37:28 UTC (rev 12602)
+++ branches/particles/source/blender/blenkernel/bad_level_call_stubs/stubs.c	2007-11-16 09:54:28 UTC (rev 12603)
@@ -344,4 +344,5 @@
 /* particle.c */
 void PE_free_particle_edit(struct ParticleSystem *psys) {}
 void PE_get_colors(char sel[4], char nosel[4]) {}
+void PE_recalc_world_cos(struct Object *ob, struct ParticleSystem *psys) {}
 

Modified: branches/particles/source/blender/blenkernel/intern/particle.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/particle.c	2007-11-16 00:37:28 UTC (rev 12602)
+++ branches/particles/source/blender/blenkernel/intern/particle.c	2007-11-16 09:54:28 UTC (rev 12603)
@@ -913,6 +913,7 @@
 			if (uv_index>=0)
 				layer_uv=&dm->faceData.layers[uv_index];
 			
+			fuv[1]= 1-fuv[1];
 			if (index_dmcache == -1) {
 				i = psys_particle_dm_face_lookup(dm, index, fuv, (LinkNode*)NULL);
 			} else {
@@ -933,9 +934,17 @@
 			mtface= dm->getFaceData(dm, i, CD_MTFACE); 
 			osface= dm->getFaceData(dm, i, CD_ORIGSPACE);
 			
-			//printf("Before fuv_mod (%f %f)\n", fuv_mod[0], fuv_mod[1]);
+#if 0
+			/* TODO brecht: properly fix this */
+			if (index_dmcache == -1)
+				PointInFace2DUV(mface->v4, osface->uv[0], osface->uv[1], osface->uv[2], osface->uv[3], fuv, fuv_mod);
+			else {
+				fuv_mod[0]= fuv[0];
+				fuv_mod[1]= fuv[1];
+			}
+#endif
 			PointInFace2DUV(mface->v4, osface->uv[0], osface->uv[1], osface->uv[2], osface->uv[3], fuv, fuv_mod);
-			//printf("After fuv_mod (%f %f)\n", fuv_mod[0], fuv_mod[1]);
+			fuv[1]= 1-fuv[1];
 			
 			psys_interpolate_face(mvert,mface,mtface,fuv_mod,vec,nor,utan,vtan);
 			

Modified: branches/particles/source/blender/include/BIF_editparticle.h
===================================================================
--- branches/particles/source/blender/include/BIF_editparticle.h	2007-11-16 00:37:28 UTC (rev 12602)
+++ branches/particles/source/blender/include/BIF_editparticle.h	2007-11-16 09:54:28 UTC (rev 12603)
@@ -57,6 +57,7 @@
 void PE_hide_keys_time(struct ParticleSystem *psys, float cfra);
 void PE_update_object(struct Object *ob, int useflag, int clearflag);
 void PE_update_selection(struct Object *ob);
+void PE_recalc_world_cos(struct Object *ob, struct ParticleSystem *psys);
 
 /* selection tools */
 void PE_select_root(void);

Modified: branches/particles/source/blender/src/buttons_editing.c
===================================================================
--- branches/particles/source/blender/src/buttons_editing.c	2007-11-16 00:37:28 UTC (rev 12602)
+++ branches/particles/source/blender/src/buttons_editing.c	2007-11-16 09:54:28 UTC (rev 12603)
@@ -5782,16 +5782,16 @@
 		if(pset->brushtype>=0) {
 			ParticleBrushData *brush= &pset->brush[pset->brushtype];
 
-			butw= 170;
+			butw= 180;
 
 			uiBlockBeginAlign(block);
 			uiDefButS(block, NUMSLI, B_BAKE_REDRAWEDIT, "Size:", butx,(buty-=buth),butw,buth, &brush->size, 1.0, 100.0, 1, 1, "Brush size");
-			uiDefButS(block, NUMSLI, B_BAKE_REDRAWEDIT, "Strength:", butx,(buty-=buth),butw,buth, &brush->strength, 0.0, 100.0, 1, 1, "Brush strength");
+			uiDefButS(block, NUMSLI, B_BAKE_REDRAWEDIT, "Strength:", butx,(buty-=buth),butw,buth, &brush->strength, 1.0, 100.0, 1, 1, "Brush strength");
 			uiBlockEndAlign(block);
 
 			butx += butw+10;
 			buty= lastbuty;
-			butw= 120;
+			butw= 110;
 
 			if(pset->brushtype==PE_BRUSH_ADD) {
 				uiBlockBeginAlign(block);

Modified: branches/particles/source/blender/src/drawobject.c
===================================================================
--- branches/particles/source/blender/src/drawobject.c	2007-11-16 00:37:28 UTC (rev 12602)
+++ branches/particles/source/blender/src/drawobject.c	2007-11-16 09:54:28 UTC (rev 12603)
@@ -3562,10 +3562,12 @@
 		psys_cache_paths(ob,psys,CFRA);
 	}
 
-	if(pset->flag & PE_SHOW_CHILD && psys->part->draw_as == PART_DRAW_PATH)
-		cache_psys_child_paths(ob, psys, CFRA);
-	else
-		free_child_path_cache(psys);
+	if(pset->flag & PE_SHOW_CHILD && psys->part->draw_as == PART_DRAW_PATH) {
+		if(psys->childcache==0)
+			cache_psys_child_paths(ob, psys, CFRA);
+	}
+	else if(psys->childcache)
+			free_child_path_cache(psys);
 
 	if((G.vd->flag & V3D_ZBUF_SELECT)==0)
 		glDisable(GL_DEPTH_TEST);

Modified: branches/particles/source/blender/src/drawview.c
===================================================================
--- branches/particles/source/blender/src/drawview.c	2007-11-16 00:37:28 UTC (rev 12602)
+++ branches/particles/source/blender/src/drawview.c	2007-11-16 09:54:28 UTC (rev 12603)
@@ -2922,7 +2922,8 @@
 
 	if(G.moving) {
 		BIF_drawConstraint();
-		if(G.obedit) BIF_drawPropCircle();	// only editmode has proportional edit
+		if(G.obedit || (G.f & G_PARTICLEEDIT))
+			BIF_drawPropCircle(); // only editmode and particles have proportional edit
 		BIF_drawSnap();
 	}
 

Modified: branches/particles/source/blender/src/editparticle.c
===================================================================
--- branches/particles/source/blender/src/editparticle.c	2007-11-16 00:37:28 UTC (rev 12602)
+++ branches/particles/source/blender/src/editparticle.c	2007-11-16 09:54:28 UTC (rev 12603)
@@ -153,6 +153,7 @@
 			psys->flag |= PSYS_CURRENT;
 			if(G.f & G_PARTICLEEDIT && !psys->edit)
 				PE_create_particle_edit(ob, psys);
+			PE_recalc_world_cos(ob, psys);
 		}
 	}
 }
@@ -742,7 +743,7 @@
 	}
 }
 /* calculate and store key locations in world coordinates */
-void PE_recalc_wcos(Object *ob, ParticleSystem *psys)
+void PE_recalc_world_cos(Object *ob, ParticleSystem *psys)
 {
 	ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
 	ParticleData *pa;
@@ -866,7 +867,7 @@
 	PE_iterate_lengths(psys);
 	PE_deflect_emitter(ob,psys);
 	PE_apply_lengths(psys);
-	PE_recalc_wcos(ob,psys);
+	PE_recalc_world_cos(ob,psys);
 	PE_hide_keys_time(psys,cfra);
 
 	/* regenerate path caches */
@@ -923,7 +924,7 @@
 
 	recalc_lengths(psys);
 	recalc_emitter_field(ob, psys);
-	PE_recalc_wcos(ob, psys);
+	PE_recalc_world_cos(ob, psys);
 
 	if(alloc) {
 		ParticleUndo_clear(psys);
@@ -952,9 +953,11 @@
 	}
 
 	if((G.f & G_PARTICLEEDIT)==0){
-		if(psys && psys->part->type == PART_HAIR && psys->flag & PSYS_EDITED)
+		if(psys && psys->part->type == PART_HAIR && psys->flag & PSYS_EDITED) {
 			if(psys->edit==0)
 				PE_create_particle_edit(ob, psys);
+			PE_recalc_world_cos(ob, psys);
+		}
 
 		G.f |= G_PARTICLEEDIT;
 	}
@@ -1699,7 +1702,7 @@
 	psys->edit->totkeys = psys_count_keys(psys);
 	
 	recalc_lengths(psys);
-	PE_recalc_wcos(ob, psys);
+	PE_recalc_world_cos(ob, psys);
 
 	PE_update_object(ob, 1, 1);
 	
@@ -2312,7 +2315,12 @@
 			if((pset->flag & PE_KEEP_LENGTHS)==0)
 				recalc_lengths(psys);
 
-			PE_update_object(ob, 1, 1);
+			if(pset->brushtype == PE_BRUSH_ADD) {
+				PE_recalc_world_cos(ob,psys);
+				DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
+			}
+			else
+				PE_update_object(ob, 1, 1);
 			
 			mvalo[0] = mval[0];
 			mvalo[1] = mval[1];
@@ -2361,7 +2369,7 @@
 		recalc_lengths(psys);
 	}
 
-	PE_update_object(ob, 1, 1);
+	DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
 	allqueue(REDRAWVIEW3D, 1);
 	BIF_undo_push("Delete particles/keys");
 }

Modified: branches/particles/source/blender/src/space.c
===================================================================
--- branches/particles/source/blender/src/space.c	2007-11-16 00:37:28 UTC (rev 12602)
+++ branches/particles/source/blender/src/space.c	2007-11-16 09:54:28 UTC (rev 12603)
@@ -1597,7 +1597,7 @@
 				else if (G.f & G_PARTICLEEDIT) {
 					if(G.qual & LR_CTRLKEY)
 						mouse_cursor();
-					else if(PE_brush_particles())
+					else if(!PE_brush_particles())
 						mouse_cursor();
 				}
 				break;





More information about the Bf-blender-cvs mailing list