From 63d96b8ca06440ee74bec7636ef7b88f6ec5b676 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Tue, 9 Mar 2010 03:42:20 +0000 Subject: [PATCH] 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. --- .../blender/editors/physics/particle_object.c | 4 ++++ .../blender/makesrna/intern/rna_sculpt_paint.c | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index d72357a38b1..0a2c8a5b4a7 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -526,6 +526,7 @@ void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot) 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 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys) 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); } diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 4aa1401ac84..c4830250aa8 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -56,6 +56,15 @@ static EnumPropertyItem particle_edit_hair_brush_items[] = { #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 @@ static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *pt 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; }