* 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

@@ -23,6 +23,7 @@
*/
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "MEM_guardedalloc.h"
@@ -920,18 +921,11 @@ static void draw_constraint_spaceselect (uiBlock *block, bConstraint *con, short
static void test_obpoin_but(bContext *C, char *name, ID **idpp)
{
ID *id;
ID *id= BLI_findstring(&CTX_data_main(C)->object, name, offsetof(ID, name) + 2);
*idpp= id; /* can be NULL */
id= CTX_data_main(C)->object.first;
while(id) {
if( strcmp(name, id->name+2)==0 ) {
*idpp= id;
id_lib_extern(id); /* checks lib data, sets correct flag for saving then */
return;
}
id= id->next;
}
*idpp= NULL;
if(id)
id_lib_extern(id); /* checks lib data, sets correct flag for saving then */
}
/* draw panel showing settings for a constraint */