~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to release/scripts/startup/bl_operators/image.py

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-05-12 20:02:22 UTC
  • mfrom: (14.2.16 sid)
  • Revision ID: package-import@ubuntu.com-20120512200222-lznjs2cxzaq96wua
Tags: 2.63a-1
* New upstream bugfix release
  + debian/patches/: re-worked since source code changed

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
        unique_paths = set()
119
119
        for image in bpy.data.images:
120
120
            if image.is_dirty:
121
 
                filepath = bpy.path.abspath(image.filepath)
122
 
                if "\\" not in filepath and "/" not in filepath:
123
 
                    self.report({'WARNING'}, "Invalid path: " + filepath)
124
 
                elif filepath in unique_paths:
125
 
                    self.report({'WARNING'},
126
 
                                "Path used by more then one image: %r" %
127
 
                                filepath)
 
121
                if image.packed_file:
 
122
                    if image.library:
 
123
                        self.report({'WARNING'},
 
124
                                    "Packed library image: %r from library %r can't be re-packed" %
 
125
                                    (image.name, image.library.filepath))
 
126
                    else:
 
127
                        image.pack(as_png=True)
128
128
                else:
129
 
                    unique_paths.add(filepath)
130
 
                    image.save()
 
129
                    filepath = bpy.path.abspath(image.filepath, library=image.library)
 
130
                    if "\\" not in filepath and "/" not in filepath:
 
131
                        self.report({'WARNING'}, "Invalid path: " + filepath)
 
132
                    elif filepath in unique_paths:
 
133
                        self.report({'WARNING'},
 
134
                                    "Path used by more then one image: %r" %
 
135
                                    filepath)
 
136
                    else:
 
137
                        unique_paths.add(filepath)
 
138
                        image.save()
131
139
        return {'FINISHED'}
132
140
 
133
141