diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-11-27 23:37:42 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-11-27 23:40:01 +0300 |
commit | 6a45b2a2324277a88edccfcaac2fc2525f7c4ee0 (patch) | |
tree | 9698266e2f1be5c5def4d7f876987460803941ab /source | |
parent | f4f5f3b209e1f1309966ca007370225a06ef86fe (diff) |
Partial Fix T42652: Transform falloff for mesh islands
This doesn't currently do anything clever when a single vertex is shared by multiple islands
(uses closest only).
Diffstat (limited to 'source')
4 files changed, 25 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 7e27c11ec8a..b0e334345ec 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -200,6 +200,12 @@ static bool transdata_check_local_center(TransInfo *t, short around) ); } +bool transdata_check_local_islands(TransInfo *t, short around) +{ + return ((around == V3D_LOCAL) && ( + (t->obedit && ELEM(t->obedit->type, OB_MESH)))); +} + /* ************************** SPACE DEPENDANT CODE **************************** */ void setTransformViewMatrices(TransInfo *t) diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index c2891b50321..0d824be862e 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -552,6 +552,7 @@ void special_aftertrans_update(struct bContext *C, TransInfo *t); int special_transform_moving(TransInfo *t); void transform_autoik_update(TransInfo *t, short mode); +bool transdata_check_local_islands(TransInfo *t, short around); int count_set_pose_transflags(int *out_mode, short around, struct Object *ob); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 72a2fef3bc2..db29c7c0cd6 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -218,6 +218,9 @@ static void set_prop_dist(TransInfo *t, const bool with_dist) float _proj_vec[3]; const float *proj_vec = NULL; + /* support for face-islands */ + const bool use_island = transdata_check_local_islands(t, t->around); + if (t->flag & T_PROP_PROJECTED) { if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { RegionView3D *rv3d = t->ar->regiondata; @@ -239,7 +242,12 @@ static void set_prop_dist(TransInfo *t, const bool with_dist) for (i = 0, td = t->data; i < t->total; i++, td++) { if (td->flag & TD_SELECTED) { - sub_v3_v3v3(vec, tob->center, td->center); + if (use_island) { + sub_v3_v3v3(vec, tob->iloc, td->iloc); + } + else { + sub_v3_v3v3(vec, tob->center, td->center); + } mul_m3_v3(tob->mtx, vec); if (proj_vec) { @@ -251,6 +259,10 @@ static void set_prop_dist(TransInfo *t, const bool with_dist) dist_sq = len_squared_v3(vec); if ((tob->rdist == -1.0f) || (dist_sq < SQUARE(tob->rdist))) { tob->rdist = sqrtf(dist_sq); + if (use_island) { + copy_v3_v3(tob->center, td->center); + copy_m3_m3(tob->axismtx, td->axismtx); + } } } else { diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 34d64b71fa2..f5d4f341600 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1191,7 +1191,11 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve /* exceptional case */ if (t->around == V3D_LOCAL) { if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) { - t->options |= CTX_NO_PET; + const bool use_island = transdata_check_local_islands(t, t->around); + + if (!use_island) { + t->options |= CTX_NO_PET; + } } } |