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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2016-08-10 00:04:40 +0300
committerAntonioya <blendergit@gmail.com>2016-08-10 00:04:40 +0300
commit2dbffd9d88ea0a6eee3b1ffdfa195ca74002f054 (patch)
tree3b5706df7950dfe58e84132bdf187c3e21211e1e
parent6b467b9eb0018a560fc6f22e28734c14a47f27c7 (diff)
MeasureIt: Fix error rendering measures if file was not saved
Now the temp default folder is used to generate temporary output for render. This works if the file was not saved.
-rw-r--r--measureit/measureit_render.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/measureit/measureit_render.py b/measureit/measureit_render.py
index 88479310..c2524eb1 100644
--- a/measureit/measureit_render.py
+++ b/measureit/measureit_render.py
@@ -73,16 +73,12 @@ def render_main(self, context, animation=False):
# ---------------------------------------
# Get output path
# ---------------------------------------
- ren_path = bpy.context.scene.render.filepath
- if len(ren_path) > 0:
- if ren_path.endswith(path.sep):
- initpath = path.realpath(ren_path) + path.sep
- else:
- (initpath, filename) = path.split(ren_path)
- outpath = path.join(initpath, "measureit_tmp_render.png")
+ temp_path = path.realpath(bpy.app.tempdir)
+ if len(temp_path) > 0:
+ outpath = path.join(temp_path, "measureit_tmp_render.png")
else:
self.report({'ERROR'},
- "MeasureIt: Unable to save temporary render image. Define a valid render path")
+ "MeasureIt: Unable to save temporary render image. Define a valid temp path")
settings.color_depth = depth
return False
@@ -90,7 +86,7 @@ def render_main(self, context, animation=False):
img = get_render_image(outpath)
if img is None:
self.report({'ERROR'},
- "MeasureIt: Unable to save temporary render image. Define a valid render path")
+ "MeasureIt: Unable to save temporary render image. Define a valid temp path")
settings.color_depth = depth
return False
@@ -263,7 +259,7 @@ def render_main(self, context, animation=False):
(initpath, filename) = path.split(ren_path)
ftxt = "%04d" % scene.frame_current
- outpath = path.join(initpath, filename + ftxt + ".png")
+ outpath = path.realpath(path.join(initpath, filename + ftxt + ".png"))
save_image(self, outpath, out)
@@ -273,7 +269,7 @@ def render_main(self, context, animation=False):
except:
settings.color_depth = depth
print("Unexpected error:" + str(exc_info()))
- self.report({'ERROR'}, "MeasureIt: Unable to create render image")
+ self.report({'ERROR'}, "MeasureIt: Unable to create render image. Be sure the output render path is correct")
return False