forked from bartvdbraak/blender
fix [#31136] Save All Edited only works for Saved external image, not New or Packed image (bpy.ops.image.save_dirty)
This commit is contained in:
parent
ad93736bd4
commit
e96187250e
@ -118,16 +118,24 @@ class SaveDirty(Operator):
|
|||||||
unique_paths = set()
|
unique_paths = set()
|
||||||
for image in bpy.data.images:
|
for image in bpy.data.images:
|
||||||
if image.is_dirty:
|
if image.is_dirty:
|
||||||
filepath = bpy.path.abspath(image.filepath)
|
if image.packed_file:
|
||||||
if "\\" not in filepath and "/" not in filepath:
|
if image.library:
|
||||||
self.report({'WARNING'}, "Invalid path: " + filepath)
|
self.report({'WARNING'},
|
||||||
elif filepath in unique_paths:
|
"Packed library image: %r from library %r can't be re-packed" %
|
||||||
self.report({'WARNING'},
|
(image.name, image.library.filepath))
|
||||||
"Path used by more then one image: %r" %
|
else:
|
||||||
filepath)
|
image.pack(as_png=True)
|
||||||
else:
|
else:
|
||||||
unique_paths.add(filepath)
|
filepath = bpy.path.abspath(image.filepath, library=image.library)
|
||||||
image.save()
|
if "\\" not in filepath and "/" not in filepath:
|
||||||
|
self.report({'WARNING'}, "Invalid path: " + filepath)
|
||||||
|
elif filepath in unique_paths:
|
||||||
|
self.report({'WARNING'},
|
||||||
|
"Path used by more then one image: %r" %
|
||||||
|
filepath)
|
||||||
|
else:
|
||||||
|
unique_paths.add(filepath)
|
||||||
|
image.save()
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user