From 2b155eac4555c3ed37762775376fe31c607acd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 4 Feb 2019 11:39:14 +0100 Subject: [PATCH] Flamenco: show a warning when the frame dimensions are not divisible by 2 Any 'Create Video' Flamenco task that's part of the job will pad the video with black pixels to make the dimensions even, and this warning notifies the artist about this. --- blender_cloud/flamenco/__init__.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/blender_cloud/flamenco/__init__.py b/blender_cloud/flamenco/__init__.py index eca5ed9..5869024 100644 --- a/blender_cloud/flamenco/__init__.py +++ b/blender_cloud/flamenco/__init__.py @@ -970,6 +970,8 @@ class FLAMENCO_PT_render(bpy.types.Panel, FlamencoPollMixin): labeled_row.label(text='Effective Output Path:') labeled_row.label(text=str(render_output)) + self.draw_odd_size_warning(layout, context.scene.render) + # Show current status of Flamenco. flamenco_status = context.window_manager.flamenco_status if flamenco_status in {'IDLE', 'ABORTED', 'DONE'}: @@ -1004,6 +1006,29 @@ class FLAMENCO_PT_render(bpy.types.Panel, FlamencoPollMixin): elif flamenco_status != 'IDLE' and context.window_manager.flamenco_status_txt: layout.label(text=context.window_manager.flamenco_status_txt) + def draw_odd_size_warning(self, layout, render): + render_width = render.resolution_x * render.resolution_percentage // 100 + render_height = render.resolution_y * render.resolution_percentage // 100 + + odd_width = render_width % 2 + odd_height = render_height % 2 + + if not odd_width and not odd_height: + return + + box = layout.box() + box.alert = True + + if odd_width and odd_height: + msg = 'Both X (%d) and Y (%d) resolution are' % (render_width, render_height) + elif odd_width: + msg = 'X resolution (%d) is' % render_width + else: + msg = 'Y resolution (%d) is' % render_height + + box.label(text=msg + ' not divisible by 2.', icon='ERROR') + box.label(text='Any video rendered from these frames will be padded with black pixels.') + def activate(): """Activates draw callbacks, menu items etc. for Flamenco."""