Skip to content
Snippets Groups Projects
Commit 0cd7b6c6 authored by Bastien Montagne's avatar Bastien Montagne
Browse files

More "relpath" try/except protection...

Note: import gimp image also would need it, but it would anyway need a good cleanup (handling of paths is ugly), so did not bothered with it for now.
parent 91e25c8f
No related branches found
No related tags found
No related merge requests found
......@@ -453,15 +453,10 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
image.use_fields = self.use_fields
if self.relative:
# can't always find the relative path
# (between drive letters on windows)
try:
filepath_rel = bpy.path.relpath(image.filepath)
try: # can't always find the relative path (between drive letters on windows)
image.filepath = bpy.path.relpath(image.filepath)
except ValueError:
filepath_rel = None
if filepath_rel is not None:
image.filepath = filepath_rel
pass
def set_texture_options(self, context, texture):
texture.image.use_alpha = self.use_transparency
......
......@@ -559,12 +559,16 @@ def save_painted(ts):
name = name +'.tga'
bpy.context.scene.render.image_settings.color_mode = 'RGBA'
fp =bpy.path.abspath('//textures' + sep + name)
fp = bpy.path.abspath('//textures' + sep + name)
try:
i.save_render(fp)
i.source = 'FILE'
if bpy.context.user_preferences.filepaths.use_relative_paths:
i.filepath = bpy.path.relpath(fp)
# can't always find the relative path (between drive letters on windows)
try:
i.filepath = bpy.path.relpath(fp)
except ValueError:
i.filepath = fp
else:
i.filepath = fp
i.name = name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment