[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14717] trunk/blender/source/blender: Setting frame in python allowed negative numbers ( was casting to a short with no clamping!)

Campbell Barton ideasman42 at gmail.com
Wed May 7 09:57:19 CEST 2008


Revision: 14717
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14717
Author:   campbellbarton
Date:     2008-05-07 09:57:18 +0200 (Wed, 07 May 2008)

Log Message:
-----------
Setting frame in python allowed negative numbers (was casting to a short with no clamping!)
disable capslock option isnt used anywhere.

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/Blender.c
    trunk/blender/source/blender/src/space.c

Modified: trunk/blender/source/blender/python/api2_2x/Blender.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Blender.c	2008-05-07 03:37:16 UTC (rev 14716)
+++ trunk/blender/source/blender/python/api2_2x/Blender.c	2008-05-07 07:57:18 UTC (rev 14717)
@@ -246,7 +246,8 @@
 			return EXPP_ReturnPyObjError( PyExc_ValueError,
 					"expected an integer" );
 
-		G.scene->r.cfra = (short)PyInt_AsLong( arg ) ;
+		G.scene->r.cfra = (int)PyInt_AsLong( arg ) ;
+		CLAMP(G.scene->r.cfra, 1, MAXFRAME);
 
 		/*	update all objects, so python scripts can export all objects
 		 in a scene without worrying about the view layers */

Modified: trunk/blender/source/blender/src/space.c
===================================================================
--- trunk/blender/source/blender/src/space.c	2008-05-07 03:37:16 UTC (rev 14716)
+++ trunk/blender/source/blender/src/space.c	2008-05-07 07:57:18 UTC (rev 14717)
@@ -4163,16 +4163,17 @@
 			&(G.f), 0, 0, 0, 0, "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)");
 		
 		uiDefBut(block, LABEL,0,"Keyboard:",
-			(xpos+edgsp+(3*midsp)+(3*mpref)),y3label,mpref,buth,
+			(xpos+edgsp+(3*midsp)+(3*mpref)),y2label,mpref,buth,
 			0, 0, 0, 0, 0, "");
-
+		/* Not actually used anywhere! */
+		/*
 		uiDefButBitI(block, TOG, USER_NO_CAPSLOCK, B_U_CAPSLOCK, "Disable Caps Lock",
 			(xpos+edgsp+(3*midsp)+(3*mpref)),y1,mpref,buth,
 			&(U.flag), 0, 0, 0, 0,
 			"Disables the Caps Lock key when entering text");
-
+		*/
 		uiDefButBitI(block, TOG, USER_NONUMPAD, 0, "Emulate Numpad",
-			(xpos+edgsp+(3*midsp)+(3*mpref)),y2,mpref,buth,
+			(xpos+edgsp+(3*midsp)+(3*mpref)),y1,mpref,buth,
 			&(U.flag), 0, 0, 0, 0,
 			"Causes the 1 to 0 keys to act as the numpad (useful for laptops)");
 





More information about the Bf-blender-cvs mailing list