[Bf-blender-cvs] [7d611328076] master: Animation: improved error handling when adding/deleting keyframes

Sybren A. Stüvel noreply at git.blender.org
Fri Mar 6 11:37:54 CET 2020


Commit: 7d611328076654dc13934743483cd2996055bddb
Author: Sybren A. Stüvel
Date:   Fri Mar 6 11:36:37 2020 +0100
Branches: master
https://developer.blender.org/rB7d611328076654dc13934743483cd2996055bddb

Animation: improved error handling when adding/deleting keyframes

There are two ways in which adding/deleting keyframes can fail, but only
one of those was handled. The other would be shown as a successful
add/delete of -2 keyframes.

===================================================================

M	source/blender/editors/animation/keyframing.c

===================================================================

diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 1c60dcfbd52..22a42d56fcd 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1845,11 +1845,11 @@ static int insert_key_exec(bContext *C, wmOperator *op)
   }
 
   /* report failure or do updates? */
-  if (num_channels == MODIFYKEY_INVALID_CONTEXT) {
+  if (num_channels < 0) {
     BKE_report(op->reports, RPT_ERROR, "No suitable context info for active keying set");
     return OPERATOR_CANCELLED;
   }
-  else if (num_channels) {
+  else if (num_channels > 0) {
     /* if the appropriate properties have been set, make a note that we've inserted something */
     if (RNA_boolean_get(op->ptr, "confirm_success")) {
       BKE_reportf(op->reports,
@@ -2061,11 +2061,11 @@ static int delete_key_exec(bContext *C, wmOperator *op)
   }
 
   /* report failure or do updates? */
-  if (num_channels == MODIFYKEY_INVALID_CONTEXT) {
+  if (num_channels < 0) {
     BKE_report(op->reports, RPT_ERROR, "No suitable context info for active keying set");
     return OPERATOR_CANCELLED;
   }
-  else if (num_channels) {
+  else if (num_channels > 0) {
     /* if the appropriate properties have been set, make a note that we've inserted something */
     if (RNA_boolean_get(op->ptr, "confirm_success")) {
       BKE_reportf(op->reports,



More information about the Bf-blender-cvs mailing list