Skip to content

Commit

Permalink
Enable animation rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
n-jay committed Apr 15, 2024
1 parent aeee004 commit f7e6bfa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
15 changes: 11 additions & 4 deletions cuesubmit/plugins/blender/OpenCue-Blender/Submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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


Expand Down
22 changes: 20 additions & 2 deletions cuesubmit/plugins/blender/OpenCue-Blender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': [],
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit f7e6bfa

Please sign in to comment.