diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-09 09:37:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-09 09:37:36 +0400 |
commit | 0f2c27b855fe42b33d09fe841bf959e553565eb3 (patch) | |
tree | e08e0185589e779fc3635ea7005f0b2eb4d4639f /source/blender/editors/transform | |
parent | 56ae13be991ea652e90c06737ba59c5975bbee14 (diff) |
Option for shrink-fatten to maintain shell thickness (hold Alt).
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform.c | 21 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 10 |
2 files changed, 22 insertions, 9 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 28ec90a648a..961e5c49ab2 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1223,8 +1223,10 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case LEFTALTKEY: case RIGHTALTKEY: - if (t->spacetype == SPACE_SEQ) + if (ELEM(t->spacetype ,SPACE_SEQ, SPACE_VIEW3D)) { t->flag |= T_ALT_TRANSFORM; + t->redraw |= TREDRAW_HARD; + } break; default: @@ -1262,8 +1264,10 @@ int transformEvent(TransInfo *t, wmEvent *event) // break; case LEFTALTKEY: case RIGHTALTKEY: - if (t->spacetype == SPACE_SEQ) + if (ELEM(t->spacetype, SPACE_SEQ, SPACE_VIEW3D)) { t->flag &= ~T_ALT_TRANSFORM; + t->redraw |= TREDRAW_HARD; + } break; default: @@ -3947,10 +3951,8 @@ void initShrinkFatten(TransInfo *t) } - int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) { - float vec[3]; float distance; int i; char str[64]; @@ -3978,17 +3980,20 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) t->values[0] = -distance; for (i = 0; i < t->total; i++, td++) { + float tdistance; /* temp dist */ if (td->flag & TD_NOACTION) break; if (td->flag & TD_SKIP) continue; - copy_v3_v3(vec, td->axismtx[2]); - mul_v3_fl(vec, distance); - mul_v3_fl(vec, td->factor); + /* get the final offset */ + tdistance = distance * td->factor; + if (td->ext && (t->flag & T_ALT_TRANSFORM)) { + tdistance *= td->ext->isize[0]; /* shell factor */ + } - add_v3_v3v3(td->loc, td->iloc, vec); + madd_v3_v3v3fl(td->loc, td->iloc, td->axismtx[2], tdistance); } recalcData(t); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index f6b888d4881..8e268e46696 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1917,6 +1917,10 @@ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx tx->size = vs->radius; td->val = vs->radius; } + else if (t->mode == TFM_SHRINKFATTEN) { + td->ext = tx; + tx->isize[0] = BM_vert_calc_shell_factor(eve); + } } static void createTransEditVerts(TransInfo *t) @@ -2029,7 +2033,11 @@ static void createTransEditVerts(TransInfo *t) else t->total = countsel; tob = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Mesh EditMode)"); - if (t->mode == TFM_SKIN_RESIZE) { + if (ELEM(t->mode, TFM_SKIN_RESIZE, TFM_SHRINKFATTEN)) { + /* warning, this is overkill, we only need 2 extra floats, + * but this stores loads of extra stuff, for TFM_SHRINKFATTEN its even more overkill + * since we may not use the 'alt' transform mode to maintain shell thickness, + * but with generic transform code its hard to lazy init vars */ tx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension), "TransObData ext"); } |