changes to mask editing
authorCampbell Barton <ideasman42@gmail.com>
Tue, 31 Jul 2012 17:31:34 +0000 (17:31 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 31 Jul 2012 17:31:34 +0000 (17:31 +0000)
- use Alt to modify all mask feather at once while dragging.
- copying a multi-user mask from the interface works now.
- show masks when UV editing isnt used, rather then checking editmode (would give some odd/annoying image space header).
- add a fake mask user by default.
- moving points with LMB drag no longer selects them.

source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/mask.c
source/blender/editors/mask/mask_ops.c
source/blender/editors/space_image/image_edit.c
source/blender/editors/space_image/space_image.c
source/blender/makesrna/intern/rna_space.c

index 98133b936d504f79f95fba2ecbfaa34f0de9edba..e073cfdf76df57c675b1c4c78e8c36168dae8fd8 100644 (file)
@@ -362,6 +362,7 @@ int id_copy(ID *id, ID **newid, int test)
                        return 0; /* not implemented */
                case ID_MSK:
                        if (!test) *newid = (ID *)BKE_mask_copy((Mask *)id);
+                       return 1;
        }
        
        return 0;
index bb6e4d82bd26b0cc7a8203d60ab32429ebb654bd..b3f146586a8d2992333c477d6c78e30a0c65f23a 100644 (file)
@@ -1339,6 +1339,8 @@ static Mask *mask_alloc(const char *name)
 
        mask = BKE_libblock_alloc(&G.main->mask, ID_MSK, name);
 
+       mask->id.flag |= LIB_FAKEUSER;
+
        return mask;
 }
 
index 7ee9eec34b59feab4fac65a2ade7d67c60cfcfd1..1df1e5a66fe6f5e9336f4e3a97d904720bb5bd55 100644 (file)
@@ -526,6 +526,7 @@ static int slide_point_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
                WM_event_add_modal_handler(C, op);
 
+#if 0
                if (slidedata->uw) {
                        if ((slidedata->uw->flag & SELECT) == 0) {
                                ED_mask_select_toggle_all(mask, SEL_DESELECT);
@@ -542,6 +543,7 @@ static int slide_point_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
                        ED_mask_select_flush_all(mask);
                }
+#endif
 
                slidedata->masklay->act_spline = slidedata->spline;
                slidedata->masklay->act_point = slidedata->point;
@@ -629,19 +631,19 @@ static int slide_point_modal(bContext *C, wmOperator *op, wmEvent *event)
        float co[2], dco[2];
 
        switch (event->type) {
-               case LEFTCTRLKEY:
-               case RIGHTCTRLKEY:
+               case LEFTALTKEY:
+               case RIGHTALTKEY:
                case LEFTSHIFTKEY:
                case RIGHTSHIFTKEY:
-                       if (ELEM(event->type, LEFTCTRLKEY, RIGHTCTRLKEY)) {
+                       if (ELEM(event->type, LEFTALTKEY, RIGHTALTKEY)) {
                                if (data->action == SLIDE_ACTION_FEATHER)
-                                       data->overall_feather = event->val == KM_PRESS;
+                                       data->overall_feather = (event->val == KM_PRESS);
                                else
-                                       data->curvature_only = event->val == KM_PRESS;
+                                       data->curvature_only = (event->val == KM_PRESS);
                        }
 
                        if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY))
-                               data->accurate = event->val == KM_PRESS;
+                               data->accurate = (event->val == KM_PRESS);
 
                /* no break! update CV position */
 
index 899685d0dc2e6c8f00b1a71a4cd060a161efdc7f..c0b6dc656c2559116257182363cb1b6c5d512ed5 100644 (file)
@@ -95,6 +95,10 @@ void ED_space_image_set_mask(bContext *C, SpaceImage *sima, Mask *mask)
 {
        sima->mask_info.mask = mask;
 
+       /* weak, but same as image/space */
+       if (sima->mask_info.mask && sima->mask_info.mask->id.us == 0)
+               sima->mask_info.mask->id.us = 1;
+
        if (C) {
                WM_event_add_notifier(C, NC_MASK | NA_SELECTED, mask);
        }
@@ -356,7 +360,7 @@ int ED_space_image_check_show_maskedit(Scene *scene, SpaceImage *sima)
 {
        /* check editmode - this is reserved for UV editing */
        Object *ob = OBACT;
-       if (ob && ob->mode & OB_MODE_EDIT) {
+       if (ob && ob->mode & OB_MODE_EDIT && ED_space_image_show_uvedit(sima, ob)) {
                return FALSE;
        }
 
index 1ef319c45e2b31aaf8a1f2520c70995486bb08fa..79cc1eba898fd4e408ec819f020fa0be78af8c69 100644 (file)
@@ -613,7 +613,7 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
        draw_uvedit_main(sima, ar, scene, obedit, obact);
 
        /* check for mask (delay draw) */
-       if (obedit) {
+       if (ED_space_image_show_uvedit(sima, obedit)) {
                /* pass */
        }
        else if (sima->mode == SI_MODE_MASK) {
index 74f6b16a111b4960a9b4d000eaaf89163ab83a2a..6fd26e0f8c5c75346c2f08cc0b81771234864527 100644 (file)
@@ -123,7 +123,7 @@ EnumPropertyItem clip_editor_mode_items[] = {
        {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction",
                                 "Show tracking/reconstruction tools"},
        {SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
-       {SC_MODE_MASKEDIT, "MASK", ICON_MOD_MASK, "Mask editing", "Show mask editing tools"},
+       {SC_MODE_MASKEDIT, "MASK", ICON_MOD_MASK, "Mask", "Show mask editing tools"},
        {0, NULL, 0, NULL, NULL}
 };