Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-10-11 08:09:11 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-11 08:09:11 +0400
commitfa5275cdfa136dd81a15cd2d37f8dadf77f7bcee (patch)
tree6cd4a69631fdcc6df942c1825f2cb191f883c2f6 /release/scripts/startup/bl_operators/image.py
parente8bcccae33cc9df93b7ab25a51326962fc9e8bf4 (diff)
- bpy.path.abspath(), added optional library argument since any paths from linked datablocks are relative to this, not the blend files path, this saves kludgy path code wherever libraries may be used.
- Image "Edit Externally" operator can now edit relative library images. also minor edits to navmesh.
Diffstat (limited to 'release/scripts/startup/bl_operators/image.py')
-rw-r--r--release/scripts/startup/bl_operators/image.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py
index 2b190e1aee1..d0778ddafb2 100644
--- a/release/scripts/startup/bl_operators/image.py
+++ b/release/scripts/startup/bl_operators/image.py
@@ -69,8 +69,6 @@ class EditExternally(Operator):
self.report({'ERROR'}, "Image path not set")
return {'CANCELLED'}
- filepath = os.path.normpath(bpy.path.abspath(filepath))
-
if not os.path.exists(filepath):
self.report({'ERROR'},
"Image path %r not found, image may be packed or "
@@ -93,15 +91,16 @@ class EditExternally(Operator):
return {'FINISHED'}
def invoke(self, context, event):
+ import os
try:
- filepath = context.space_data.image.filepath
- except:
- import traceback
- traceback.print_exc()
- self.report({'ERROR'}, "Image not found on disk")
+ image = context.space_data.image
+ except AttributeError:
+ self.report({'ERROR'}, "Context incorrect, image not found")
return {'CANCELLED'}
- self.filepath = filepath
+ filepath = bpy.path.abspath(image.filepath, library=image.library)
+
+ self.filepath = os.path.normpath(filepath)
self.execute(context)
return {'FINISHED'}