Fixed bugs when blendfile is outside the project directory

This commit is contained in:
Sybren A. Stüvel 2017-02-01 14:00:46 +01:00
parent 3814fb2683
commit 33da5195f3
2 changed files with 12 additions and 4 deletions

View File

@ -390,9 +390,13 @@ class BlenderCloudPreferences(AddonPreferences):
path_box = job_output_box.row(align=True)
output_path = render_output_path(context)
path_box.label(str(output_path))
props = path_box.operator('flamenco.explore_file_path', text='', icon='DISK_DRIVE')
props.path = str(output_path.parent)
if output_path:
path_box.label(str(output_path))
props = path_box.operator('flamenco.explore_file_path', text='', icon='DISK_DRIVE')
props.path = str(output_path.parent)
else:
path_box.label('Blend file is not in your project path, '
'unable to give output path example.')
flamenco_box.prop(self, 'flamenco_open_browser_after_submit')

View File

@ -406,7 +406,11 @@ def _render_output_path(
is fast.
"""
project_path = Path(bpy.path.abspath(local_project_path)).resolve()
try:
project_path = Path(bpy.path.abspath(local_project_path)).resolve()
except FileNotFoundError:
# Path.resolve() will raise a FileNotFoundError if the project path doesn't exist.
return None
try:
proj_rel = blend_filepath.parent.relative_to(project_path)