textures search by name

Does anyone know how we look for a texture by his name in the textures of a blend file (not a picture, please).

bpy.data.textures.find…by…name???

pseudosortacode:


with bpy.data.libraries.load(blend) as (foo,bar):
    textures = getattr(foo,textures)
    print(textures)

In my spare time I have been working on a command line script to do this ( like a grep for blender ). I wanted to make it compatible with other os’s besides mac so last night I installed ubuntu and windows in some vm’s in order to work on that.
If you care to peruse some semi-functional code I have the work-in-progress on github:

https://github.com/dustractor/project_bspect

Beware, don’t get brain-damage from reading my crappy software :wink:

I’m assuming that texture structs have a name attribute. Filter this with a generator:


def find_texture(self, name):
    return next((t for t in bpy.data.textures if t.name == name), None)