assertimg_obj.filepath!="",f"{img_obj.filepath} in mesh {mesh_name} Isn't there but should be, as it has no packed image"
assertimg_obj.filepath!="",f"{img_obj.filepath} in mesh {mesh_name} Isn't there but should be, as it has no packed image"
assertis_file_in_project(bpy.path.abspath(img_obj.filepath)),f"The image {image_filename} has filepath {img_obj.filepath} which isn't in the project directory {project_directory}"
old_path=bpy.path.abspath(img_obj.filepath)
ifnotis_file_in_project(old_path):
print(f"Image {image_filename} has filepath {img_obj.filepath}, outside of the current directory. So we're copying it baby. Hoo-rah!")
new_path=bpy.path.abspath(f"//{image_filename}")
assertnotos.path.exists(new_path),f"Tried to migrate {image_filename} to a new home {new_path}, but its already taken. It's over!"
shutil.copyfile(old_path,new_path)
img_obj.filepath=new_path
assertis_file_in_project(bpy.path.abspath(img_obj.filepath)),f"The image {image_filename} has filepath {img_obj.filepath} which isn't in the project directory {project_directory}, even after copying it! WTF"