[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23634] trunk/blender: General particle bug fixes + few small goodies

Janne Karhu jhkarh at utu.fi
Mon Oct 5 15:26:05 CEST 2009


Revision: 23634
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23634
Author:   jhk
Date:     2009-10-05 15:25:56 +0200 (Mon, 05 Oct 2009)

Log Message:
-----------
General particle bug fixes + few small goodies

The goodies:
* Curves can be used as normal dynamic effectors too with 
  the new "curve" field shape.
* Group visualization has optional duplication counts for
  each object in the specified group.
* Object & group visualizations, which are done without
  taking the dupliobject's global position into account
  (unless the whole group is used). This is much nicer than
  the previous behavior, but I added a "Use Global Location"
  option for those who want to use it the old way.
* The active particle system's particles are now drawn a 
  with theme coloured outline instead of pure white.
* Added object aligned velocity factors (buttons categorized
  and re-organized too).

Bug fixes:
* Absorption didn't work as the ui toggle button was forgotten.
* Some other force field ui tweaks.
* Crash after adding children and changing trails count.
* Display types "cross" and "axis" crashed.
* Particles weren't drawn with correct coloring.
* Billboards didn't update properly in viewport to camera
  location changes.
* Particle rotation wasn't recreated correctly from point cache.
* Changing particles amount crashed sometimes.
* Some files with child hair crashed on loading.
* Compiler warning fixes.
* Adding boids crashed on frame 1;

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/buttons_particle.py
    trunk/blender/release/scripts/ui/buttons_physics_common.py
    trunk/blender/source/blender/blenkernel/BKE_bvhutils.h
    trunk/blender/source/blender/blenkernel/BKE_effect.h
    trunk/blender/source/blender/blenkernel/BKE_particle.h
    trunk/blender/source/blender/blenkernel/intern/anim.c
    trunk/blender/source/blender/blenkernel/intern/boids.c
    trunk/blender/source/blender/blenkernel/intern/bvhutils.c
    trunk/blender/source/blender/blenkernel/intern/effect.c
    trunk/blender/source/blender/blenkernel/intern/modifier.c
    trunk/blender/source/blender/blenkernel/intern/particle.c
    trunk/blender/source/blender/blenkernel/intern/particle_system.c
    trunk/blender/source/blender/blenkernel/intern/pointcache.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/blenloader/intern/writefile.c
    trunk/blender/source/blender/editors/physics/particle_object.c
    trunk/blender/source/blender/editors/physics/physics_intern.h
    trunk/blender/source/blender/editors/physics/physics_ops.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c
    trunk/blender/source/blender/makesdna/DNA_object_force.h
    trunk/blender/source/blender/makesdna/DNA_particle_types.h
    trunk/blender/source/blender/makesrna/intern/rna_object_force.c
    trunk/blender/source/blender/makesrna/intern/rna_particle.c

Modified: trunk/blender/release/scripts/ui/buttons_particle.py
===================================================================
--- trunk/blender/release/scripts/ui/buttons_particle.py	2009-10-05 12:55:16 UTC (rev 23633)
+++ trunk/blender/release/scripts/ui/buttons_particle.py	2009-10-05 13:25:56 UTC (rev 23634)
@@ -121,17 +121,19 @@
 		layout.enabled = particle_panel_enabled(psys) and not psys.multiple_caches
 		
 		row = layout.row()
+		row.active = part.distribution != 'GRID'
 		row.itemR(part, "amount")
 		
-		split = layout.split()
-		
-		col = split.column(align=True)
-		col.itemR(part, "start")
-		col.itemR(part, "end")
+		if part.type != 'HAIR':
+			split = layout.split()
+			
+			col = split.column(align=True)
+			col.itemR(part, "start")
+			col.itemR(part, "end")
 
-		col = split.column(align=True)
-		col.itemR(part, "lifetime")
-		col.itemR(part, "random_lifetime", slider=True)
+			col = split.column(align=True)
+			col.itemR(part, "lifetime")
+			col.itemR(part, "random_lifetime", slider=True)
 		
 		layout.row().itemL(text="Emit From:")
 		
@@ -221,7 +223,7 @@
 		
 		point_cache_ui(self, psys.point_cache, particle_panel_enabled(psys), not psys.hair_dynamics, 0)
 
-class PARTICLE_PT_initial(ParticleButtonsPanel):
+class PARTICLE_PT_velocity(ParticleButtonsPanel):
 	__label__ = "Velocity"
 	
 	def poll(self, context):
@@ -238,48 +240,66 @@
 		part = psys.settings
 		
 		layout.enabled = particle_panel_enabled(psys)
-				
-		layout.row().itemL(text="Direction:")
 	
 		split = layout.split()
 			
 		sub = split.column()
+		sub.itemL(text="Emitter Geometry:")
 		sub.itemR(part, "normal_factor")
+		subsub = sub.column(align=True)
+		subsub.itemR(part, "tangent_factor")
+		subsub.itemR(part, "tangent_phase", slider=True)
+		
+		sub = split.column()
+		sub.itemL(text="Emitter Object")
+		sub.itemR(part, "object_aligned_factor", text="")
+			
+		layout.row().itemL(text="Other:")
+		split = layout.split()
+		sub = split.column()
 		if part.emit_from=='PARTICLE':
 			sub.itemR(part, "particle_factor")
 		else:
 			sub.itemR(part, "object_factor", slider=True)
