[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21399] branches/soc-2009-aligorith/source /blender: NLA SoC: Current Frame can now be negative

Joshua Leung aligorith at gmail.com
Tue Jul 7 08:56:30 CEST 2009


Revision: 21399
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21399
Author:   aligorith
Date:     2009-07-07 08:56:29 +0200 (Tue, 07 Jul 2009)

Log Message:
-----------
NLA SoC: Current Frame can now be negative 

This commit is quite experimental, and might have to be reverted, but in quite a few places, the cleanups from this commit were already necessary. 

* I've left most of the image-handling functions alone, since I'm not sure how well they cope with negative indices.
* Start/End frames cannot be negative for now... any specific reasons why they should be negative?

Modified Paths:
--------------
    branches/soc-2009-aligorith/source/blender/editors/animation/anim_ops.c
    branches/soc-2009-aligorith/source/blender/editors/space_action/action_select.c
    branches/soc-2009-aligorith/source/blender/editors/space_buttons/buttons_header.c
    branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_select.c
    branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c
    branches/soc-2009-aligorith/source/blender/editors/space_time/time_header.c
    branches/soc-2009-aligorith/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_constraint.c
    branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_modifier.c
    branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_nla.c
    branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_object.c
    branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_particle.c
    branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_scene.c

Modified: branches/soc-2009-aligorith/source/blender/editors/animation/anim_ops.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/animation/anim_ops.c	2009-07-07 06:39:01 UTC (rev 21398)
+++ branches/soc-2009-aligorith/source/blender/editors/animation/anim_ops.c	2009-07-07 06:56:29 UTC (rev 21399)
@@ -83,10 +83,12 @@
 	Scene *scene= CTX_data_scene(C);
 	int cfra;
 	
-	/* get frame, and clamp to MINFRAME */
+	/* get frame, and clamp to MINAFRAME 
+	 *	- not MINFRAME, since it's useful to be able to key a few-frames back
+	 */
 	cfra= RNA_int_get(op->ptr, "frame");
 	
-	if (cfra < MINFRAME) cfra= MINFRAME;
+	if (cfra < MINAFRAME) cfra= MINAFRAME;
 	CFRA= cfra;
 	
 	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
@@ -209,7 +211,7 @@
 	ot->modal= change_frame_modal;
 
 	/* rna */
-	RNA_def_int(ot->srna, "frame", 0, 1, MAXFRAME, "Frame", "", 1, MAXFRAME);
+	RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
 }
 
 /* ****************** set preview range operator ****************************/

