From c9b8839237e8841d1709b09bb373f6bb6bf5ec86 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 21 Dec 2012 17:47:50 +0000 Subject: [PATCH] Bug fix #33647 Particle combing didn't always respond as expected. The combed effect was depending on the center of object in view, instead of on the center of selected hairs. That made combing in certain close ups impossible. Same was actually true for transform tools for hairs! And even worse - there was an optimize break in calculating center which wasn't true even. Causing centers for transform to fail similar in other cases. --- source/blender/editors/physics/particle_edit.c | 9 +++++++-- .../blender/editors/transform/transform_generics.c | 14 -------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index e8af808956b..9dbc0f9a10c 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3476,11 +3476,16 @@ static int brush_edit_init(bContext *C, wmOperator *op) PTCacheEdit *edit= PE_get_current(scene, ob); ARegion *ar= CTX_wm_region(C); BrushEdit *bedit; - + float min[3], max[3]; + if (pset->brushtype < 0) return 0; - initgrabz(ar->regiondata, ob->obmat[3][0], ob->obmat[3][1], ob->obmat[3][2]); + /* set the 'distance factor' for grabbing (used in comb etc) */ + INIT_MINMAX(min, max); + PE_minmax(scene, min, max); + mid_v3_v3v3(min, min, max); + initgrabz(ar->regiondata, min[0], min[1], min[2]); bedit= MEM_callocN(sizeof(BrushEdit), "BrushEdit"); bedit->first= 1; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 6d7ddd4e0ed..8f1d6a7b46e 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1529,13 +1529,6 @@ void calculateCenterMedian(TransInfo *t) total++; } } - else { - /* - * All the selected elements are at the head of the array - * which means we can stop when it finds unselected data - */ - break; - } } if (i) mul_v3_fl(partial, 1.0f / total); @@ -1555,13 +1548,6 @@ void calculateCenterBound(TransInfo *t) if (!(t->data[i].flag & TD_NOCENTER)) minmax_v3v3_v3(min, max, t->data[i].center); } - else { - /* - * All the selected elements are at the head of the array - * which means we can stop when it finds unselected data - */ - break; - } } else { copy_v3_v3(max, t->data[i].center);