[Bf-committers] simple test_object_materials speedup
Campbell Barton
cbarton at metavr.com
Thu Sep 14 19:46:50 CEST 2006
Just realized that this wont work the way I was thinking.
- Since the material list needs to be updated for any linked dupes.
If the user count can be trusted, some gain could be made with an early
bail out once the number of objects changed matches the number of users.
For instance. if the user count was 1 and an object was provided- the
search could be avoided.
Campbell Barton wrote:
> 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
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
More information about the Bf-committers
mailing list