[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27002] trunk/blender: Animation Playback Option (No negative frames) and Other Bugfixes:

Joshua Leung aligorith at gmail.com
Thu Feb 18 01:29:08 CET 2010


Revision: 27002
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27002
Author:   aligorith
Date:     2010-02-18 01:29:08 +0100 (Thu, 18 Feb 2010)

Log Message:
-----------
Animation Playback Option (No negative frames) and Other Bugfixes:

* Added a user-preference setting which disallows setting the current frame number to a negative number. This setting only applies when setting the current frame by scrubbing the time cursor in a timeline view, or by typing a value into the current frame number field.

* Made the minimum frame number for the start frame to be 0, which should make setting keyframes by a regular step size less confusing. Also changed the MINFRAME define to 0 for consistency. Hopefully this doesn't cause any problems with any output formats. 

* Fixed some missing channel selection cases in animation editors. 

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_userpref.py
    trunk/blender/source/blender/editors/animation/anim_channels_edit.c
    trunk/blender/source/blender/editors/animation/anim_ops.c
    trunk/blender/source/blender/editors/space_nla/nla_channels.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c
    trunk/blender/source/blender/makesdna/DNA_scene_types.h
    trunk/blender/source/blender/makesdna/DNA_userdef_types.h
    trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
    trunk/blender/source/blender/makesrna/intern/rna_scene.c
    trunk/blender/source/blender/makesrna/intern/rna_userdef.c

Modified: trunk/blender/release/scripts/ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref.py	2010-02-17 23:04:30 UTC (rev 27001)
+++ trunk/blender/release/scripts/ui/space_userpref.py	2010-02-18 00:29:08 UTC (rev 27002)
@@ -338,6 +338,11 @@
         #col.prop(edit, "grease_pencil_simplify_stroke", text="Simplify Stroke")
         col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
         col.prop(edit, "grease_pencil_smooth_stroke", text="Smooth Stroke")
+        col.separator()
+        col.separator()
+        col.separator()
+        col.label(text="Playback:")
+        col.prop(edit, "use_negative_frames")
 
         row.separator()
         row.separator()

Modified: trunk/blender/source/blender/editors/animation/anim_channels_edit.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_channels_edit.c	2010-02-17 23:04:30 UTC (rev 27001)
+++ trunk/blender/source/blender/editors/animation/anim_channels_edit.c	2010-02-18 00:29:08 UTC (rev 27002)
@@ -261,6 +261,8 @@
 				case ANIMTYPE_DSMBALL:
 				case ANIMTYPE_DSARM:
 				case ANIMTYPE_DSMESH:
