I'm trying to create a .blend file that saves the scene, but I would like the image files to be separate, so I created a script that saves the bpy.data.images image files in a folder next to the .blend file. like to :
import os, shutil
def save_images(folder_path,my_image_list):
for i in my_image_list:
if not i.file_format:
i.file_format = 'PNG'
image_path = os.path.join(folder_path,i.name)
if not os.path.isfile(i.filepath):
filepath_raw = i.filepath
i.filepath_raw = image_path
i.save()
i.filepath_raw = filepath_raw
else:
shutil.copyfile(i.filepath,image_path)
So everything works beautifully, except for the fact that if I have a "packed image", a large file will be saved, therefore useless, as I already have the necessary images alongside that project.
Basically:
I wanted to figure out how to be able to write the project with bpy.data.libraries.write()
without it also writing packed images if there are any.
I am aware that I can check them with bpy.data.images['My Image'].packed_file
, which returns if the image is packed.
I could write something that unpack temporarily, but I see it as risky.