Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Basnett <cmbasnett>2022-07-19 16:57:31 +0300
committerSybren A. Stüvel <sybren@blender.org>2022-07-19 16:58:37 +0300
commit4812eda3c5d14c672e91ef11182e1a875c070b10 (patch)
treef079722f0f71c713e22ed9d42920c8a5df4350e4 /source/blender/makesrna
parent2232855b50e90ef49d07df8ee4e3e0d0efb2cc4c (diff)
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
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c11
1 files changed, 11 insertions, 0 deletions
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)