Hey all.
I'm trying to submit (with python) a job to deadline that will export vray
scene to a specified location.
the next step will be to send another job with dependency to the previous
job that will render those vray scenes files with vray standalone nodes.
i managed to send a job with the right parameters that look similar to the
job submitted from deadline submitter but it doesn't seems to to take the
output path for the vray scene from the parameter, instead it take the path
from the render settings field.
sometimes it renders instead of exporting vray scene files, not sure why.
in addition it doesn't export vray scene file foe each render layers if the
maya scene contains it (i'm using render layer legacy)
i'm using and old script i have to send jobs to deadline.
in order to send vray scene export jon i cahnge the 'Renderer' to
'vrayExport' and specifiy the parameter 'VRayExportFile'
this is the job parameters:
[image: Screenshot 2023-04-10 140341.png]
maybe there is a better way to do it..
import subprocess
import pymel.core as pm
from maya import cmds
import sys
import os
import time
class DeadlineLayer:
def __init__(self):
self.version = cmds.about(version=True)
self.scene_file = cmds.file(q=True, sn=True)
self.project_path = 'example'
self.camera = 'persp'
self.priority = 50
self.width = pm.getAttr("defaultResolution.width")
self.height = pm.getAttr("defaultResolution.height")
self.renderer_name =
pm.getAttr("defaultRenderGlobals.currentRenderer")
self.output_path = self.project_path + 'images/'
self.vray_export_path = self.project_path + 'data/vray_scenes/'
self.output_file_prefix = 'default_output_file_prefix'
self.startFrame = str(int(pm.playbackOptions(q=True, min=True)))
self.endFrame = str(int(pm.playbackOptions(q=True, max=True)))
self.frame_range = self.startFrame + "-" + self.endFrame
self.chunk_size = 1
self.job_name = "default_job_name"
self.output_directory = ''
self.pool = 'none'
self.group = ''
self.batch_name = 'batch_name_default'
self.plugin = 'MayaBatch'
def maya_deadline_job(self, layer):
"""
this function will collect scene file information and write a job
file
:return:
"""
info_txt = 'Animation=1\n' \
'Renderer={}\n' \
'UsingRenderLayers=1\n' \
'RenderLayer={}\n' \
'RenderHalfFrames=0\n' \
'LocalRendering=0\n' \
'StrictErrorChecking=0\n' \
'MaxProcessors=0\n' \
'AntiAliasing=high\n' \
'Version={}\n' \
'Build=64bit\n' \
'ProjectPath={}\n' \
'ImageWidth={}\n' \
'ImageHeight={}\n' \
'OutputFilePath={}\n' \
'OutputFilePrefix={}\n' \
'VRayExportFile={}\n' \
'Camera={}\n' \
'Camera0={}\n' \
'Camera1=RENDERShape\n' \
'Camera2=frontShape\n' \
'Camera3=perspShape\n' \
'Camera4=sideShape\n' \
'Camera5=topShape\n' \
'UseLegacyRenderLayers=1\n' \
'IgnoreError211=0'.format(self.renderer_name,
layer,
self.version,
self.project_path,
self.width,
self.height,
self.output_path,
self.output_file_prefix,
self.vray_export_path,
self.camera,
self.camera,)
maya_deadline_job_file =
r'{}\maya_deadline_job.job'.format(os.getenv('TEMP'))
with open(maya_deadline_job_file, 'w') as job_file:
job_file.write(info_txt)
return maya_deadline_job_file
def maya_deadline_info(self, layer):
"""
this function will collect maya deadline information and write a
job file
:return:
"""
info_txt = 'Plugin={}\n' \
'BatchName={}\n' \
'Name={}\n' \
'Comment=Render Launch by Python\n' \
'Pool={}\n' \
'Group={}\n' \
'SecondaryPool=\n' \
'MachineLimit=0\n' \
'Priority={}\n' \
'OnJobComplete=Nothing\n' \
'TaskTimeoutMinutes=0\n' \
'MinRenderTimeMinutes=0\n' \
'ConcurrentTasks=1\n' \
'Department=\n' \
'Group=none\n' \
'LimitGroups=\n' \
'JobDependencies=\n' \
'InitialStatus=Active\n' \
'OutputFilename0={}\n' \
'Frames={}\n' \
'UserName={}\n' \
'ChunkSize={}'.format(self.plugin,
self.batch_name,
self.job_name,
self.pool,
self.group,
self.priority,
self.output_directory,
self.frame_range,
'',
self.chunk_size
)
maya_deadline_info_file =
r'{}\maya_deadline_info.job'.format(os.getenv('TEMP'))
with open(maya_deadline_info_file, 'w') as job_file:
job_file.write(info_txt)
return maya_deadline_info_file
def submit_to_deadline(self, layer):
"""
this function will send current scene to deadline for rendering
:return:
"""
deadline_cmd = r"C:\Program
Files\Thinkbox\Deadline10\bin\deadlinecommand.exe"
job_file = self.maya_deadline_job(layer)
info_file = self.maya_deadline_info(layer)
command = '{deadline_cmd} "{info_file}" "{job_file}"
"{self.scene_file}"'.format(**vars())
process = subprocess.Popen(command, stdout=subprocess.PIPE)
lines_iterator = iter(process.stdout.readline, b"")
submit_to_deadline('')
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/88c5d12d-5bce-4eaa-bfe2-151761d9627cn%40googlegroups.com.