でそれらを提出するトリックを行う必要があり、私が得た方法ジョブを期限までレンダリングし、ファームソフトウェアをレンダリングします。 締め切りに2つのジョブファイルを書き込むだけです。 1. maya_deadline_job.job 2. maya_deadline_info.job
例えばdeadlinecommand.exe に引数としてこれらのファイルを渡す:
deadlinecommand.exe "maya_deadline_info.job" "maya_deadline_info.job"
ここに私のpythonコード
"""
This script will submit current file to deadline for render
"""
import os
import sys
import subprocess
import maya.cmds as cmds
def maya_deadline_job():
"""
this function will collect scene file information and write a job file
:return:
"""
renderer_name = 'File'
version = cmds.about(version=True)
project_path = cmds.workspace(q=True, directory=True)
width = cmds.getAttr("defaultResolution.width")
height = cmds.getAttr("defaultResolution.height")
output_file_path = cmds.workspace(expandName="images")
output_file_prefix = cmds.getAttr("defaultRenderGlobals.imageFilePrefix")
scene_file = cmds.file(q=True, location=True)
info_txt = 'Animation=1\n' \
'Renderer={}\n' \
'UsingRenderLayers=0\n' \
'RenderLayer=\n' \
'RenderHalfFrames=0\n' \
'LocalRendering=0\n' \
'StrictErrorChecking=1\n' \
'MaxProcessors=0\n' \
'AntiAliasing=low\n' \
'Version={}\n' \
'Build=64bit\n' \
'ProjectPath={}\n' \
'ImageWidth={}\n' \
'ImageHeight={}\n' \
'OutputFilePath={}\n' \
'OutputFilePrefix={}\n' \
'Camera=\n' \
'Camera0=\n' \
'Camera1=RENDERShape\n' \
'Camera2=frontShape\n' \
'Camera3=perspShape\n' \
'Camera4=sideShape\n' \
'Camera5=topShape\n' \
'SceneFile={}\n' \
'IgnoreError211=0'.format(renderer_name
version,
project_path,
width,
height,
output_file_path,
output_file_prefix,
scene_file)
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():
"""
this function will collect maya deadline information and write a job file
:return:
"""
info_txt = 'Plugin=MayaBatch\n' \
'Name=MY_FILE_NAME\n' \
'Comment=Render Launch by Python\n' \
'Pool=none\n' \
'MachineLimit=0\n' \
'Priority=50\n' \
'OnJobComplete=Nothing\n' \
'TaskTimeoutMinutes=0\n' \
'MinRenderTimeMinutes=0\n' \
'ConcurrentTasks=1\n' \
'Department=\n' \
'Group=none\n' \
'LimitGroups=\n' \
'JobDependencies=\n' \
'InitialStatus=Suspended\n' \
'OutputFilename0=C:/Users/raijv/Documents/maya/projects/default/images/masterLayer_2.iff.????\n' \
'Frames=1-10\n' \
'ChunkSize=1'
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():
"""
this function will send current scene to deadline for rendering
:return:
"""
deadline_cmd = r"C:\Program Files\Thinkbox\Deadline\bin\deadlinecommand.exe"
job_file = maya_deadline_job()
info_file = maya_deadline_info()
command = '{deadline_cmd} "{job_file}" "{info_file}"'.format(**vars())
process = subprocess.Popen(command, stdout=subprocess.PIPE)
lines_iterator = iter(process.stdout.readline, b"")
# Lets print the output log to see the Error/Success
for line in lines_iterator:
print(line)
sys.stdout.flush()
submit_to_deadline()
編集がありますinfo -
レンダラーでcmds.getAttr( "defaultRenderGlobals.currentRenderer")を使用しないでください。 _name変数。レイヤーオーバーライドレンダラーを使用するFileを使用します。
関連性がありません:1「C:\\ Program ..」の代わりに 'r'C:\ Program .. ''を使うことができます。 '' r' 'という接頭辞を付けないでください(これは生の文字列リテラル)。 2 - {{maya_exe} "{...}" {file_path} {{{{{{{}}}} "stdout = PIPE'を落として' subprocess.check_call(command) 'だけを使用すると、出力をリダイレクトする必要はありません。 '。 ||あなたの質問は何ですか? 'deadlinecommand'プログラムなしであなたの質問にコマンドを再現するには? – jfs
@ J.F.Sebastian素晴らしいPythonのヒントをお寄せいただきありがとうございます。私はpythonで期限をレンダリングファームにmayaファイルを起動/提出しようとしています。 –
現在のスクリプトではどのような問題がありますか?何が起こると思いますか?代わりに何が起こるのですか? (ステップバイステップで説明する)。エラーが発生した場合。そのままあなたの質問に入れてください。使用しているソフトウェアのバージョン(OS、Pythonなど)について言及してください。質問を編集してそこに情報を入れてください。私は「* mayaファイルを期限までに提出し、pythonで農場をレンダリングする」*を知っていませんが、この情報は他人が質問に答えるのに役立ちます。 – jfs