diff options
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 6fc34c4fcf8..be4df93eff3 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -2901,7 +2901,7 @@ static void brush_smooth_do(PEData *data, float mat[][4], float imat[][4], int p (data->edit->points + point_index)->flag |= PEP_EDIT_RECALC; } -static void brush_add(PEData *data, short number) +static int brush_add(PEData *data, short number) { Scene *scene= data->scene; Object *ob= data->ob; @@ -2922,7 +2922,7 @@ static void brush_add(PEData *data, short number) Mat4Invert(imat,ob->obmat); if(psys->flag & PSYS_GLOBAL_HAIR) - return; + return 0; BLI_srandom(psys->seed+data->mval[0]+data->mval[1]); @@ -3097,6 +3097,8 @@ static void brush_add(PEData *data, short number) if(!psmd->dm->deformedOnly) dm->release(dm); + + return n; } /************************* brush edit operator ********************/ @@ -3147,7 +3149,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) ARegion *ar= CTX_wm_region(C); float vec[3], mousef[2]; short mval[2], mvalo[2]; - int flip, mouse[2], dx, dy, removed= 0, selected= 0; + int flip, mouse[2], dx, dy, removed= 0, added=0, selected= 0; int lock_root = pset->flag & PE_LOCK_FIRST; if(!PE_start_edit(edit)) @@ -3225,6 +3227,9 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) if(pset->flag & PE_KEEP_LENGTHS) recalc_lengths(edit); } + else + removed= 0; + break; } case PE_BRUSH_LENGTH: @@ -3279,11 +3284,13 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) PE_set_view3d_data(C, &data); data.mval= mval; - brush_add(&data, brush->strength); + added= brush_add(&data, brush->strength); if(pset->flag & PE_KEEP_LENGTHS) recalc_lengths(edit); } + else + added= 0; break; } case PE_BRUSH_SMOOTH: @@ -3314,13 +3321,15 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) if((pset->flag & PE_KEEP_LENGTHS)==0) recalc_lengths(edit); - if(pset->brushtype == PE_BRUSH_ADD || removed) { - if(pset->brushtype == PE_BRUSH_ADD && (pset->flag & PE_X_MIRROR)) - PE_mirror_x(scene, ob, 1); + if(ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_CUT)) { + if(added || removed) { + if(pset->brushtype == PE_BRUSH_ADD && (pset->flag & PE_X_MIRROR)) + PE_mirror_x(scene, ob, 1); - update_world_cos(ob,edit); - psys_free_path_cache(NULL, edit); - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + update_world_cos(ob,edit); + psys_free_path_cache(NULL, edit); + DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + } } else PE_update_object(scene, ob, 1); |