Reading/Writing of a material's textures?


(ectizen) #1

I am currently attempting to write a script that needs to read from and write to a material’s textures (not the uv mapped stuff). In particular, I’m trying to change the image filename.

I’ve spent quite some time exploring the API, trying to find the necessary stuff, and reached the conclusion that these textures simply aren’t accessible. Would this be correct?


(jms) #2

Yes, it’s correct. One of big problems to write a good exporter.

:frowning:


(eeshlo) #3

Well, you can change the image name, but that doesn’t change the actual file of course…
You can get a list of all images used (material and uv) with:


from Blender import Image
imagelist = Image.Get()

edit:
Don’t try to use this with print btw, it will crash Blender. To print the image name use this:


from Blender import Image
for image in Image.Get():
    print image.name


(ectizen) #4

I actually did find Image.Get (and crashed Blender many times :wink: ) but it doesn’t help at this time. However your post in here http://www.elysiun.com/viewtopic.php?t=3209 has given me hope that Plan B (modifying the .blend externally) might work. Thanks!