made scene.getChildren() a heap faster. 983.3 times faster in my test.

getting 7200 objects did take: 1.18 sec,  now 0.0012 sec

It was doing a full object list lookup for every object in the scenes base using the name to compare.
now it just gets the object directly from the base and converts it to a python object, adding it to the list.
- Cam
This commit is contained in:
Campbell Barton 2006-01-03 05:38:39 +00:00
parent fc6ec33c89
commit fc079f8482

@ -845,22 +845,16 @@ static PyObject *Scene_getChildren( BPy_Scene * self )
while( base ) {
object = base->object;
name = Py_BuildValue( "(s)", object->id.name + 2 );
if( !name )
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"Py_BuildValue() failed" );
bpy_obj = M_Object_Get( Py_None, name );
Py_DECREF ( name );
bpy_obj = Object_CreatePyObject( object );
if( !bpy_obj )
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"couldn't create new object wrapper" );
PyList_Append( pylist, bpy_obj );
Py_XDECREF( bpy_obj ); /* PyList_Append incref'ed it */
base = base->next;
}