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:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-05-16 11:20:25 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-05-16 12:02:26 +0300
commitb05038fef7e17aec518bc9ab2dbb7163628a3f4c (patch)
treed23dba8f459a25c4843eeeadb96aec16229891f4 /source/blender/makesrna/intern/rna_fcurve.c
parentc419f33dd20109aacbff356af572fa691d03372f (diff)
RNA: new FCurve.is_empty property that exposes the new empty curve check.
Diffstat (limited to 'source/blender/makesrna/intern/rna_fcurve.c')
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c14
1 files changed, 14 insertions, 0 deletions
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");