[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27569] trunk/blender/release/scripts/op/ image.py: Fix [#21553] Re-Projection just opening the image editor but not the image.

Matt Ebb matt at mke3.net
Wed Mar 17 04:08:11 CET 2010


Revision: 27569
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27569
Author:   broken
Date:     2010-03-17 04:07:37 +0100 (Wed, 17 Mar 2010)

Log Message:
-----------
Fix [#21553] Re-Projection just opening the image editor but not the image.

Campbell please check/beautify if you like, but it works properly on OS X, either
opening Preview with the 'open' command or Photoshop, when the path is set 
in user preferences.

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

Modified: trunk/blender/release/scripts/op/image.py
===================================================================
--- trunk/blender/release/scripts/op/image.py	2010-03-17 01:56:41 UTC (rev 27568)
+++ trunk/blender/release/scripts/op/image.py	2010-03-17 03:07:37 UTC (rev 27569)
@@ -22,19 +22,25 @@
 
 
 def image_editor_guess(context):
+    import platform
+    system = platform.system()
+    
     image_editor = context.user_preferences.filepaths.image_editor
 
     # use image editor in the preferences when available.
     if not image_editor:
-        import platform
-        system = platform.system()
-
         if system == 'Windows':
-            image_editor = "start" # not tested!
+            image_editor = ["start"] # not tested!
         elif system == 'Darwin':
-            image_editor = "open"
+            image_editor = ["open"]
         else:
-            image_editor = "gimp"
+            image_editor = ["gimp"]
+    else:
+        if system == 'Darwin':
+            # 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]
 
     return image_editor
 
@@ -118,8 +124,12 @@
         image_new.file_format = 'PNG'
         image_new.save()
 
-        subprocess.Popen([image_editor, bpy.utils.expandpath(filename_final)])
+        cmd = []
+        cmd.extend(image_editor)
+        cmd.append(bpy.utils.expandpath(filename_final))
 
+        subprocess.Popen(cmd)
+
         return {'FINISHED'}
 
 





More information about the Bf-blender-cvs mailing list