[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61105] trunk/blender/source/blender/ makesrna/intern/rna_fcurve.c: Bugfix [#36844] Cannot set Restrict Frame Start for FModifiers until Frame End

Joshua Leung aligorith at gmail.com
Tue Nov 5 01:19:21 CET 2013


Revision: 61105
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61105
Author:   aligorith
Date:     2013-11-05 00:19:21 +0000 (Tue, 05 Nov 2013)
Log Message:
-----------
Bugfix [#36844] Cannot set Restrict Frame Start for FModifiers until Frame End
has been adjusted

Previously, the RNA settings tried to strictly enforce the constraint that the
start frame must be less than the end frame. However, this behaviour was
problematic, as it meant that you had to firstly move the end frame to its new
(higher) value, before moving the start frame. The same also applied in the
opposite direction.

Now, this behaves in the same way that the scene start/end buttons work: if the
new start frame is past the end frame, the end frame is "pushed" along to be the
same value as the start frame. The same applies in the opposite direction.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_fcurve.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_fcurve.c	2013-11-04 23:33:23 UTC (rev 61104)
+++ trunk/blender/source/blender/makesrna/intern/rna_fcurve.c	2013-11-05 00:19:21 UTC (rev 61105)
@@ -453,28 +453,66 @@
 
 static void rna_FModifier_active_set(PointerRNA *ptr, int UNUSED(value))
 {
-	FModifier *fm = (FModifier *)ptr->data;
+	FModifier *fcm = (FModifier *)ptr->data;
 
 	/* don't toggle, always switch on */
-	fm->flag |= FMODIFIER_FLAG_ACTIVE;
+	fcm->flag |= FMODIFIER_FLAG_ACTIVE;
 }
 
+static void rna_FModifier_start_frame_set(PointerRNA *ptr, float value)
+{
+	FModifier *fcm = (FModifier *)ptr->data;
+	
+	CLAMP(value, MINAFRAME, MAXFRAME);
+	fcm->sfra = value;
+	
+	/* XXX: maintain old offset? */
+	if (fcm->sfra >= fcm->efra) {
+		fcm->efra = fcm->sfra;
+	}
+}
+
+static void rna_FModifer_end_frame_set(PointerRNA *ptr, float value)
+{
+	FModifier *fcm = (FModifier *)ptr->data;
+	
+	CLAMP(value, MINAFRAME, MAXFRAME);
+	fcm->efra = value;
+	
+	/* XXX: maintain old offset? */
+	if (fcm->efra <= fcm->sfra) {
+		fcm->sfra = fcm->efra;
+	}
+}
+
 static void rna_FModifier_start_frame_range(PointerRNA *ptr, float *min, float *max,
-                                            float *UNUSED(softmin), float *UNUSED(softmax))
+                                            float *softmin, float *softmax)
 {
 	FModifier *fcm = (FModifier *)ptr->data;
 	
-	*min = MINAFRAMEF;
-	*max = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->efra : MAXFRAMEF;
+	/* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that, 
+	 * or else it becomes tricky to adjust the range...  [#36844] 
+	 */
+	*min     = MINAFRAMEF;
+	*softmin = MINAFRAMEF;
+	
+	*softmax = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->efra : MAXFRAMEF;
+	*max     = MAXFRAMEF;
 }
 
 static void rna_FModifier_end_frame_range(PointerRNA *ptr, float *min, float *max,
-                                          float *UNUSED(softmin), float *UNUSED(softmax))
+                                          float *softmin, float *softmax)
 {
 	FModifier *fcm = (FModifier *)ptr->data;
-
-	*min = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->sfra : MINAFRAMEF;
-	*max = MAXFRAMEF;
+	
+	/* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that, 
+	 * or else it becomes tricky to adjust the range...  [#36844] 
+	 */
+	*min     = MINAFRAMEF;
+	*softmin = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->sfra : MINAFRAMEF;
+	
+	*softmax = MAXFRAMEF;
+	*max     = MAXFRAMEF;
 }
 
 static void rna_FModifier_blending_range(PointerRNA *ptr, float *min, float *max,
@@ -1191,14 +1229,14 @@
 	
 	prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sfra");
-	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_start_frame_range");
+	RNA_def_property_float_funcs(prop, NULL, "rna_FModifier_start_frame_set", "rna_FModifier_start_frame_range");
 	RNA_def_property_ui_text(prop, "Start Frame",
 	                         "Frame that modifier's influence starts (if Restrict Frame Range is in use)");
 	RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
 	
 	prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "efra");
-	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_end_frame_range");
+	RNA_def_property_float_funcs(prop, NULL, "rna_FModifer_end_frame_set", "rna_FModifier_end_frame_range");
 	RNA_def_property_ui_text(prop, "End Frame",
 	                         "Frame that modifier's influence ends (if Restrict Frame Range is in use)");
 	RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);




More information about the Bf-blender-cvs mailing list