[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46294] trunk/blender/release/scripts/ startup/bl_operators/image.py: fix [#31136] Save All Edited only works for Saved external image, not New or Packed image (bpy.ops.image.save_dirty)

Campbell Barton ideasman42 at gmail.com
Fri May 4 19:39:37 CEST 2012


Revision: 46294
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46294
Author:   campbellbarton
Date:     2012-05-04 17:39:37 +0000 (Fri, 04 May 2012)
Log Message:
-----------
fix [#31136] Save All Edited only works for Saved external image, not New or Packed image (bpy.ops.image.save_dirty)

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_operators/image.py

Modified: trunk/blender/release/scripts/startup/bl_operators/image.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/image.py	2012-05-04 17:39:14 UTC (rev 46293)
+++ trunk/blender/release/scripts/startup/bl_operators/image.py	2012-05-04 17:39:37 UTC (rev 46294)
@@ -118,16 +118,24 @@
         unique_paths = set()
         for image in bpy.data.images:
             if image.is_dirty:
-                filepath = bpy.path.abspath(image.filepath)
-                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)
+                if image.packed_file:
+                    if image.library:
+                        self.report({'WARNING'},
+                                    "Packed library image: %r from library %r can't be re-packed" %
+                                    (image.name, image.library.filepath))
+                    else:
+                        image.pack(as_png=True)
                 else:
-                    unique_paths.add(filepath)
-                    image.save()
+                    filepath = bpy.path.abspath(image.filepath, library=image.library)
+                    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'}
 
 




More information about the Bf-blender-cvs mailing list