Turn off "use overwrite" and "use placeholder" for Flamenco blend files.

If you want to re-render frames, delete them first, then reschedule
the render task.
This commit is contained in:
Sybren A. Stüvel 2017-02-14 10:21:50 +01:00
parent 33da5195f3
commit 4647175a7e

View File

@ -128,24 +128,13 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
if not await self.authenticate(context): if not await self.authenticate(context):
return return
from pillarsdk import exceptions as sdk_exceptions
from ..blender import preferences from ..blender import preferences
scene = context.scene scene = context.scene
# The file extension should be determined by the render settings, not necessarily # Save to a different file, specifically for Flamenco.
# by the setttings in the output panel.
scene.render.use_file_extension = True
# Save to a different file, specifically for Flamenco. We shouldn't overwrite
# the artist's file. We can compress, since this file won't be managed by SVN
# and doesn't need diffability.
context.window_manager.flamenco_status = 'PACKING' context.window_manager.flamenco_status = 'PACKING'
filepath = Path(context.blend_data.filepath).with_suffix('.flamenco.blend') filepath = await self._save_blendfile(context)
self.log.info('Saving copy to temporary file %s', filepath)
bpy.ops.wm.save_as_mainfile(filepath=str(filepath),
compress=True,
copy=True)
# Determine where the render output will be stored. # Determine where the render output will be stored.
render_output = render_output_path(context, filepath) render_output = render_output_path(context, filepath)
@ -230,6 +219,43 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
self.quit() self.quit()
async def _save_blendfile(self, context):
"""Save to a different file, specifically for Flamenco.
We shouldn't overwrite the artist's file.
We can compress, since this file won't be managed by SVN and doesn't need diffability.
"""
render = context.scene.render
# Remember settings we need to restore after saving.
old_use_file_extension = render.use_file_extension
old_use_overwrite = render.use_overwrite
old_use_placeholder = render.use_placeholder
try:
# The file extension should be determined by the render settings, not necessarily
# by the setttings in the output panel.
render.use_file_extension = True
# Rescheduling should not overwrite existing frames.
render.use_overwrite = False
render.use_placeholder = False
filepath = Path(context.blend_data.filepath).with_suffix('.flamenco.blend')
self.log.info('Saving copy to temporary file %s', filepath)
bpy.ops.wm.save_as_mainfile(filepath=str(filepath),
compress=True,
copy=True)
finally:
# Restore the settings we changed, even after an exception.
render.use_file_extension = old_use_file_extension
render.use_overwrite = old_use_overwrite
render.use_placeholder = old_use_placeholder
return filepath
def quit(self): def quit(self):
super().quit() super().quit()
bpy.context.window_manager.flamenco_status = 'IDLE' bpy.context.window_manager.flamenco_status = 'IDLE'
@ -525,11 +551,6 @@ class FLAMENCO_PT_render(bpy.types.Panel):
else: else:
layout.label('Unknown Flamenco status %s' % flamenco_status) layout.label('Unknown Flamenco status %s' % flamenco_status)
if not context.scene.render.use_overwrite:
warnbox = layout.box().column(align=True)
warnbox.label('Please enable "Overwrite" in the Output panel,')
warnbox.label('or re-queueing this job might not do anything.')
def register(): def register():
from ..utils import redraw from ..utils import redraw