I am writing a custom export script for blender and need to copy the textures from the materials texture slots to another location. I am using shutil for copyfile:
copyfile(bpy.path.abspath(texture.image.filepath), export_path + filename)
This works, as long as the texture isn't linked from another .blend file. In this case, texture.image.filepath
returns the path relative to the source blend file, not the current working file. bpy.path.abspath
then just appends it to the current working directory, which is wrong of course. How to deal with this?