diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-12-03 17:07:43 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-12-03 17:07:43 +0400 |
commit | 582a9d1c45e5d75210a2d4010e55cd9a0f3673a2 (patch) | |
tree | b9e9a1d5303324029d49bf69c526538b216cacd8 /source/blender/editors/space_action | |
parent | 4f3fdb8d5a4a3b01de3c3660f6111cf911d9569f (diff) |
Fix for [#33378] Grease pencil dopesheet fails on a few operations
Snapping operator in action editor for grease pencil and mask wasn't implemented. We could probably re-enabled/fix/cleanup more things in this area (e.g. use a custom poll func for operators not supporting gp/mask, instead of silently doing nothing), but this is for after 2.65 imho).
Diffstat (limited to 'source/blender/editors/space_action')
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 5170914865c..092b738bab9 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -1412,15 +1412,20 @@ static void snap_action_keys(bAnimContext *ac, short mode) for (ale = anim_data.first; ale; ale = ale->next) { AnimData *adt = ANIM_nla_mapping_get(ac, ale); - if (adt) { + if (ale->type == ANIMTYPE_GPLAYER) { + ED_gplayer_snap_frames(ale->data, ac->scene, mode); + } + else if (ale->type == ANIMTYPE_MASKLAYER) { + ED_masklayer_snap_frames(ale->data, ac->scene, mode); + } + else if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve); ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } - //else if (ale->type == ACTTYPE_GPLAYER) - // snap_gplayer_frames(ale->data, mode); - else + else { ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve); + } } BLI_freelistN(&anim_data); @@ -1436,11 +1441,7 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op) /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - - /* XXX... */ - if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) - return OPERATOR_PASS_THROUGH; - + /* get snapping mode */ mode = RNA_enum_get(op->ptr, "type"); @@ -1448,7 +1449,8 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op) snap_action_keys(&ac, mode); /* validate keyframes after editing */ - ANIM_editkeyframes_refresh(&ac); + if (!ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) + ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); |