changes to mask editing

- 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.
This commit is contained in:
Campbell Barton 2012-07-31 17:31:34 +00:00
parent e597234cb5
commit 72a3fb15d7
6 changed files with 18 additions and 9 deletions

@ -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;

@ -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;
}

@ -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 */

@ -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;
}

@ -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) {

@ -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}
};