| 
									
										
										
										
											2010-02-12 11:34:25 +00:00
										 |  |  | # ##### BEGIN GPL LICENSE BLOCK ##### | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | #  This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  | #  modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  | #  as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  | #  of the License, or (at your option) any later version. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | #  This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  | #  but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  | #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  | #  GNU General Public License for more details. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | #  You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  | #  along with this program; if not, write to the Free Software Foundation, | 
					
						
							| 
									
										
										
										
											2010-02-12 13:34:04 +00:00
										 |  |  | #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							| 
									
										
										
										
											2010-02-12 11:34:25 +00:00
										 |  |  | # | 
					
						
							|  |  |  | # ##### END GPL LICENSE BLOCK ##### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # <pep8 compliant> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import bpy | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  | from bpy.props import StringProperty | 
					
						
							| 
									
										
										
										
											2010-03-07 09:23:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-04 14:52:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  | class EditExternally(bpy.types.Operator): | 
					
						
							|  |  |  |     '''Edit image in an external application''' | 
					
						
							|  |  |  |     bl_idname = "image.external_edit" | 
					
						
							|  |  |  |     bl_label = "Image Edit Externally" | 
					
						
							|  |  |  |     bl_options = {'REGISTER'} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-14 03:52:10 +00:00
										 |  |  |     filepath = StringProperty(name="File Path", description="Path to an image file", maxlen=1024, default="") | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def _editor_guess(self, context): | 
					
						
							| 
									
										
										
										
											2011-03-11 01:24:16 +00:00
										 |  |  |         import sys | 
					
						
							| 
									
										
										
										
											2010-03-07 09:23:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  |         image_editor = context.user_preferences.filepaths.image_editor | 
					
						
							| 
									
										
										
										
											2010-03-07 09:23:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  |         # use image editor in the preferences when available. | 
					
						
							|  |  |  |         if not image_editor: | 
					
						
							| 
									
										
										
										
											2011-03-11 01:24:16 +00:00
										 |  |  |             if sys.platform[:3] == "win": | 
					
						
							| 
									
										
										
										
											2010-09-07 15:17:42 +00:00
										 |  |  |                 image_editor = ["start"]  # not tested! | 
					
						
							| 
									
										
										
										
											2011-03-11 01:24:16 +00:00
										 |  |  |             elif sys.platform == "darwin": | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  |                 image_editor = ["open"] | 
					
						
							|  |  |  |             else: | 
					
						
							|  |  |  |                 image_editor = ["gimp"] | 
					
						
							| 
									
										
										
										
											2010-03-07 09:23:57 +00:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2011-03-11 01:24:16 +00:00
										 |  |  |             if sys.platform == "darwin": | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  |                 # blender file selector treats .app as a folder | 
					
						
							|  |  |  |                 # and will include a trailing backslash, so we strip it. | 
					
						
							|  |  |  |                 image_editor.rstrip('\\') | 
					
						
							|  |  |  |                 image_editor = ["open", "-a", image_editor] | 
					
						
							| 
									
										
										
										
											2010-04-12 02:43:17 +00:00
										 |  |  |             else: | 
					
						
							|  |  |  |                 image_editor = [image_editor] | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return image_editor | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def execute(self, context): | 
					
						
							| 
									
										
										
										
											2010-08-03 23:02:18 +00:00
										 |  |  |         import os | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  |         import subprocess | 
					
						
							| 
									
										
										
										
											2010-09-09 18:03:57 +00:00
										 |  |  |         filepath = bpy.path.abspath(self.filepath) | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-03 23:02:18 +00:00
										 |  |  |         if not os.path.exists(filepath): | 
					
						
							| 
									
										
										
										
											2011-03-28 13:44:56 +00:00
										 |  |  |             self.report({'ERROR'}, "Image path %r not found." % filepath) | 
					
						
							| 
									
										
										
										
											2010-08-03 23:02:18 +00:00
										 |  |  |             return {'CANCELLED'} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         cmd = self._editor_guess(context) + [filepath] | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-28 13:44:56 +00:00
										 |  |  |         try: | 
					
						
							|  |  |  |             subprocess.Popen(cmd) | 
					
						
							|  |  |  |         except: | 
					
						
							|  |  |  |             import traceback | 
					
						
							|  |  |  |             traceback.print_exc() | 
					
						
							|  |  |  |             self.report({'ERROR'}, "Image editor not found, please specify in User Preferences > File") | 
					
						
							|  |  |  |             return {'CANCELLED'} | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return {'FINISHED'} | 
					
						
							| 
									
										
										
										
											2010-03-07 09:23:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  |     def invoke(self, context, event): | 
					
						
							|  |  |  |         try: | 
					
						
							| 
									
										
										
										
											2010-06-14 03:52:10 +00:00
										 |  |  |             filepath = context.space_data.image.filepath | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  |         except: | 
					
						
							| 
									
										
										
										
											2011-03-28 13:44:56 +00:00
										 |  |  |             import traceback | 
					
						
							|  |  |  |             traceback.print_exc() | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  |             self.report({'ERROR'}, "Image not found on disk") | 
					
						
							|  |  |  |             return {'CANCELLED'} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-09 18:03:57 +00:00
										 |  |  |         self.filepath = filepath | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  |         self.execute(context) | 
					
						
							| 
									
										
										
										
											2010-04-04 14:52:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											
										 
											2010-03-20 16:41:01 +00:00
										 |  |  |         return {'FINISHED'} | 
					
						
							| 
									
										
										
										
											2010-03-06 01:40:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-07 02:38:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-12 11:34:25 +00:00
										 |  |  | class SaveDirty(bpy.types.Operator): | 
					
						
							| 
									
										
										
										
											2010-10-15 08:41:58 +00:00
										 |  |  |     """Save all modified textures""" | 
					
						
							| 
									
										
										
										
											2010-02-12 11:34:25 +00:00
										 |  |  |     bl_idname = "image.save_dirty" | 
					
						
							|  |  |  |     bl_label = "Save Dirty" | 
					
						
							| 
									
										
										
										
											2010-03-01 00:03:51 +00:00
										 |  |  |     bl_options = {'REGISTER', 'UNDO'} | 
					
						
							| 
									
										
										
										
											2010-02-12 11:34:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def execute(self, context): | 
					
						
							|  |  |  |         unique_paths = set() | 
					
						
							|  |  |  |         for image in bpy.data.images: | 
					
						
							| 
									
										
										
										
											2010-08-18 07:14:10 +00:00
										 |  |  |             if image.is_dirty: | 
					
						
							| 
									
										
										
										
											2010-08-06 01:40:54 +00:00
										 |  |  |                 filepath = bpy.path.abspath(image.filepath) | 
					
						
							| 
									
										
										
										
											2010-06-14 03:52:10 +00:00
										 |  |  |                 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: " + filepath) | 
					
						
							| 
									
										
										
										
											2010-02-12 11:34:25 +00:00
										 |  |  |                 else: | 
					
						
							| 
									
										
										
										
											2010-06-14 03:52:10 +00:00
										 |  |  |                     unique_paths.add(filepath) | 
					
						
							| 
									
										
										
										
											2010-02-26 12:28:44 +00:00
										 |  |  |                     image.save() | 
					
						
							| 
									
										
										
										
											2010-02-12 11:34:25 +00:00
										 |  |  |         return {'FINISHED'} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-14 11:21:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  | class ProjectEdit(bpy.types.Operator): | 
					
						
							| 
									
										
										
										
											2011-04-02 12:54:17 +00:00
										 |  |  |     """Edit a snapshot of the viewport in an external image editor""" | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |     bl_idname = "image.project_edit" | 
					
						
							|  |  |  |     bl_label = "Project Edit" | 
					
						
							|  |  |  |     bl_options = {'REGISTER'} | 
					
						
							| 
									
										
										
										
											2010-03-14 23:26:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-07 09:23:57 +00:00
										 |  |  |     _proj_hack = [""] | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def execute(self, context): | 
					
						
							|  |  |  |         import os | 
					
						
							|  |  |  |         import subprocess | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-07 15:17:42 +00:00
										 |  |  |         EXT = "png"  # could be made an option but for now ok | 
					
						
							| 
									
										
										
										
											2010-03-07 09:23:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |         for image in bpy.data.images: | 
					
						
							|  |  |  |             image.tag = True | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-16 15:54:48 +00:00
										 |  |  |         if 'FINISHED' not in bpy.ops.paint.image_from_view(): | 
					
						
							|  |  |  |             return {'CANCELLED'} | 
					
						
							| 
									
										
										
										
											2010-03-14 23:26:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |         image_new = None | 
					
						
							|  |  |  |         for image in bpy.data.images: | 
					
						
							|  |  |  |             if not image.tag: | 
					
						
							|  |  |  |                 image_new = image | 
					
						
							|  |  |  |                 break | 
					
						
							| 
									
										
										
										
											2010-03-14 23:26:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |         if not image_new: | 
					
						
							|  |  |  |             self.report({'ERROR'}, "Could not make new image") | 
					
						
							|  |  |  |             return {'CANCELLED'} | 
					
						
							| 
									
										
										
										
											2010-03-14 23:26:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  |         filepath = os.path.basename(bpy.data.filepath) | 
					
						
							|  |  |  |         filepath = os.path.splitext(filepath)[0] | 
					
						
							| 
									
										
										
										
											2010-08-06 01:40:54 +00:00
										 |  |  |         # filepath = bpy.path.clean_name(filepath) # fixes <memory> rubbish, needs checking | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  |         if filepath.startswith(".") or filepath == "": | 
					
						
							| 
									
										
										
										
											2010-09-27 23:33:10 +00:00
										 |  |  |             # TODO, have a way to check if the file is saved, assume startup.blend | 
					
						
							| 
									
										
										
										
											2010-04-07 09:07:06 +00:00
										 |  |  |             tmpdir = context.user_preferences.filepaths.temporary_directory | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  |             filepath = os.path.join(tmpdir, "project_edit") | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  |             filepath = "//" + filepath | 
					
						
							| 
									
										
										
										
											2010-03-14 23:26:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |         obj = context.object | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if obj: | 
					
						
							| 
									
										
										
										
											2010-08-06 01:40:54 +00:00
										 |  |  |             filepath += "_" + bpy.path.clean_name(obj.name) | 
					
						
							| 
									
										
										
										
											2010-03-14 23:26:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  |         filepath_final = filepath + "." + EXT | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |         i = 0 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-06 01:40:54 +00:00
										 |  |  |         while os.path.exists(bpy.path.abspath(filepath_final)): | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  |             filepath_final = filepath + ("%.3d.%s" % (i, EXT)) | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |             i += 1 | 
					
						
							| 
									
										
										
										
											2010-03-14 23:26:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  |         image_new.name = os.path.basename(filepath_final) | 
					
						
							| 
									
										
										
										
											2010-03-07 09:23:57 +00:00
										 |  |  |         ProjectEdit._proj_hack[0] = image_new.name | 
					
						
							| 
									
										
										
										
											2010-03-14 23:26:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-07 15:17:42 +00:00
										 |  |  |         image_new.filepath_raw = filepath_final  # TODO, filepath raw is crummy | 
					
						
							| 
									
										
										
										
											2010-03-07 20:39:27 +00:00
										 |  |  |         image_new.file_format = 'PNG' | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |         image_new.save() | 
					
						
							| 
									
										
										
										
											2010-03-14 23:26:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-28 13:44:56 +00:00
										 |  |  |         try: | 
					
						
							|  |  |  |             bpy.ops.image.external_edit(filepath=filepath_final) | 
					
						
							|  |  |  |         except RuntimeError as re: | 
					
						
							|  |  |  |             self.report({'ERROR'}, str(re)) | 
					
						
							| 
									
										
										
										
											2010-03-14 23:26:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |         return {'FINISHED'} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ProjectApply(bpy.types.Operator): | 
					
						
							| 
									
										
										
										
											2010-10-15 08:41:58 +00:00
										 |  |  |     """Project edited image back onto the object""" | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |     bl_idname = "image.project_apply" | 
					
						
							|  |  |  |     bl_label = "Project Apply" | 
					
						
							|  |  |  |     bl_options = {'REGISTER'} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def execute(self, context): | 
					
						
							| 
									
										
										
										
											2010-09-07 15:17:42 +00:00
										 |  |  |         image_name = ProjectEdit._proj_hack[0]  # TODO, deal with this nicer | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         try: | 
					
						
							| 
									
										
										
										
											2010-03-07 09:23:57 +00:00
										 |  |  |             image = bpy.data.images[image_name] | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |         except KeyError: | 
					
						
							| 
									
										
										
										
											2011-03-28 13:44:56 +00:00
										 |  |  |             import traceback | 
					
						
							|  |  |  |             traceback.print_exc() | 
					
						
							| 
									
										
										
										
											2010-03-06 21:47:16 +00:00
										 |  |  |             self.report({'ERROR'}, "Could not find image '%s'" % image_name) | 
					
						
							|  |  |  |             return {'CANCELLED'} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         image.reload() | 
					
						
							|  |  |  |         bpy.ops.paint.project_image(image=image_name) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return {'FINISHED'} |