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>2006-01-03 09:14:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2006-01-03 09:14:53 +0300
commitd14f6c9cbc1c4d0633e928fb897cec03e9164b43 (patch)
tree1d813d9dbca5654d4b9a9e0e226ba74a3ce11bb1 /source/blender/python/api2_2x/Scene.c
parentfc079f8482a04b3e331fb4252549ce7e5c5a307b (diff)
replaced more M_Object_Get for the faster Object_CreatePyObject.
Object.GetSelected now dosnt return None if there is no 3d view. - wasnt documented and likely would mess up scripts that always expected a list. - Just return an empty list instead.
Diffstat (limited to 'source/blender/python/api2_2x/Scene.c')
-rw-r--r--source/blender/python/api2_2x/Scene.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c
index fd3ebd51318..c6421a53610 100644
--- a/source/blender/python/api2_2x/Scene.c
+++ b/source/blender/python/api2_2x/Scene.c
@@ -875,11 +875,7 @@ static PyObject *Scene_getActiveObject(BPy_Scene *self)
ob = ((scene->basact) ? (scene->basact->object) : 0);
if (ob) {
- PyObject *arg = Py_BuildValue("(s)", ob->id.name+2);
-
- pyob = M_Object_Get(Py_None, arg);
-
- Py_DECREF(arg);
+ pyob = Object_CreatePyObject( ob );
if (!pyob)
return EXPP_ReturnPyObjError(PyExc_MemoryError,
@@ -895,8 +891,9 @@ static PyObject *Scene_getActiveObject(BPy_Scene *self)
static PyObject *Scene_getCurrentCamera( BPy_Scene * self )
{
Object *cam_obj;
+ PyObject *pyob;
Scene *scene = self->scene;
-
+
if( !scene )
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"Blender Scene was deleted!" );
@@ -904,16 +901,11 @@ static PyObject *Scene_getCurrentCamera( BPy_Scene * self )
cam_obj = scene->camera;
if( cam_obj ) { /* if found, return a wrapper for it */
- PyObject *camera = NULL;
- PyObject *name = Py_BuildValue( "(s)", cam_obj->id.name + 2 );
-
- if( !name )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Py_BuildValue() failed" );
-
- camera = M_Object_Get( Py_None, name );
- Py_DECREF ( name );
- return camera;
+ pyob = Object_CreatePyObject( cam_obj );
+ if (!pyob)
+ return EXPP_ReturnPyObjError(PyExc_MemoryError,
+ "couldn't create new object wrapper!");
+ return pyob;
}
Py_INCREF( Py_None ); /* none found */