From 2fa8cb4054be8788a5d84e650e21ec39dcf2f831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 3 Jul 2017 08:41:26 +0200 Subject: [PATCH] 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. --- blender_cloud/flamenco/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/blender_cloud/flamenco/__init__.py b/blender_cloud/flamenco/__init__.py index 72e096a..f131b27 100644 --- a/blender_cloud/flamenco/__init__.py +++ b/blender_cloud/flamenco/__init__.py @@ -20,8 +20,10 @@ The preferences are managed blender.py, the rest of the Flamenco-specific stuff is here. """ + import functools import logging +import os from pathlib import Path, PurePath import typing @@ -150,6 +152,14 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin, log = logging.getLogger('%s.FLAMENCO_OT_render' % __name__) 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): return