Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Swaney <sswaney@centurytel.net>2004-05-20 10:26:43 +0400
committerStephen Swaney <sswaney@centurytel.net>2004-05-20 10:26:43 +0400
commit2124168e2104d67af6f9ee952aaf873ec482c279 (patch)
tree033dd0b607c51f14319d623f7e880f21281d25f5 /source/blender/python/api2_2x/Object.c
parent87f674505048ea3256e12b69f7748fcc9fe84e49 (diff)
removed unused var in Object.getBoundBox()
bugfix: #1212 changing object's layer had no effect.
Diffstat (limited to 'source/blender/python/api2_2x/Object.c')
-rw-r--r--source/blender/python/api2_2x/Object.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index 63a4ea82758..454862f4429 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -35,6 +35,9 @@
#include "Object.h"
#include "NLA.h"
+#include "blendef.h"
+#include "DNA_scene_types.h"
+#include "BSE_edit.h"
/*****************************************************************************/
/* Python API function prototypes for the Blender module. */
@@ -957,7 +960,6 @@ static PyObject *Object_getBoundBox (BPy_Object *self)
float tmpvec[4]; /* tmp vector for homogenous coords math */
int i;
float *from;
- //float *to;
bbox = PyList_New(8);
if (!bbox)
@@ -1906,7 +1908,35 @@ static int Object_setAttr (BPy_Object *obj, char *name, PyObject *value)
return (0);
}
if (StringEqual (name, "Layer"))
- return (!PyArg_Parse (value, "i", &(object->lay)));
+ {
+ /* usage note: caller of this func needs to do a
+ Blender.Redraw(-1) to update and redraw the interface */
+
+ Base *base;
+ int newLayer;
+ int local;
+ if(PyArg_Parse (value, "i", &newLayer)){
+ /* uppper 2 bytes are for local view */
+ newLayer &= 0x00FFFFFF;
+ if( newLayer == 0 ) /* bail if nothing to do */
+ return( 0 );
+
+ /* update any bases pointing to our object */
+ base = FIRSTBASE;
+ if( base->object == obj->object ){
+ local = base->lay &= 0xFF000000;
+ base->lay = local | newLayer;
+ object->lay = base->lay;
+ }
+ countall();
+ }
+ else{
+ return EXPP_ReturnIntError(PyExc_AttributeError,
+ "expected int as bitmask");
+ }
+
+ return( 0 );
+ }
if (StringEqual (name, "parent"))
{
/* This is not allowed. */