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.
This commit is contained in:
Janne Karhu 2010-03-09 03:42:20 +00:00
parent c1166642d0
commit 63d96b8ca0
2 changed files with 19 additions and 2 deletions

@ -526,6 +526,7 @@ void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot)
static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys) static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
{ {
ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys); ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
ParticleEditSettings *pset= PE_settings(scene);
ParticleData *pa; ParticleData *pa;
PTCacheEdit *edit; PTCacheEdit *edit;
PTCacheEditPoint *point; PTCacheEditPoint *point;
@ -565,6 +566,9 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
psys->flag |= PSYS_GLOBAL_HAIR; 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); PE_update_object(scene, ob, 0);
} }

@ -56,6 +56,15 @@ static EnumPropertyItem particle_edit_hair_brush_items[] = {
#include "ED_particle.h" #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[] = { static EnumPropertyItem particle_edit_cache_brush_items[] = {
{PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"}, {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
{PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb paths"}, {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; Object *ob= (scene->basact)? scene->basact->object: NULL;
PTCacheEdit *edit = PE_get_current(scene, ob); PTCacheEdit *edit = PE_get_current(scene, ob);
if(edit && edit->psys) if(edit && edit->psys) {
return particle_edit_hair_brush_items; 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; return particle_edit_cache_brush_items;
} }