From 5e493eeb19572e4c70c1b4a9c283616995f2df8a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 7 May 2008 07:57:18 +0000 Subject: [PATCH] Setting frame in python allowed negative numbers (was casting to a short with no clamping!) disable capslock option isnt used anywhere. --- source/blender/python/api2_2x/Blender.c | 3 ++- source/blender/src/space.c | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index 7c2895d96be..4fc68d138e0 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -246,7 +246,8 @@ static PyObject *Blender_Set( PyObject * self, PyObject * args ) 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 */ diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 3cffed48224..292b1f1bc1e 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -4163,16 +4163,17 @@ void drawinfospace(ScrArea *sa, void *spacedata) &(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)");