+		sub = split.column()
 		sub.itemR(part, "random_factor")
-		sub.itemR(part, "tangent_factor")
-		sub.itemR(part, "tangent_phase", slider=True)
 		
-		sub = split.column()
-		sub.itemL(text="TODO:")
-		sub.itemL(text="Object aligned")
-		sub.itemL(text="direction: X, Y, Z")
+		#if part.type=='REACTOR':
+		#	sub.itemR(part, "reactor_factor")
+		#	sub.itemR(part, "reaction_shape", slider=True)
 		
-		if part.type=='REACTOR':
-			sub.itemR(part, "reactor_factor")
-			sub.itemR(part, "reaction_shape", slider=True)
+class PARTICLE_PT_rotation(ParticleButtonsPanel):
+	__label__ = "Rotation"
+	
+	def poll(self, context):
+		if particle_panel_poll(context):
+			psys = context.particle_system
+			return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
 		else:
-			sub.itemL(text="")
+			return False
+
+	def draw(self, context):
+		layout = self.layout
+
+		psys = context.particle_system
+		part = psys.settings
 		
-		layout.row().itemL(text="Rotation:")
-		split = layout.split()
-			
-		sub = split.column()
+		layout.enabled = particle_panel_enabled(psys)
 		
-		sub.itemR(part, "rotation_mode", text="Axis")
 		split = layout.split()
+		split.itemL(text="Initial Rotation:")
+		split.itemR(part, "rotation_dynamic")
+		split = layout.split()
 			
-		sub = split.column()
-		sub.itemR(part, "rotation_dynamic")
-		sub.itemR(part, "random_rotation_factor", slider=True)
-		sub = split.column()
+		sub = split.column(align=True)
+		sub.itemR(part, "rotation_mode", text="")
+		sub.itemR(part, "random_rotation_factor", slider=True, text="Random")
+			
+		sub = split.column(align=True)
 		sub.itemR(part, "phase_factor", slider=True)
 		sub.itemR(part, "random_phase_factor", text="Random", slider=True)
 
-		layout.row().itemL(text="Angular velocity:")
+		layout.row().itemL(text="Angular Velocity:")
 		layout.row().itemR(part, "angular_velocity_mode", expand=True)
 		split = layout.split()
 			
@@ -607,16 +627,37 @@
 
 		elif part.ren_as == 'OBJECT':
 			sub.itemR(part, "dupli_object")
+			sub.itemR(part, "use_global_dupli")
 		elif part.ren_as == 'GROUP':
 			sub.itemR(part, "dupli_group")
 			split = layout.split()
 			sub = split.column()
 			sub.itemR(part, "whole_group")
+			colsub = sub.column()
+			colsub.active = part.whole_group == False
+			colsub.itemR(part, "use_group_count")
+			
 			sub = split.column()
 			colsub = sub.column()
 			colsub.active = part.whole_group == False
+			colsub.itemR(part, "use_global_dupli")
 			colsub.itemR(part, "rand_group")
 			
+			if part.use_group_count and not part.whole_group:
+				row = layout.row()
+				row.template_list(part, "dupliweights", part, "active_dupliweight_index")
+				
+				col = row.column()
+				subrow = col.row()
+				subcol = subrow.column(align=True)
+				subcol.itemO("particle.dupliob_move_up", icon='VICON_MOVE_UP', text="")
+				subcol.itemO("particle.dupliob_move_down", icon='VICON_MOVE_DOWN', text="")
+				
+				weight = part.active_dupliweight
+				if weight:
+					row = layout.row()
+					row.itemR(weight, "count")
+			
 		elif part.ren_as == 'BILLBOARD':
 			sub.itemL(text="Align:")
 			
@@ -898,7 +939,8 @@
 bpy.types.register(PARTICLE_PT_hair_dynamics)
 bpy.types.register(PARTICLE_PT_cache)
 bpy.types.register(PARTICLE_PT_emission)
-bpy.types.register(PARTICLE_PT_initial)
+bpy.types.register(PARTICLE_PT_velocity)
+bpy.types.register(PARTICLE_PT_rotation)
 bpy.types.register(PARTICLE_PT_physics)
 bpy.types.register(PARTICLE_PT_boidbrain)
 bpy.types.register(PARTICLE_PT_render)

Modified: trunk/blender/release/scripts/ui/buttons_physics_common.py
===================================================================
--- trunk/blender/release/scripts/ui/buttons_physics_common.py	2009-10-05 12:55:16 UTC (rev 23633)
+++ trunk/blender/release/scripts/ui/buttons_physics_common.py	2009-10-05 13:25:56 UTC (rev 23634)
@@ -78,7 +78,7 @@
 		layout.itemS()
 		
 		flow = layout.column_flow()
-		flow.itemR(weights, "spherical", slider=True)
+		flow.itemR(weights, "force", slider=True)
 		flow.itemR(weights, "vortex", slider=True)
 		flow.itemR(weights, "magnetic", slider=True)
 		flow.itemR(weights, "wind", slider=True)
