diff options
author | Antonioya <blendergit@gmail.com> | 2018-11-30 21:04:14 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-11-30 21:04:39 +0300 |
commit | 4e92cc275936e4fa5e2c2a0d03e9649fb36c7bf8 (patch) | |
tree | 9800a32707004c6fc8241aa387b14361af3c61f6 /source/blender/editors | |
parent | 8d4da34883b25195da28024dc51b2c9b3347d504 (diff) |
Fix T58244: Proportional editing center is wrong
The global center was not calculated at all. Now a center is calculated using the selected points
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 0fca84074f5..3de39654779 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -8153,7 +8153,7 @@ void flushTransPaintCurve(TransInfo *t) static void createTransGPencil(bContext *C, TransInfo *t) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); \ + Depsgraph *depsgraph = CTX_data_depsgraph(C); bGPdata *gpd = ED_gpencil_data_get_active(C); ToolSettings *ts = CTX_data_tool_settings(C); @@ -8262,6 +8262,9 @@ static void createTransGPencil(bContext *C, TransInfo *t) unit_m3(mtx); /* Second Pass: Build transdata array */ + int totselected = 0; + float global_center[3] = { 0.0f, 0.0f, 0.0f }; + for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { /* only editable and visible layers are considered */ if (gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) { @@ -8376,9 +8379,14 @@ static void createTransGPencil(bContext *C, TransInfo *t) td->flag = 0; - if (pt->flag & GP_SPOINT_SELECT) + if (pt->flag & GP_SPOINT_SELECT) { td->flag |= TD_SELECTED; + /* prepare center */ + add_v3_v3(global_center, &pt->x); + totselected++; + } + /* for other transform modes (e.g. shrink-fatten), need to additional data * but never for scale or mirror */ @@ -8435,6 +8443,13 @@ static void createTransGPencil(bContext *C, TransInfo *t) } } } + + /* set global center */ + CLAMP_MIN(totselected, 1); + mul_v3_fl(global_center, 1.0f / totselected); + add_v3_v3(global_center, obact->obmat[3]); + copy_v3_v3(t->center_global, global_center); + t->flag |= T_OVERRIDE_CENTER; } static int countAndCleanTransDataContainer(TransInfo *t) |