[Bf-blender-cvs] [4812eda3c5d] master: Animation RNA: Add `clear()` method to FCurveKeyframePoints

Colin Basnett noreply at git.blender.org
Tue Jul 19 15:58:19 CEST 2022


Commit: 4812eda3c5d14c672e91ef11182e1a875c070b10
Author: Colin Basnett
Date:   Tue Jul 19 15:57:31 2022 +0200
Branches: master
https://developer.blender.org/rB4812eda3c5d14c672e91ef11182e1a875c070b10

Animation RNA: Add `clear()` method to FCurveKeyframePoints

Add `FCurveKeyframePoints.clear()` method to delete all keyframe points
from an FCurve.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15283

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

M	source/blender/makesrna/intern/rna_fcurve.c

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

diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 461536ffb8a..727d329781d 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -1031,6 +1031,13 @@ static void rna_FKeyframe_points_remove(
   rna_tag_animation_update(bmain, id);
 }
 
+static void rna_FKeyframe_points_clear(ID *id, FCurve *fcu, Main *bmain)
+{
+  BKE_fcurve_delete_keys_all(fcu);
+
+  rna_tag_animation_update(bmain, id);
+}
+
 static FCM_EnvelopeData *rna_FModifierEnvelope_points_add(
     ID *id, FModifier *fmod, Main *bmain, ReportList *reports, float frame)
 {
@@ -2310,6 +2317,10 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop)
   /* optional */
   RNA_def_boolean(
       func, "fast", 0, "Fast", "Fast keyframe removal to avoid recalculating the curve each time");
+
+  func = RNA_def_function(srna, "clear", "rna_FKeyframe_points_clear");
+  RNA_def_function_ui_description(func, "Remove all keyframes from an F-Curve");
+  RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
 }
 
 static void rna_def_fcurve(BlenderRNA *brna)



More information about the Bf-blender-cvs mailing list