~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/editors/mask/mask_edit.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
363
363
        }
364
364
}
365
365
 
 
366
void ED_mask_cursor_location_get(ScrArea *sa, float cursor[2])
 
367
{
 
368
        if (sa) {
 
369
                switch (sa->spacetype) {
 
370
                        case SPACE_CLIP:
 
371
                        {
 
372
                                SpaceClip *space_clip = sa->spacedata.first;
 
373
                                copy_v2_v2(cursor, space_clip->cursor);
 
374
                                break;
 
375
                        }
 
376
                        case SPACE_SEQ:
 
377
                        {
 
378
                                zero_v2(cursor);
 
379
                                break;
 
380
                        }
 
381
                        case SPACE_IMAGE:
 
382
                        {
 
383
                                SpaceImage *space_image = sa->spacedata.first;
 
384
                                copy_v2_v2(cursor, space_image->cursor);
 
385
                                break;
 
386
                        }
 
387
                        default:
 
388
                                /* possible other spaces from which mask editing is available */
 
389
                                BLI_assert(0);
 
390
                                zero_v2(cursor);
 
391
                                break;
 
392
                }
 
393
        }
 
394
        else {
 
395
                BLI_assert(0);
 
396
                zero_v2(cursor);
 
397
        }
 
398
}
 
399
 
366
400
/********************** registration *********************/
367
401
 
368
402
void ED_operatortypes_mask(void)
376
410
        /* add */
377
411
        WM_operatortype_append(MASK_OT_add_vertex);
378
412
        WM_operatortype_append(MASK_OT_add_feather_vertex);
 
413
        WM_operatortype_append(MASK_OT_primitive_circle_add);
 
414
        WM_operatortype_append(MASK_OT_primitive_square_add);
379
415
 
380
416
        /* geometry */
381
417
        WM_operatortype_append(MASK_OT_switch_direction);
390
426
        WM_operatortype_append(MASK_OT_select_circle);
391
427
        WM_operatortype_append(MASK_OT_select_linked_pick);
392
428
        WM_operatortype_append(MASK_OT_select_linked);
 
429
        WM_operatortype_append(MASK_OT_select_more);
 
430
        WM_operatortype_append(MASK_OT_select_less);
393
431
 
394
432
        /* hide/reveal */
395
433
        WM_operatortype_append(MASK_OT_hide_view_clear);
415
453
 
416
454
        /* layers */
417
455
        WM_operatortype_append(MASK_OT_layer_move);
 
456
 
 
457
        /* duplicate */
 
458
        WM_operatortype_append(MASK_OT_duplicate);
418
459
}
419
460
 
420
461
void ED_keymap_mask(wmKeyConfig *keyconf)
427
468
 
428
469
        WM_keymap_add_item(keymap, "MASK_OT_new", NKEY, KM_PRESS, KM_ALT, 0);
429
470
 
 
471
        /* add menu */
 
472
        WM_keymap_add_menu(keymap, "MASK_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
 
473
 
430
474
        /* mask mode supports PET now */
431
475
        ED_keymap_proportional_cycle(keyconf, keymap);
432
476
        ED_keymap_proportional_maskmode(keyconf, keymap);
466
510
        kmi = WM_keymap_add_item(keymap, "MASK_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_SHIFT | KM_ALT, 0);
467
511
        RNA_boolean_set(kmi->ptr, "deselect", TRUE);
468
512
 
 
513
        WM_keymap_add_item(keymap, "MASK_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
 
514
        WM_keymap_add_item(keymap, "MASK_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
 
515
 
469
516
        /* hide/reveal */
470
517
        WM_keymap_add_item(keymap, "MASK_OT_hide_view_clear", HKEY, KM_PRESS, KM_ALT, 0);
471
518
        kmi = WM_keymap_add_item(keymap, "MASK_OT_hide_view_set", HKEY, KM_PRESS, 0, 0);
495
542
        WM_keymap_add_item(keymap, "MASK_OT_shape_key_insert", IKEY, KM_PRESS, 0, 0);
496
543
        WM_keymap_add_item(keymap, "MASK_OT_shape_key_clear", IKEY, KM_PRESS, KM_ALT, 0);
497
544
 
 
545
        /* duplicate */
 
546
        WM_keymap_add_item(keymap, "MASK_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
 
547
 
498
548
        /* for image editor only */
499
549
        WM_keymap_add_item(keymap, "UV_OT_cursor_set", ACTIONMOUSE, KM_PRESS, 0, 0);
500
550
 
509
559
 
510
560
void ED_operatormacros_mask(void)
511
561
{
512
 
        /* XXX: just for sample */
513
562
        wmOperatorType *ot;
514
563
        wmOperatorTypeMacro *otmacro;
515
564
 
526
575
        WM_operatortype_macro_define(ot, "MASK_OT_add_feather_vertex");
527
576
        otmacro = WM_operatortype_macro_define(ot, "MASK_OT_slide_point");
528
577
        RNA_boolean_set(otmacro->ptr, "slide_feather", TRUE);
 
578
 
 
579
        ot = WM_operatortype_append_macro("MASK_OT_duplicate_move", "Add Duplicate", "Duplicate mask and move",
 
580
                                          OPTYPE_UNDO | OPTYPE_REGISTER);
 
581
        WM_operatortype_macro_define(ot, "MASK_OT_duplicate");
 
582
        otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 
583
        RNA_enum_set(otmacro->ptr, "proportional", 0);
 
584
        RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
529
585
}