[Bf-blender-cvs] [b05038fef7e] master: RNA: new FCurve.is_empty property that exposes the new empty curve check.

Alexander Gavrilov noreply at git.blender.org
Thu May 16 11:03:00 CEST 2019


Commit: b05038fef7e17aec518bc9ab2dbb7163628a3f4c
Author: Alexander Gavrilov
Date:   Thu May 16 11:20:25 2019 +0300
Branches: master
https://developer.blender.org/rBb05038fef7e17aec518bc9ab2dbb7163628a3f4c

RNA: new FCurve.is_empty property that exposes the new empty curve check.

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

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 63feceb4a8a..2574fb14b56 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -520,6 +520,12 @@ static void rna_FCurve_range(FCurve *fcu, float range[2])
   calc_fcurve_range(fcu, range, range + 1, false, false);
 }
 
+static bool rna_FCurve_is_empty_get(PointerRNA *ptr)
+{
+  FCurve *fcu = (FCurve *)ptr->data;
+  return BKE_fcurve_is_empty(fcu);
+}
+
 /* allow scripts to update curve after editing manually */
 static void rna_FCurve_update_data_ex(FCurve *fcu)
 {
@@ -2296,6 +2302,14 @@ static void rna_def_fcurve(BlenderRNA *brna)
       "when evaluating");
   RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
 
+  prop = RNA_def_property(srna, "is_empty", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_funcs(prop, "rna_FCurve_is_empty_get", NULL);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_ui_text(prop,
+                           "Empty",
+                           "True if the curve contributes no animation due to lack of "
+                           "keyframes or useful modifiers, and should be deleted");
+
   /* Collections */
   prop = RNA_def_property(srna, "sampled_points", PROP_COLLECTION, PROP_NONE);
   RNA_def_property_collection_sdna(prop, NULL, "fpt", "totvert");



More information about the Bf-blender-cvs mailing list