From b45200301500266ae094633c125bc626c17dde2a Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 4 Jul 2017 15:35:27 +1200 Subject: Fix T51879: NLA Influence can not be autokeyed As with Strip Time, the updates here would get triggered before the autokeying had a chance to record the unkeyed values, making it impossible to autokey. --- source/blender/makesrna/intern/rna_nla.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index e44a6420045..d72c858a5d5 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -659,7 +659,10 @@ static void rna_def_nlastrip(BlenderRNA *brna) prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Influence", "Amount the strip contributes to the current result"); - RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update"); + /* XXX: Update temporarily disabled so that the property can be edited at all! + * Even autokey only applies after the curves have been re-evaluated, causing the unkeyed values to be lost + */ + RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, /*"rna_NlaStrip_update"*/ NULL); prop = RNA_def_property(srna, "strip_time", PROP_FLOAT, PROP_TIME); RNA_def_property_ui_text(prop, "Strip Time", "Frame of referenced Action to evaluate"); -- cgit v1.2.3 From fdfcbfd0404183b78623bd7a65f2701ea23ed463 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 11 Jul 2017 18:07:11 +1200 Subject: Fix T52009: F-Curve "Stepped interpolation" modifier "restrict frame-range" IN and OUT parameters cannot be edited The problem here was that the "frame_start" and "frame_end" RNA properties of the Stepped FModifier were shadowing/overriding "frame_start" and "frame_end" properties of the base FModifier. As a result, when the range() callback for the In/Out parameters (defined as part of the base FModifier) checked it's start/end properties, they were always still zero, meaning that the acceptable range for the In/Out parameters was 0 -> 0 = 0. Note: If you've got old files with this problem, you'll need to manually click on the frame_start/end properties to flush out the old values. It's probably not worth the effort of applying a version patch for this (given that this modifier is not one of the most often used ones AFAIK). --- source/blender/makesrna/intern/rna_fcurve.c | 37 +++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index bccc47aa95d..648c6032520 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -581,6 +581,7 @@ static void rna_FModifier_blending_range(PointerRNA *ptr, float *min, float *max *min = 0.0f; *max = fcm->efra - fcm->sfra; + printf("blending range: %f -> %f (%f, %f)\n", *min, *max, fcm->sfra, fcm->efra); } static void rna_FModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -765,6 +766,38 @@ static void rna_FModifierStepped_end_frame_range(PointerRNA *ptr, float *min, fl *max = MAXFRAMEF; } +static void rna_FModifierStepped_frame_start_set(PointerRNA *ptr, float value) +{ + FModifier *fcm = (FModifier *)ptr->data; + FMod_Stepped *data = fcm->data; + + float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max; + rna_FModifierStepped_start_frame_range(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max); + value = CLAMPIS(value, prop_clamp_min, prop_clamp_max); + + /* Need to set both step-data's start/end and the start/end on the base-data, + * or else Restrict-Range doesn't work due to RNA-property shadowing (T52009) + */ + data->start_frame = value; + fcm->sfra = value; +} + +static void rna_FModifierStepped_frame_end_set(PointerRNA *ptr, float value) +{ + FModifier *fcm = (FModifier *)ptr->data; + FMod_Stepped *data = fcm->data; + + float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max; + rna_FModifierStepped_end_frame_range(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max); + value = CLAMPIS(value, prop_clamp_min, prop_clamp_max); + + /* Need to set both step-data's start/end and the start/end on the base-data, + * or else Restrict-Range doesn't work due to RNA-property shadowing (T52009) + */ + data->end_frame = value; + fcm->efra = value; +} + static BezTriple *rna_FKeyframe_points_insert(FCurve *fcu, float frame, float value, int keyframe_type, int flag) { int index = insert_vert_fcurve(fcu, frame, value, (char)keyframe_type, flag | INSERTKEY_NO_USERPREF); @@ -1284,13 +1317,13 @@ static void rna_def_fmodifier_stepped(BlenderRNA *brna) prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "start_frame"); - RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierStepped_start_frame_range"); + RNA_def_property_float_funcs(prop, NULL, "rna_FModifierStepped_frame_start_set", "rna_FModifierStepped_start_frame_range"); RNA_def_property_ui_text(prop, "Start Frame", "Frame that modifier's influence starts (if applicable)"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "end_frame"); - RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierStepped_end_frame_range"); + RNA_def_property_float_funcs(prop, NULL, "rna_FModifierStepped_frame_end_set", "rna_FModifierStepped_end_frame_range"); RNA_def_property_ui_text(prop, "End Frame", "Frame that modifier's influence ends (if applicable)"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); } -- cgit v1.2.3 From cd3b3e4a57c19bd94cd02cb041a908e2418fa4b0 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 11 Jul 2017 23:39:35 +1200 Subject: Fix: Accidentally left debug print in last commit --- source/blender/makesrna/intern/rna_fcurve.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 648c6032520..ad63a652b12 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -581,7 +581,6 @@ static void rna_FModifier_blending_range(PointerRNA *ptr, float *min, float *max *min = 0.0f; *max = fcm->efra - fcm->sfra; - printf("blending range: %f -> %f (%f, %f)\n", *min, *max, fcm->sfra, fcm->efra); } static void rna_FModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -- cgit v1.2.3