fix [#36455] importing obj data after saving doesn't work
authorCampbell Barton <ideasman42@gmail.com>
Thu, 15 Aug 2013 00:32:12 +0000 (00:32 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 15 Aug 2013 00:32:12 +0000 (00:32 +0000)
release/scripts/modules/bpy_extras/image_utils.py

index 551689c5a75c7708ceabfaa685867888887e045a..ff6d23badb6943972540944e71f7ce42ebc15bc3 100644 (file)
@@ -105,7 +105,15 @@ def load_image(imagepath,
             if relpath is not None:
                 # make relative
                 from bpy.path import relpath as relpath_fn
-                image.filepath_raw = relpath_fn(path, start=relpath)
+                # can't always find the relative path
+                # (between drive letters on windows)
+                try:
+                    filepath_rel = relpath_fn(path, start=relpath)
+                except ValueError:
+                    filepath_rel = None
+
+                if filepath_rel is not None:
+                    image.filepath_raw = filepath_rel
 
         return image