diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-29 17:41:00 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-29 18:18:11 +0300 |
commit | d140e70c496122915eb5c05aba83153e2e0d7998 (patch) | |
tree | 1e589247d69da64aa7b0e7802319237ec050b5d6 /source/blender/editors/mask/mask_edit.c | |
parent | 147bd16ed1bb3415b30408b0eab110d0854eadd2 (diff) | |
parent | 295d0c52a26730edc6d4ed1276e4051cce006be5 (diff) |
Merge branch 'master' into temp-ghash-experimentstemp-ghash-experiments
Note that 'store hash' feature was removed for now - to complex to maintain (conflicts)
and relatively easy to re-add if we ever really want this one day.
Conflicts:
source/blender/blenlib/BLI_ghash.h
source/blender/blenlib/intern/BLI_ghash.c
source/blender/blenlib/intern/hash_mm2a.c
source/blender/bmesh/tools/bmesh_region_match.c
tests/gtests/blenlib/BLI_ghash_performance_test.cc
tests/gtests/blenlib/BLI_ghash_test.cc
tests/gtests/blenlib/CMakeLists.txt
Diffstat (limited to 'source/blender/editors/mask/mask_edit.c')
-rw-r--r-- | source/blender/editors/mask/mask_edit.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c index e2eb32e86d9..e1a58d529b6 100644 --- a/source/blender/editors/mask/mask_edit.c +++ b/source/blender/editors/mask/mask_edit.c @@ -35,6 +35,7 @@ #include "BKE_context.h" #include "BKE_mask.h" +#include "DNA_mask_types.h" #include "DNA_scene_types.h" #include "WM_api.h" @@ -397,6 +398,58 @@ void ED_mask_cursor_location_get(ScrArea *sa, float cursor[2]) } } +bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2]) +{ + Mask *mask = CTX_data_edit_mask(C); + MaskLayer *mask_layer; + bool ok = false; + INIT_MINMAX2(min, max); + for (mask_layer = mask->masklayers.first; + mask_layer != NULL; + mask_layer = mask_layer->next) + { + MaskSpline *spline; + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + continue; + } + for (spline = mask_layer->splines.first; + spline != NULL; + spline = spline->next) + { + MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); + int i; + for (i = 0; i < spline->tot_point; i++) { + MaskSplinePoint *point = &spline->points[i]; + MaskSplinePoint *deform_point = &points_array[i]; + BezTriple *bezt = &point->bezt; + float handle[2]; + if (!MASKPOINT_ISSEL_ANY(point)) { + continue; + } + if (bezt->f2 & SELECT) { + minmax_v2v2_v2(min, max, deform_point->bezt.vec[1]); + } + if (BKE_mask_point_handles_mode_get(point) == MASK_HANDLE_MODE_STICK) { + BKE_mask_point_handle(deform_point, MASK_WHICH_HANDLE_STICK, handle); + minmax_v2v2_v2(min, max, handle); + } + else { + if ((bezt->f1 & SELECT) && (bezt->h1 != HD_VECT)) { + BKE_mask_point_handle(deform_point, MASK_WHICH_HANDLE_LEFT, handle); + minmax_v2v2_v2(min, max, handle); + } + if ((bezt->f3 & SELECT) && (bezt->h2 != HD_VECT)) { + BKE_mask_point_handle(deform_point, MASK_WHICH_HANDLE_RIGHT, handle); + minmax_v2v2_v2(min, max, handle); + } + } + ok = true; + } + } + } + return ok; +} + /********************** registration *********************/ void ED_operatortypes_mask(void) |