Refuse to render on Flamenco before blend file is saved at least once.

The file should have a location on the filesystem before BAM can pick it up.
This commit is contained in:
Sybren A. Stüvel 2017-07-03 08:41:26 +02:00
parent e7b5c75046
commit 2fa8cb4054

View File

@ -20,8 +20,10 @@
The preferences are managed blender.py, the rest of the Flamenco-specific stuff is here. The preferences are managed blender.py, the rest of the Flamenco-specific stuff is here.
""" """
import functools import functools
import logging import logging
import os
from pathlib import Path, PurePath from pathlib import Path, PurePath
import typing import typing
@ -150,6 +152,14 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
log = logging.getLogger('%s.FLAMENCO_OT_render' % __name__) log = logging.getLogger('%s.FLAMENCO_OT_render' % __name__)
async def async_execute(self, context): async def async_execute(self, context):
# Refuse to start if the file hasn't been saved. It's okay if
# it's dirty, but we do need a filename and a location.
if not os.path.exists(context.blend_data.filepath):
self.report({'ERROR'}, 'Please save your Blend file before using '
'the Blender Cloud addon.')
self.quit()
return
if not await self.authenticate(context): if not await self.authenticate(context):
return return