Skip to content

Commit

Permalink
Enable hardware rendering option in render command
Browse files Browse the repository at this point in the history
  • Loading branch information
n-jay committed Nov 3, 2023
1 parent 4f9f17a commit 27991c1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cuesubmit/plugins/OpenCue/Submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,26 @@
import outline.cuerun
import outline.modules.shell

import bpy

def buildBlenderCmd(layerData):
blenderFile = layerData.get('cmd').get('blenderFile')
outputPath = layerData.get('cmd').get('outputPath')
outputFormat = layerData.get('cmd').get('outputFormat')

# Hardware use for rendering
addon_prefs = bpy.context.preferences.addons['OpenCue'].preferences
use_gpu = addon_prefs.use_gpu
if use_gpu:
renderHW = "GPU"
else:
renderHW = "CPU"

if not blenderFile:
raise ValueError('No Blender file provided. Cannot submit job.')

renderCommand = '{renderCmd} -b -noaudio {blenderFile} -E CYCLES'.format(
renderCmd="blender", blenderFile=blenderFile)
renderCommand = '{renderCmd} -b -noaudio {blenderFile} -E CYCLES -- --cycles-device {renderHW}'.format(
renderCmd="blender", blenderFile=blenderFile, renderHW=renderHW)
if outputPath:
renderCommand += ' -o {}'.format(outputPath)
if outputFormat:
Expand Down

0 comments on commit 27991c1

Please sign in to comment.