[Bf-committers] simple test_object_materials speedup

Campbell Barton cbarton at metavr.com
Thu Sep 14 19:32:24 CEST 2006


Just noticed  test_object_materials does a search for an obdata's object 
every time it runs.

This can be slow on scenes with many objects.

How about we  add an arg to void test_object_materials(ID *id)
make it
void test_object_materials(ID *id, Object *ob)

so in cases where the object is known, the search can be avoided. 
otherwise its null and will search for the object as is done now.

Looking at places the functions used. the obdata is obviously available.

./source/blender/blenkernel/intern/mesh.c:598:  
test_object_materials((ID *)me);
./source/blender/python/api2_2x/Mesh.c:5785:    test_object_materials( ( 
ID * ) self->mesh );
./source/blender/python/api2_2x/Mesh.c:6694:            
test_object_materials( ( ID * ) self->mesh );
./source/blender/python/api2_2x/Metaball.c:636:         
test_object_materials( ( ID * ) self->metaball );
./source/blender/python/api2_2x/NMesh.c:2845:   test_object_materials( ( 
ID * ) mesh );
./source/blender/python/api2_2x/Object.c:1607:  test_object_materials( id );
./source/blender/python/api2_2x/Scene.c:1359:   test_object_materials( 
(ID *)object->data );
./source/blender/src/buttons_editing.c:3995:            
test_object_materials(ob->data);
./source/blender/src/editobject.c:3243:                                                 
test_object_materials(obt->data);
./source/blender/src/editobject.c:3311:                                         
test_object_materials(obt->data);
./source/blender/src/headerbuttons.c:621:                                       
test_object_materials(idtest);
./source/blender/src/meshtools.c:453:   test_object_materials((ID *)me);

- Cam


More information about the Bf-committers mailing list