[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27349] trunk/blender/source/blender: Fix for: [#20937] Add brush doesnt work when disconnected hair option is enabled.

Janne Karhu jhkarh at gmail.com
Tue Mar 9 04:42:20 CET 2010


Revision: 27349
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27349
Author:   jhk
Date:     2010-03-09 04:42:20 +0100 (Tue, 09 Mar 2010)

Log Message:
-----------
Fix for: [#20937] Add brush doesnt work when disconnected hair option is enabled.

Really not much to fix, since it's just not supposed to work. Removed the non-working
brushes (add and puff) from the brush list while hair is disconnected.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/physics/particle_object.c
    trunk/blender/source/blender/makesrna/intern/rna_sculpt_paint.c

Modified: trunk/blender/source/blender/editors/physics/particle_object.c
===================================================================
--- trunk/blender/source/blender/editors/physics/particle_object.c	2010-03-09 03:27:05 UTC (rev 27348)
+++ trunk/blender/source/blender/editors/physics/particle_object.c	2010-03-09 03:42:20 UTC (rev 27349)
@@ -526,6 +526,7 @@
 static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
 {
 	ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
+	ParticleEditSettings *pset= PE_settings(scene);
 	ParticleData *pa;
 	PTCacheEdit *edit;
 	PTCacheEditPoint *point;
@@ -565,6 +566,9 @@
 
 	psys->flag |= PSYS_GLOBAL_HAIR;
 
+	if(ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_PUFF))
+		pset->brushtype = PE_BRUSH_NONE;
+
 	PE_update_object(scene, ob, 0);
 }
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sculpt_paint.c	2010-03-09 03:27:05 UTC (rev 27348)
+++ trunk/blender/source/blender/makesrna/intern/rna_sculpt_paint.c	2010-03-09 03:42:20 UTC (rev 27349)
@@ -56,6 +56,15 @@
 
 #include "ED_particle.h"
 
+static EnumPropertyItem particle_edit_disconnected_hair_brush_items[] = {
+	{PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
+	{PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
+	{PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
+	{PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
+	{PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
+	{PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
+	{0, NULL, 0, NULL, NULL}};
+
 static EnumPropertyItem particle_edit_cache_brush_items[] = {
 	{PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
 	{PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb paths"},
@@ -126,8 +135,12 @@
 	Object *ob= (scene->basact)? scene->basact->object: NULL;
 	PTCacheEdit *edit = PE_get_current(scene, ob);
 	
-	if(edit && edit->psys)
-		return particle_edit_hair_brush_items;
+	if(edit && edit->psys) {
+		if(edit->psys->flag & PSYS_GLOBAL_HAIR)
+			return particle_edit_disconnected_hair_brush_items;
+		else
+			return particle_edit_hair_brush_items;
+	}
 
 	return particle_edit_cache_brush_items;
 }





More information about the Bf-blender-cvs mailing list