+				case ANIMTYPE_DSNTREE:
+				case ANIMTYPE_DSTEX:
 				{
 					if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
 						sel= ACHANNEL_SETFLAG_CLEAR;
@@ -342,6 +344,8 @@
 			case ANIMTYPE_DSMBALL:
 			case ANIMTYPE_DSARM:
 			case ANIMTYPE_DSMESH:
+			case ANIMTYPE_DSNTREE:
+			case ANIMTYPE_DSTEX:
 			{
 				/* need to verify that this data is valid for now */
 				if (ale->adt) {
@@ -1742,8 +1746,6 @@
 				if (adt) adt->flag |= ADT_UI_SELECTED;
 			}
 			
-			/* xxx should be ED_base_object_activate(), but we need context pointer for that... */
-			//set_active_base(base);
 			if ((adt) && (adt->flag & ADT_UI_SELECTED))
 				adt->flag |= ADT_UI_ACTIVE;
 			
@@ -1762,6 +1764,8 @@
 		case ANIMTYPE_DSMBALL:
 		case ANIMTYPE_DSARM:
 		case ANIMTYPE_DSMESH:
+		case ANIMTYPE_DSNTREE:
+		case ANIMTYPE_DSTEX:
 		{
 			/* sanity checking... */
 			if (ale->adt) {

Modified: trunk/blender/source/blender/editors/animation/anim_ops.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_ops.c	2010-02-17 23:04:30 UTC (rev 27001)
+++ trunk/blender/source/blender/editors/animation/anim_ops.c	2010-02-18 00:29:08 UTC (rev 27002)
@@ -81,6 +81,7 @@
 	
 	/* set the new frame number */
 	CFRA= RNA_int_get(op->ptr, "frame");
+	FRAMENUMBER_MIN_CLAMP(CFRA);
 	
 	/* do updates */
 	sound_seek_scene(C);

Modified: trunk/blender/source/blender/editors/space_nla/nla_channels.c
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_channels.c	2010-02-17 23:04:30 UTC (rev 27001)
+++ trunk/blender/source/blender/editors/space_nla/nla_channels.c	2010-02-18 00:29:08 UTC (rev 27002)
@@ -173,8 +173,6 @@
 					if (adt) adt->flag |= ADT_UI_SELECTED;
 				}
 				
-				/* xxx should be ED_base_object_activate(), but we need context pointer for that... */
-				//set_active_base(base);
 				if ((adt) && (adt->flag & ADT_UI_SELECTED))
 					adt->flag |= ADT_UI_ACTIVE;
 				
@@ -195,6 +193,8 @@
 		case ANIMTYPE_DSPART:
 		case ANIMTYPE_DSMBALL:
 		case ANIMTYPE_DSARM:
+		case ANIMTYPE_DSMESH:
+		case ANIMTYPE_DSTEX:
 		{
 			/* sanity checking... */
 			if (ale->adt) {

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2010-02-17 23:04:30 UTC (rev 27001)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2010-02-18 00:29:08 UTC (rev 27002)
@@ -2000,12 +2000,6 @@
 
 	fly->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
 
-
-	/* we have to rely on events to give proper mousecoords after a warp_pointer */
-//XXX2.5	warp_pointer(cent_orig[0], cent_orig[1]);
-	//fly->mval[0]= (fly->sa->winx)/2;
-	//fly->mval[1]= (fly->sa->winy)/2;
-
 	fly->mval[0] = event->x - fly->ar->winrct.xmin;
 	fly->mval[1] = event->y - fly->ar->winrct.ymin;
 
@@ -2578,7 +2572,7 @@
 	if(event->type==TIMER && event->customdata == fly->timer)
 		flyApply(fly);
 
-	if(fly->redraw) {;
+	if(fly->redraw) {
 		ED_region_tag_redraw(CTX_wm_region(C));
 	}
 

Modified: trunk/blender/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_scene_types.h	2010-02-17 23:04:30 UTC (rev 27001)
+++ trunk/blender/source/blender/makesdna/DNA_scene_types.h	2010-02-18 00:29:08 UTC (rev 27002)
@@ -982,8 +982,8 @@
 #define MAXFRAME	300000
 #define MAXFRAMEF	300000.0f
 
-#define MINFRAME	1
-#define MINFRAMEF	1.0f
+#define MINFRAME	0
+#define MINFRAMEF	0.0f
 
 /* (minimum frame number for current-frame) */
 #define MINAFRAME	-300000

Modified: trunk/blender/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2010-02-17 23:04:30 UTC (rev 27001)
+++ trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2010-02-18 00:29:08 UTC (rev 27002)
@@ -405,7 +405,15 @@
 #define USER_DRAGIMMEDIATE		(1 << 21)
 #define USER_DONT_DOSCRIPTLINKS	(1 << 22)
 #define USER_FILENOUI			(1 << 23)
+#define USER_NONEGFRAMES		(1 << 24)
 
+/* helper macro for checking frame clamping */
+#define FRAMENUMBER_MIN_CLAMP(cfra) \
+	{ \
+		if ((U.flag & USER_NONEGFRAMES) && (cfra < 0)) \
+			cfra = 0; \
+	}
+
 /* viewzom */
 #define USER_ZOOM_CONT			0
 #define USER_ZOOM_SCALE			1

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2010-02-17 23:04:30 UTC (rev 27001)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2010-02-18 00:29:08 UTC (rev 27002)
@@ -1175,6 +1175,7 @@
 	RNA_def_property_ui_text(prop, "Quality", "");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
+		// TODO: should these be limited to the extents of the each other so that no cross-over occurs?
 	prop = RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "sfra");
 	RNA_def_property_range(prop, MINFRAMEF, MAXFRAMEF);

Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c	2010-02-17 23:04:30 UTC (rev 27001)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c	2010-02-18 00:29:08 UTC (rev 27002)
@@ -230,10 +230,20 @@
 	ED_view3d_scene_layers_update(bmain, scene);
 }
 
+static void rna_Scene_current_frame_set(PointerRNA *ptr, int value)
+{
+	Scene *data= (Scene*)ptr->data;
+	
+	/* if negative frames aren't allowed, then we can't use them */
+	FRAMENUMBER_MIN_CLAMP(value);
+	data->r.cfra= value;
+}
+
 static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
 {
 	Scene *data= (Scene*)ptr->data;
-	CLAMP(value, 1, data->r.efra);
+	/* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
+	CLAMP(value, MINFRAME, data->r.efra); 
 	data->r.sfra= value;
 }
 
@@ -2648,6 +2658,7 @@
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "r.cfra");
 	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+	RNA_def_property_int_funcs(prop, NULL, "rna_Scene_current_frame_set", NULL);
 	RNA_def_property_ui_text(prop, "Current Frame", "");
 	RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
 	RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_frame_update");

Modified: trunk/blender/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2010-02-17 23:04:30 UTC (rev 27001)
+++ trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2010-02-18 00:29:08 UTC (rev 27002)
@@ -2011,7 +2011,8 @@
 	prop= RNA_def_property(srna, "drag_immediately", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_DRAGIMMEDIATE);
 	RNA_def_property_ui_text(prop, "Drag Immediately", "Moving things with a mouse drag doesn't require a click to confirm (Best for tablet users)");
-
+	
+	/* Undo */
 	prop= RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "undosteps");
 	RNA_def_property_range(prop, 0, 64);
@@ -2026,7 +2027,7 @@
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_GLOBALUNDO);
 	RNA_def_property_ui_text(prop, "Global Undo", "Global undo works by keeping a full copy of the file itself in memory, so takes extra memory");
 
-	/* snap to grid */
+	/* snapping */
 	prop= RNA_def_property(srna, "snap_translate", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOGRABGRID);
 	RNA_def_property_ui_text(prop, "Enable Translation Snap", "Snap objects and sub-objects to grid units when moving");
@@ -2038,7 +2039,8 @@
 	prop= RNA_def_property(srna, "snap_scale", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOSIZEGRID);
 	RNA_def_property_ui_text(prop, "Enable Scaling Snap", "Snap objects and sub-objects to grid units when scaling");
-
+	
+	/* auto keyframing */	
 	prop= RNA_def_property(srna, "use_auto_keying", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
 	RNA_def_property_ui_text(prop, "Auto Keying Enable", "Automatic keyframe insertion for Objects and Bones");
@@ -2056,6 +2058,7 @@
 	RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
 	RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set", "Automatic keyframe insertion using active Keying Set");
 	
+	/* keyframing settings */
 	prop= RNA_def_property(srna, "keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTNEEDED);
 	RNA_def_property_ui_text(prop, "Keyframe Insert Needed", "Keyframe insertion only when keyframe needed");
@@ -2073,6 +2076,12 @@
 	RNA_def_property_enum_sdna(prop, NULL, "ipo_new");

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list