From f7e6bfa5bc1e64c7ba16d6cf705b20542dc5c756 Mon Sep 17 00:00:00 2001 From: n-jay Date: Mon, 15 Apr 2024 19:58:44 +0530 Subject: [PATCH] Enable animation rendering --- .../blender/OpenCue-Blender/Submission.py | 15 +++++++++---- .../blender/OpenCue-Blender/__init__.py | 22 +++++++++++++++++-- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/cuesubmit/plugins/blender/OpenCue-Blender/Submission.py b/cuesubmit/plugins/blender/OpenCue-Blender/Submission.py index 2d8f1fe70..3832f3fce 100644 --- a/cuesubmit/plugins/blender/OpenCue-Blender/Submission.py +++ b/cuesubmit/plugins/blender/OpenCue-Blender/Submission.py @@ -27,6 +27,7 @@ def buildBlenderCmd(layerData): blenderFile = layerData.get('cmd').get('blenderFile') outputPath = layerData.get('cmd').get('outputPath') outputFormat = layerData.get('cmd').get('outputFormat') + frameRange = layerData.get('layerRange') # Hardware use for rendering addon_prefs = bpy.context.preferences.addons['OpenCue-Blender'].preferences @@ -39,15 +40,21 @@ def buildBlenderCmd(layerData): if not blenderFile: raise ValueError('No Blender file provided. Cannot submit job.') - renderCommand = '{renderCmd} -b -noaudio {blenderFile} -E CYCLES'.format( + renderCommand = '{renderCmd} -b -noaudio {blenderFile}'.format( renderCmd="blender", blenderFile=blenderFile) if outputPath: renderCommand += ' -o {}'.format(outputPath) if outputFormat: renderCommand += ' -F {}'.format(outputFormat) - # The render frame must come after the scene and output - # renderCommand += ' -f {frameToken}'.format(frameToken="#IFRAME#") - renderCommand += ' -f 1 -- --cycles-device {renderHW}'.format(renderHW=renderHW) + # Option to render still frame or animation must come after the scene and output + if frameRange: + renderCommand += ' -s {frameStart} -e {frameEnd} -a'.format( + frameStart="#FRAME_START#", + frameEnd="#FRAME_END#") + else: + renderCommand += ' -f {frameToken}'.format(frameToken="#IFRAME#") + renderCommand += ' -E CYCLES -- --cycles-device {renderHW}'.format( + renderHW=renderHW) return renderCommand diff --git a/cuesubmit/plugins/blender/OpenCue-Blender/__init__.py b/cuesubmit/plugins/blender/OpenCue-Blender/__init__.py index add50c596..8dba35971 100644 --- a/cuesubmit/plugins/blender/OpenCue-Blender/__init__.py +++ b/cuesubmit/plugins/blender/OpenCue-Blender/__init__.py @@ -45,8 +45,8 @@ def execute(self, context): 'outputPath': context.scene.output_path, 'outputFormat': 'PNG' }, - 'layerRange': '1', - 'chunk': '1', + 'layerRange': context.scene.frame_spec, + 'chunk': context.scene.chunk_size, 'cores': '0', 'env': {}, 'services': [], @@ -93,6 +93,12 @@ def draw(self, context): col = layout.column() col.prop(context.scene, "output_path") + col = layout.column() + col.prop(context.scene, "frame_spec") + + col = layout.column() + col.prop(context.scene, "chunk_size") + col = layout.column() col.operator("object.submit_job", text="Submit") @@ -146,6 +152,18 @@ def register(): default="" ) + bpy.types.Scene.frame_spec = bpy.props.StringProperty( + name="Frame spec", + description="Enter frame spec", + default="" + ) + + bpy.types.Scene.chunk_size = bpy.props.StringProperty( + name="Chunk size", + description="Enter chunk size", + default="" + ) + bpy.types.Scene.output_path = bpy.props.StringProperty( name="Output path", description="Enter output path for rendered frames",