How can I setup a simple sanity check so that the jobs wont submit unless a renderable camera is selected?
Thanks.
How can I setup a simple sanity check so that the jobs wont submit unless a renderable camera is selected?
Thanks.
As far as I know, there’s no sanity-check hook for the Maya submitter like there are for some other submitters.
How comfortable are you with MEL scripting? Editing the <DeadlineRepository>/submission/Maya/Main/SubmitMayaToDeadline.mel
seems like the easiest entry point for this.
If you do end up modifying the submitter, placing your edited version in <DeadlineRepository>/custom/submission/Maya/Main/
is considered best practice and will avoid the file being overwritten if/when you upgrade your repository (however, you usually still need to mess around to see what’s new in the shipped file and take action on your version accordingly, if desired).
Thank you for your response. Unfortunately not at all comfortable with MEL. The sanity checks in 3ds Max work really well I was surprised to see the Maya version have hardly any.
Yeah I know what you mean. I can’t really speak for what Thinkbox’s thinking (no pun intended) are here, nor why they’ve just doubled down on the MEL version of the submitter for so long now.
Anyway, how are you with Python? I’m sure I can help you slip a Python-hook in there to do what you need to do…
sorry I dont know any python.
This here requires no file edit. It simply checks all camera on every layer and stop itself if any layer has no renderable camera. If at least 1 is found on every layer, it calls the submission script normally at the end.
from maya import cmds
from maya import mel
def check_renderable():
renderLayers = cmds.ls(type='renderLayer')
for layer in renderLayers:
cmds.editRenderLayerGlobals(currentRenderLayer=layer)
cameras = cmds.ls(type='camera')
if not any(cmds.getAttr('%s.renderable' % cam) for cam in cameras):
print('No renderable camera found --> %s' % layer)
return False
return True
if check_renderable():
mel.eval('SubmitJobToDeadline')
Thank you for that, getting and error though
if check_renderable():
mel.eval(‘SubmitJobToDeadline’);
// Error: def check_renderable():
//
// Error: Line 4.22: Syntax error //
Looks like you’re trying to run Python code in a MEL interpreter.
thanks, I realised after I had sent that message.