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:
authorJoshua Leung <aligorith@gmail.com>2014-03-05 10:38:14 +0400
committerJoshua Leung <aligorith@gmail.com>2014-03-07 17:16:01 +0400
commit3e26a7a594a9f2d91cba48ba70d30e3ca38a5505 (patch)
treec71f869e7e99a2483aa43a916b52854839eedcb0 /source/blender/makesrna
parent6e7ce9770f7efd5b7a1189caae50c4efbfd933ca (diff)
Fix T38774: Changing extrapolation type via RNA doesn't update FCurve
- Added update callback to perform on-update validation when changing the extrapolation mode on F-Curves - There was a patch in the tracker for adding an "update()" method to F-Curves which does a similar thing when manually called by scripts. Since we've added a function for this in RNA anyways, we might as well add this too while we're at it. (NOTE: upon closer inspection, the original patch by Tom Edwards had a number of issues, so I ended up reimplementing here)
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 4e193929e95..b4438f5da62 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -429,6 +429,21 @@ static void rna_FCurve_range(FCurve *fcu, float range[2])
}
+/* allow scripts to update curve after editing manually */
+static void rna_FCurve_update_data_ex(FCurve *fcu)
+{
+ sort_time_fcurve(fcu);
+ testhandles_fcurve(fcu, TRUE);
+}
+
+/* RNA update callback for F-Curves after curve shape changes */
+static void rna_FCurve_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ BLI_assert(ptr->type == &RNA_FCurve);
+ rna_FCurve_update_data_ex((FCurve *)ptr->data);
+}
+
+
static PointerRNA rna_FCurve_active_modifier_get(PointerRNA *ptr)
{
FCurve *fcu = (FCurve *)ptr->data;
@@ -1768,7 +1783,7 @@ static void rna_def_fcurve(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "extend");
RNA_def_property_enum_items(prop, prop_mode_extend_items);
RNA_def_property_ui_text(prop, "Extrapolation", "");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FCurve_update_data");
/* Pointers */
prop = RNA_def_property(srna, "driver", PROP_POINTER, PROP_NONE);
@@ -1863,9 +1878,13 @@ static void rna_def_fcurve(BlenderRNA *brna)
"Evaluate F-Curve at given frame", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(parm, PROP_REQUIRED);
/* return value */
- parm = RNA_def_float(func, "position", 0, -FLT_MAX, FLT_MAX, "Position", "F-Curve position", -FLT_MAX, FLT_MAX);
+ parm = RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "Value", "Value of F-Curve specific frame", -FLT_MAX, FLT_MAX);
RNA_def_function_return(func, parm);
+ /* -- update / recalculate -- */
+ func = RNA_def_function(srna, "update", "rna_FCurve_update_data_ex");
+ RNA_def_function_ui_description(func, "Ensure keyframes are sorted in chronological order and handles are set correctly");
+
/* -- time extents/range -- */
func = RNA_def_function(srna, "range", "rna_FCurve_range");
RNA_def_function_ui_description(func, "Get the time extents for F-Curve");