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.
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user