* speedup for animating bones, in one scene with sintel and a dragon animated its over 4x faster.

* utility function BLI_findstring to avoid listbase lookup loops everywhere.
  eg: 
    ListBase *lb= objects= &CTX_data_main(C)->object;
    Object *ob= BLI_findstring(lb, name, offsetof(ID, name) + 2);

* made some more math functions use const's, (fix warnings I made in previous commits)
This commit is contained in:
2009-12-29 15:40:26 +00:00
parent d5cef9a30d
commit 5cd837a562
12 changed files with 81 additions and 167 deletions

View File

@@ -33,6 +33,8 @@
#include "MEM_guardedalloc.h"
#include "BKE_text.h" /* txt_to_buf */
#include "BKE_main.h"
#include "BLI_listbase.h"
#include <stddef.h>
static Main *bpy_import_main= NULL;
@@ -100,10 +102,7 @@ PyObject *bpy_text_import_name( char *name, int *found )
memcpy( txtname, name, namelen );
memcpy( &txtname[namelen], ".py", 4 );
for(text = maggie->text.first; text; text = text->id.next) {
if( !strcmp( txtname, text->id.name+2 ) )
break;
}
text= BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
if( !text )
return NULL;
@@ -142,12 +141,7 @@ PyObject *bpy_text_reimport( PyObject *module, int *found )
return NULL;
/* look up the text object */
text = ( Text * ) & ( maggie->text.first );
while( text ) {
if( !strcmp( txtname, text->id.name+2 ) )
break;
text = text->id.next;
}
text= BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
/* uh-oh.... didn't find it */
if( !text )