Modified: branches/soc-2009-aligorith/source/blender/editors/space_action/action_select.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_action/action_select.c	2009-07-07 06:39:01 UTC (rev 21398)
+++ branches/soc-2009-aligorith/source/blender/editors/space_action/action_select.c	2009-07-07 06:56:29 UTC (rev 21399)
@@ -642,7 +642,7 @@
 	
 	memset(&bed, 0, sizeof(BeztEditFunc));
 	if (leftright == ACTKEYS_LRSEL_LEFT) {
-		bed.f1 = -MAXFRAMEF;
+		bed.f1 = MINAFRAMEF;
 		bed.f2 = (float)(CFRA + FRAME_CLICK_THRESH);
 	} 
 	else {

Modified: branches/soc-2009-aligorith/source/blender/editors/space_buttons/buttons_header.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_buttons/buttons_header.c	2009-07-07 06:39:01 UTC (rev 21398)
+++ branches/soc-2009-aligorith/source/blender/editors/space_buttons/buttons_header.c	2009-07-07 06:56:29 UTC (rev 21399)
@@ -193,7 +193,7 @@
 	uiBlockEndAlign(block);
 	
 	xco+=XIC;
-	uiDefButI(block, NUM, B_NEWFRAME, "",	(xco+20),yco,60,YIC, &(CTX_data_scene(C)->r.cfra), 1.0, MAXFRAMEF, 0, 0, "Displays Current Frame of animation. Click to change.");
+	uiDefButI(block, NUM, B_NEWFRAME, "",	(xco+20),yco,60,YIC, &(CTX_data_scene(C)->r.cfra), MINAFRAMEF, MAXFRAMEF, 0, 0, "Displays Current Frame of animation. Click to change.");
 	xco+= 80;
 	
 	/* always as last  */

Modified: branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_select.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_select.c	2009-07-07 06:39:01 UTC (rev 21398)
+++ branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_select.c	2009-07-07 06:56:29 UTC (rev 21399)
@@ -763,7 +763,7 @@
 	
 	memset(&bed, 0, sizeof(BeztEditFunc));
 	if (leftright == GRAPHKEYS_LRSEL_LEFT) {
-		bed.f1 = -MAXFRAMEF;
+		bed.f1 = MINAFRAMEF;
 		bed.f2 = (float)(CFRA + 0.1f);
 	} 
 	else {

Modified: branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c	2009-07-07 06:39:01 UTC (rev 21398)
+++ branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c	2009-07-07 06:56:29 UTC (rev 21399)
@@ -501,7 +501,7 @@
 	
 	/* get range, and get the right flag-setting mode */
 	if (leftright == NLAEDIT_LRSEL_LEFT) {
-		xmin = -MAXFRAMEF;
+		xmin = MINAFRAMEF;
 		xmax = (float)(CFRA + FRAME_CLICK_THRESH);
 	} 
 	else {

Modified: branches/soc-2009-aligorith/source/blender/editors/space_time/time_header.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_time/time_header.c	2009-07-07 06:39:01 UTC (rev 21398)
+++ branches/soc-2009-aligorith/source/blender/editors/space_time/time_header.c	2009-07-07 06:56:29 UTC (rev 21399)
@@ -536,9 +536,12 @@
 	
 	xco += (short)(4.5 * XIC + 16);
 	
+	/* MINAFRAMEF not MINFRAMEF, since MINAFRAMEF allows to set current frame negative 
+	 * to facilitate easier keyframing in some situations
+	 */
 	uiDefButI(block, NUM, B_NEWFRAME, "",
 			  xco,yco, (int)3.5*XIC,YIC,
-			  &(scene->r.cfra), MINFRAMEF, MAXFRAMEF, 0, 0,
+			  &(scene->r.cfra), MINAFRAMEF, MAXFRAMEF, 0, 0,
 			  "Displays Current Frame of animation");
 	
 	xco += (short)(3.5 * XIC + 16);

Modified: branches/soc-2009-aligorith/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2009-aligorith/source/blender/makesdna/DNA_scene_types.h	2009-07-07 06:39:01 UTC (rev 21398)
+++ branches/soc-2009-aligorith/source/blender/makesdna/DNA_scene_types.h	2009-07-07 06:56:29 UTC (rev 21399)
@@ -772,6 +772,10 @@
 #define MINFRAME	1
 #define MINFRAMEF	1.0f
 
+/* (minimum frame number for current-frame) */
+#define MINAFRAME	-300000
+#define MINAFRAMEF	-300000.0f
+
 /* depricate this! */
 #define TESTBASE(v3d, base)	( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0) )
 #define TESTBASELIB(v3d, base)	( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))

Modified: branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_constraint.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_constraint.c	2009-07-07 06:39:01 UTC (rev 21398)
+++ branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_constraint.c	2009-07-07 06:56:29 UTC (rev 21399)
@@ -729,13 +729,13 @@
 
 	prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "start");
-	RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
 	RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use.");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
 	prop= RNA_def_property(srna, "end_frame", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "end");
-	RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
 	RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use.");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 

Modified: branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_modifier.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_modifier.c	2009-07-07 06:39:01 UTC (rev 21398)
+++ branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_modifier.c	2009-07-07 06:56:29 UTC (rev 21399)
@@ -506,7 +506,7 @@
 	RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
 
 	prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_range(prop, 1, MAXFRAMEF);
+	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Start", "Specify the start frame of the effect.");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
 
@@ -660,18 +660,18 @@
 
 	prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "timeoffs");
-	RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
+	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Time Offset", "Either the starting frame (for positive speed) or ending frame (for negative speed.)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
 
 	prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
+	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Lifetime",  "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
 
 	prop= RNA_def_property(srna, "damping_time", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "damp");
-	RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
+	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Damping Time",  "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
 

Modified: branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_nla.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_nla.c	2009-07-07 06:39:01 UTC (rev 21398)
+++ branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_nla.c	2009-07-07 06:56:29 UTC (rev 21399)
@@ -66,7 +66,7 @@
 		}
 	}
 	else {
-		CLAMP(value, -MAXFRAME, data->end);
+		CLAMP(value, MINAFRAME, data->end);
 	}
 	data->start= value;
 }
@@ -185,7 +185,7 @@
 static void rna_NlaStrip_action_start_frame_set(PointerRNA *ptr, float value)
 {
 	NlaStrip *data= (NlaStrip*)ptr->data;
-	CLAMP(value, -MAXFRAME, data->actend);
+	CLAMP(value, MINAFRAME, data->actend);
 	data->actstart= value;
 }
 

Modified: branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_object.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_object.c	2009-07-07 06:39:01 UTC (rev 21398)
+++ branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_object.c	2009-07-07 06:56:29 UTC (rev 21399)
@@ -1154,7 +1154,7 @@
 
 	prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sf");
-	RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
+	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Time Offset", "Animation offset in frames for IPO's and dupligroup instances.");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
 

Modified: branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_particle.c
===================================================================

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list