Revision: 47207 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47207 Author: campbellbarton Date: 2012-05-30 07:15:09 +0000 (Wed, 30 May 2012) Log Message: ----------- proportional editing for mask transform
Modified Paths: -------------- branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c =================================================================== --- branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c 2012-05-30 06:42:03 UTC (rev 47206) +++ branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c 2012-05-30 07:15:09 UTC (rev 47207) @@ -52,6 +52,7 @@ #include "IMB_imbuf_types.h" #include "ED_mask.h" +#include "ED_space_api.h" #include "ED_screen.h" #include "ED_clip.h" #include "ED_transform.h" @@ -1137,6 +1138,8 @@ ED_mask_draw((bContext *)C); + ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); + glPopMatrix(); } Modified: branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c =================================================================== --- branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c 2012-05-30 06:42:03 UTC (rev 47206) +++ branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c 2012-05-30 07:15:09 UTC (rev 47207) @@ -5885,17 +5885,19 @@ MaskSplinePoint *point; } TransDataMasking; -static void MaskPointToTransData(SpaceClip *sc, MaskSplinePoint *point, TransData *td, TransData2D *td2d, TransDataMasking *tdm) +static void MaskPointToTransData(SpaceClip *sc, MaskSplinePoint *point, + TransData *td, TransData2D *td2d, TransDataMasking *tdm, int propmode) { BezTriple *bezt = &point->bezt; float aspx, aspy; + short is_sel_point = MASKPOINT_ISSEL(point); tdm->point = point; copy_m3_m3(tdm->vec, bezt->vec); ED_space_clip_mask_aspect(sc, &aspx, &aspy); - if (MASKPOINT_CV_ISSEL(point)) { + if (propmode || is_sel_point) { int i; for (i = 0; i < 3; i++) { /* CV coords are scaled by aspects. this is needed for rotations and @@ -5918,7 +5920,9 @@ td->ext= NULL; td->val= NULL; - td->flag |= TD_SELECTED; + if (is_sel_point) { + td->flag |= TD_SELECTED; + } td->dist= 0.0; unit_m3(td->mtx); @@ -5951,7 +5955,10 @@ td->ext= NULL; td->val= NULL; - td->flag |= TD_SELECTED; + if (is_sel_point) { + td->flag |= TD_SELECTED; + } + td->dist= 0.0; unit_m3(td->mtx); @@ -5970,6 +5977,8 @@ TransData *td = NULL; TransData2D *td2d = NULL; TransDataMasking *tdm = NULL; + int count = 0, countsel = 0; + int propmode = t->flag & T_PROP_EDIT; /* count */ for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) { @@ -5987,17 +5996,21 @@ if (MASKPOINT_ISSEL(point)) { if (MASKPOINT_CV_ISSEL(point)) - t->total += 3; + countsel += 3; else - t->total += 1; + countsel += 1; } + + if (propmode) + count += 3; } } } - if (t->total == 0) - return; + /* note: in prop mode we need at least 1 selected */ + if (countsel == 0) return; + t->total = (propmode) ? count: countsel; td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransObData(Mask Editing)"); /* for each 2d uv coord a 3d vector is allocated, so that they can be * treated just as if they were 3d verts */ @@ -6020,10 +6033,10 @@ for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; - if (MASKPOINT_ISSEL(point)) { - MaskPointToTransData(sc, point, td, td2d, tdm); + if (propmode || MASKPOINT_ISSEL(point)) { + MaskPointToTransData(sc, point, td, td2d, tdm, propmode); - if (MASKPOINT_CV_ISSEL(point)) { + if (propmode || MASKPOINT_CV_ISSEL(point)) { td += 3; td2d += 3; tdm += 3; @@ -6130,8 +6143,15 @@ t->flag |= T_POINTS|T_2D_EDIT; if (t->options & CTX_MOVIECLIP) createTransTrackingData(C, t); - else if (t->options & CTX_MASK) + else if (t->options & CTX_MASK) { createTransMaskingData(C, t); + + if (t->data && (t->flag & T_PROP_EDIT)) { + sort_trans_data(t); // makes selected become first in array + set_prop_dist(t, TRUE); + sort_trans_data_dist(t); + } + } } else if (t->obedit) { t->ext = NULL; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs