diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2012-08-06 17:40:29 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2012-08-06 17:40:29 +0400 |
commit | 731c6ebec441ac577498e5673679df9e2a7d9bee (patch) | |
tree | 2d50fedf5aad5e5ad0ed399e2b248a3f830fdc80 | |
parent | 21a137471d4ff9aaa1357d2a9842f4114508dbba (diff) |
Patch [#32246] (Bugfix): UV editor -> "Proportional edit" together with "constrain to bounds" does not work.
Patch reviewed by Campbell Barton. Thanks!
-rw-r--r-- | source/blender/editors/transform/transform.c | 19 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.h | 1 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 20 |
3 files changed, 39 insertions, 1 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index acda6c3d399..0b23b65f250 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2932,6 +2932,14 @@ int Resize(TransInfo *t, const int mval[2]) for (i = 0, td = t->data; i < t->total; i++, td++) ElementResize(t, td, mat); + + /* In proportional edit it can happen that */ + /* vertices in the radius of the brush end */ + /* outside the clipping area */ + /* XXX HACK - dg */ + if(t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) { + clipUVData(t); + } } recalcData(t); @@ -3787,9 +3795,18 @@ int Translation(TransInfo *t, const int UNUSED(mval[2])) applyTranslation(t, t->values); /* evil hack - redo translation if clipping needed */ - if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values, 0)) + if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values, 0)) { applyTranslation(t, t->values); + /* In proportional edit it can happen that */ + /* vertices in the radius of the brush end */ + /* outside the clipping area */ + /* XXX HACK - dg */ + if(t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) { + clipUVData(t); + } + } + recalcData(t); ED_area_headerprint(t->sa, str); diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 1585fb1ad6b..8a7148aad95 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -562,6 +562,7 @@ void remake_graph_transdata(TransInfo *t, struct ListBase *anim_data); void flushTransUVs(TransInfo *t); void flushTransParticles(TransInfo *t); int clipUVTransform(TransInfo *t, float *vec, int resize); +void clipUVData(TransInfo *t); void flushTransNodes(TransInfo *t); void flushTransSeq(TransInfo *t); void flushTransTracking(TransInfo *t); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 0fdd8736248..f5d9612e832 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2494,6 +2494,26 @@ int clipUVTransform(TransInfo *t, float *vec, int resize) return (clipx || clipy); } +void clipUVData(TransInfo *t) +{ + TransData *td = NULL; + int a; + float aspx, aspy; + + ED_space_image_get_uv_aspect(t->sa->spacedata.first, &aspx, &aspy); + + for (a = 0, td = t->data; a < t->total; a++, td++) { + if (td->flag & TD_NOACTION) + break; + + if ((td->flag & TD_SKIP) || (!td->loc)) + continue; + + td->loc[0] = MIN2(MAX2(0.0f, td->loc[0]), aspx); + td->loc[1] = MIN2(MAX2(0.0f, td->loc[1]), aspy); + } +} + /* ********************* ANIMATION EDITORS (GENERAL) ************************* */ /* This function tests if a point is on the "mouse" side of the cursor/frame-marking */ |