[Bf-blender-cvs] [e6da7bb75c8] master: Fix T52346: Alt-I (Delete Keyframes) on a NlaStrip's Extrapolate property would crash

Joshua Leung noreply at git.blender.org
Fri Aug 11 15:52:58 CEST 2017


Commit: e6da7bb75c8eff13185a56a144dce920b3886ecb
Author: Joshua Leung
Date:   Sat Aug 12 01:52:51 2017 +1200
Branches: master
https://developer.blender.org/rBe6da7bb75c8eff13185a56a144dce920b3886ecb

Fix T52346: Alt-I (Delete Keyframes) on a NlaStrip's Extrapolate property would crash

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

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

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

diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index e11d8bb1bba..540886196fe 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1786,7 +1786,9 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
 			NlaStrip *strip = (NlaStrip *)ptr.data;
 			FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index);
 			
-			success = insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, ts->keyframe_type, 0);
+			if (fcu) {
+				success = insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, ts->keyframe_type, 0);
+			}
 		}
 		else if (UI_but_flag_is_set(but, UI_BUT_DRIVEN)) {
 			/* Driven property - Find driver */
@@ -1891,27 +1893,27 @@ static int delete_key_button_exec(bContext *C, wmOperator *op)
 			NlaStrip *strip = (NlaStrip *)ptr.data;
 			FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), 0);
 			
-			BLI_assert(fcu != NULL); /* NOTE: This should be true, or else we wouldn't be able to get here */
-			
-			if (BKE_fcurve_is_protected(fcu)) {
-				BKE_reportf(op->reports, RPT_WARNING,
-				            "Not deleting keyframe for locked F-Curve for NLA Strip influence on %s - %s '%s'",
-				            strip->name, BKE_idcode_to_name(GS(id->name)), id->name + 2);
-			}
-			else {
-				/* remove the keyframe directly
-				 * NOTE: cannot use delete_keyframe_fcurve(), as that will free the curve,
-				 *       and delete_keyframe() expects the FCurve to be part of an action
-				 */
-				bool found = false;
-				int i;
-				
-				/* try to find index of beztriple to get rid of */
-				i = binarysearch_bezt_index(fcu->bezt, cfra, fcu->totvert, &found);
-				if (found) {
-					/* delete the key at the index (will sanity check + do recalc afterwards) */
-					delete_fcurve_key(fcu, i, 1);
-					success = true;
+			if (fcu) {
+				if (BKE_fcurve_is_protected(fcu)) {
+					BKE_reportf(op->reports, RPT_WARNING,
+					            "Not deleting keyframe for locked F-Curve for NLA Strip influence on %s - %s '%s'",
+					            strip->name, BKE_idcode_to_name(GS(id->name)), id->name + 2);
+				}
+				else {
+					/* remove the keyframe directly
+					 * NOTE: cannot use delete_keyframe_fcurve(), as that will free the curve,
+					 *       and delete_keyframe() expects the FCurve to be part of an action
+					 */
+					bool found = false;
+					int i;
+					
+					/* try to find index of beztriple to get rid of */
+					i = binarysearch_bezt_index(fcu->bezt, cfra, fcu->totvert, &found);
+					if (found) {
+						/* delete the key at the index (will sanity check + do recalc afterwards) */
+						delete_fcurve_key(fcu, i, 1);
+						success = true;
+					}
 				}
 			}
 		}




More information about the Bf-blender-cvs mailing list