@@ -110,7 +110,7 @@
 		col.itemR(field, "flow")
 	elif field.type == 'HARMONIC':
 		col.itemR(field, "harmonic_damping", text="Damping")
-	elif field.type == 'VORTEX' and field.shape == 'PLANE':
+	elif field.type == 'VORTEX' and field.shape != 'POINT':
 		col.itemR(field, "inflow")
 	elif field.type == 'DRAG':
 		col.itemR(field, "quadratic_drag", text="Quadratic")
@@ -140,6 +140,7 @@
 	col.itemR(field, "z_direction", text="")
 	col.itemR(field, "use_min_distance", text="Use Minimum")
 	col.itemR(field, "use_max_distance", text="Use Maximum")
+	col.itemR(field, "do_absorption")
 
 	col = split.column()
 	col.itemR(field, "falloff_power", text="Power")

Modified: trunk/blender/source/blender/blenkernel/BKE_bvhutils.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_bvhutils.h	2009-10-05 12:55:16 UTC (rev 23633)
+++ trunk/blender/source/blender/blenkernel/BKE_bvhutils.h	2009-10-05 13:25:56 UTC (rev 23634)
@@ -57,6 +57,7 @@
 
 	/* Vertex array, so that callbacks have instante access to data */
 	struct MVert *vert;
+	struct MEdge *edge;		/* only used for BVHTreeFromMeshEdges */
 	struct MFace *face;
 
 	/* radius for raycast */
@@ -96,6 +97,8 @@
  */
 BVHTree* bvhtree_from_mesh_faces(struct BVHTreeFromMesh *data, struct DerivedMesh *mesh, float epsilon, int tree_type, int axis);
 
+BVHTree* bvhtree_from_mesh_edges(struct BVHTreeFromMesh *data, struct DerivedMesh *mesh, float epsilon, int tree_type, int axis);
+
 /*
  * Frees data allocated by a call to bvhtree_from_mesh_*.
  */
@@ -109,6 +112,7 @@
 //Using local coordinates
 #define BVHTREE_FROM_FACES		0
 #define BVHTREE_FROM_VERTICES	1
+#define BVHTREE_FROM_EDGES		2
 
 typedef LinkNode* BVHCache;
 

Modified: trunk/blender/source/blender/blenkernel/BKE_effect.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_effect.h	2009-10-05 12:55:16 UTC (rev 23633)
+++ trunk/blender/source/blender/blenkernel/BKE_effect.h	2009-10-05 13:25:56 UTC (rev 23634)
@@ -138,6 +138,7 @@
 /* EffectedPoint->flag */
 #define PE_WIND_AS_SPEED		1
 #define PE_DYNAMIC_ROTATION		2
+#define PE_USE_NORMAL_DATA		4
 
 /* EffectorData->flag */
 #define PE_VELOCITY_TO_IMPULSE	1

Modified: trunk/blender/source/blender/blenkernel/BKE_particle.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_particle.h	2009-10-05 12:55:16 UTC (rev 23633)
+++ trunk/blender/source/blender/blenkernel/BKE_particle.h	2009-10-05 13:25:56 UTC (rev 23634)
@@ -201,6 +201,8 @@
 int psys_in_edit_mode(struct Scene *scene, struct ParticleSystem *psys);
 int psys_check_enabled(struct Object *ob, struct ParticleSystem *psys);
 
+void psys_check_group_weights(struct ParticleSettings *part);
+
 /* free */
 void psys_free_settings(struct ParticleSettings *part);
 void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit);

Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c	2009-10-05 12:55:16 UTC (rev 23633)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c	2009-10-05 13:25:56 UTC (rev 23634)
@@ -776,6 +776,7 @@
 	GroupObject *go;
 	Object *ob=0, **oblist=0, obcopy, *obcopylist=0;
 	DupliObject *dob;
+	ParticleDupliWeight *dw;
 	ParticleSimulationData sim = {scene, par, psys, psys_get_modifier(par, psys)};
 	ParticleSettings *part;
 	ParticleData *pa;
@@ -783,7 +784,7 @@
 	ParticleKey state;
 	ParticleCacheKey *cache;
 	float ctime, pa_time, scale = 1.0f;
-	float tmat[4][4], mat[4][4], pamat[4][4], size=0.0;
+	float tmat[4][4], mat[4][4], pamat[4][4], vec[3], size=0.0;
 	float (*obmat)[4], (*oldobmat)[4];
 	int lay, a, b, counter, hair = 0;
 	int totpart, totchild, totgroup=0, pa_num;
@@ -813,6 +814,8 @@
 		((part->ren_as == PART_DRAW_OB && part->dup_ob) ||
 		(part->ren_as == PART_DRAW_GR && part->dup_group && part->dup_group->gobject.first))) {
 
+		psys_check_group_weights(part);
+
 		/* if we have a hair particle system, use the path cache */
 		if(part->type == PART_HAIR) {
 			if(psys->flag & PSYS_HAIR_DONE)
@@ -831,19 +834,38 @@

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list