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)", diff --git a/source/blender/python/api2_2x/doc/Scene.py b/source/blender/python/api2_2x/doc/Scene.py index a07194f626a..c28460825d2 100644 --- a/source/blender/python/api2_2x/doc/Scene.py +++ b/source/blender/python/api2_2x/doc/Scene.py @@ -105,6 +105,16 @@ class Scene: print scene.layers # will print: [1, 3] @type objects: sequence of objects @ivar objects: The scene's objects. The sequence supports the methods .link(ob), .unlink(ob), and .new(obdata), and can be iterated over. + @type cursor: Vector (wrapped) + @ivar cursor: the 3d cursor location for this scene. + @type world: World or None + @ivar world: The world that this scene uses (if any) + @type timeline: Timeline + @ivar timeline: The L{timeline} for this scene, named markers are stored here. (read only) + @type render: RenderData + @ivar render: The scenes L{render} settings. (read only) + @type radiosity: RenderData + @ivar radiosity: The scenes L{radiosity} settings. (read only) """ def getName(): diff --git a/source/blender/src/meshtools.c b/source/blender/src/meshtools.c index 75c144f5467..2c18cd8ec31 100644 --- a/source/blender/src/meshtools.c +++ b/source/blender/src/meshtools.c @@ -497,7 +497,7 @@ void sort_faces(void) if(G.obedit) return; if(ob->type!=OB_MESH) return; - event = pupmenu("Soft Faces by%t|View Axis (back to front)%x1|View Axis (front to back)%x2|Cursor Distance (near to far)%x3|Cursor Distance (far to near)%x4|Z Axis%x5"); + event = pupmenu("Sort Faces by%t|View Axis (back to front)%x1|View Axis (front to back)%x2|Cursor Distance (near to far)%x3|Cursor Distance (far to near)%x4|Z Axis%x5"); if (event==-1) return; me= ob->data;