diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-10-01 04:56:36 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-10-01 04:56:36 +0400 |
commit | 471ea617b2dbe002ed57ef06a7ea6ab83f0924b7 (patch) | |
tree | 1162fd2d03a58cba7d069db37f421cb30645274e | |
parent | b05a3f7e42359e2a067d40f1edf10b6431390012 (diff) |
Bugfix [#28781] Grease pencil segfaults when deleting or duplicating
frames in dopesheet
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index fdf9209c813..a05053a2d9d 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -459,6 +459,8 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op) /* copy keyframes */ if (ac.datatype == ANIMCONT_GPENCIL) { // FIXME... + BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for Grease Pencil mode"); + return OPERATOR_CANCELLED; } else { if (copy_action_keys(&ac)) { @@ -497,13 +499,15 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - if(ac.reports==NULL) { + if (ac.reports==NULL) { ac.reports= op->reports; } /* paste keyframes */ if (ac.datatype == ANIMCONT_GPENCIL) { // FIXME... + BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for Grease Pencil mode"); + return OPERATOR_CANCELLED; } else { if (paste_action_keys(&ac, offset_mode, merge_mode)) { @@ -680,12 +684,13 @@ static int actkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) duplicate_action_keys(&ac); /* validate keyframes after editing */ - ANIM_editkeyframes_refresh(&ac); + if (ac.datatype != ANIMCONT_GPENCIL) + ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); - return OPERATOR_FINISHED; // xxx - start transform + return OPERATOR_FINISHED; } static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) @@ -709,9 +714,6 @@ void ACTION_OT_duplicate (wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - /* to give to transform */ - RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", ""); } /* ******************** Delete Keyframes Operator ************************* */ @@ -764,7 +766,8 @@ static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) delete_action_keys(&ac); /* validate keyframes after editing */ - ANIM_editkeyframes_refresh(&ac); + if (ac.datatype != ANIMCONT_GPENCIL) + ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); @@ -1381,6 +1384,10 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; + // XXX... + if (ac.datatype == ANIMCONT_GPENCIL) + return OPERATOR_PASS_THROUGH; + /* get snapping mode */ mode= RNA_enum_get(op->ptr, "type"); @@ -1491,6 +1498,10 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; + // XXX... + if (ac.datatype == ANIMCONT_GPENCIL) + return OPERATOR_PASS_THROUGH; + /* get mirroring mode */ mode= RNA_enum_get(op->ptr, "type"); |