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:
authorCampbell Barton <ideasman42@gmail.com>2007-03-01 16:22:26 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-03-01 16:22:26 +0300
commit69eb4eefb5c9e34a53e6ce75cbac81968ef49931 (patch)
treef00cf9c6b07abbcd3af099616a5faf6b0bce1a4e /source/blender/python/api2_2x/Scene.c
parente966aa549e44fb96848506b3d84607ee2411c861 (diff)
Scene.c - world could not be set to None, added "cursor" attribute.
Scene.py - added docs for new scen attributes. meshtools.c - typo
Diffstat (limited to 'source/blender/python/api2_2x/Scene.c')
-rw-r--r--source/blender/python/api2_2x/Scene.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c
index ce9bcb08f61..a0e83635825 100644
--- a/source/blender/python/api2_2x/Scene.c
+++ b/source/blender/python/api2_2x/Scene.c
@@ -78,6 +78,8 @@ struct View3D;
#include "sceneRadio.h"
#include "sceneTimeLine.h"
+#include "BKE_utildefines.h" /* vec copy */
+#include "vector.h"
PyObject *M_Object_Get( PyObject * self, PyObject * args ); /* from Object.c */
@@ -367,15 +369,21 @@ static int Scene_setWorld( BPy_Scene * self, PyObject * value )
SCENE_DEL_CHECK_INT(self);
- if (!BPy_World_Check(value))
+ /* accepts a World or None */
+ if (BPy_World_Check(value)) {
+ world = World_FromPyObject(value);
+ } else if (value != Py_None) {
return ( EXPP_ReturnIntError( PyExc_TypeError,
"expected a world object" ) );
+ }
- world = World_FromPyObject(value);
/* If there is a world then it now has one less user */
if( self->scene->world )
self->scene->world->id.us--;
- world->id.us++;
+
+ if (world)
+ world->id.us++;
+
G.scene->world = world;
return 0;
}
@@ -387,6 +395,32 @@ static PyObject *Scene_getObjects( BPy_Scene *self)
return SceneObSeq_CreatePyObject(self, NULL, 0);
}
+
+
+static PyObject *Scene_getCursor( BPy_Scene * self )
+{
+ SCENE_DEL_CHECK_PY(self);
+ return newVectorObject( self->scene->cursor, 3, Py_WRAP );
+}
+
+static int Scene_setCursor( BPy_Scene * self, PyObject * value )
+{
+ VectorObject *bpy_vec;
+ SCENE_DEL_CHECK_INT(self);
+ if (!VectorObject_Check(value))
+ return ( EXPP_ReturnIntError( PyExc_TypeError,
+ "expected a vector" ) );
+
+ bpy_vec = (VectorObject *)value;
+
+ if (bpy_vec->size != 3)
+ return ( EXPP_ReturnIntError( PyExc_ValueError,
+ "can only assign a 3D vector" ) );
+
+ VECCOPY(self->scene->cursor, bpy_vec->vec);
+ return 0;
+}
+
/*****************************************************************************/
/* Python attributes get/set structure: */
/*****************************************************************************/
@@ -404,6 +438,10 @@ static PyGetSetDef BPy_Scene_getseters[] = {
(getter)Scene_getWorld, (setter)Scene_setWorld,
"Scene layer bitmask",
NULL},
+ {"cursor",
+ (getter)Scene_getCursor, (setter)Scene_setCursor,
+ "Scene layer bitmask",
+ NULL},
{"timeline",
(getter)Scene_getTimeLine, (setter)NULL,
"Scenes timeline (read only)",