Untitled diff

Created Diff never expires
33 removals
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
67 lines
7 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
42 lines
on btn_submit pressed do
on btn_submit pressed do
(
(


local theNetworkRoot= @"\\FILESERVER\Render724\Cloud\RenderService\DeadlineRepository10"
local theNetworkRoot= @"\\FILESERVER\Render724\Cloud\RenderService\DeadlineRepository10"
local remoteScript = theNetworkRoot + @"\submission\3dsmax\main\SubmitMaxToDeadline_Functions.ms"
local remoteScript = theNetworkRoot + @"\submission\3dsmax\main\SubmitMaxToDeadline_Functions.ms"
local localScript = getDir #userscripts + "\\SubmitMaxToDeadline_Functions.ms"
if doesFileExist remoteScript do
if doesFileExist remoteScript do
(
(
if SMTDFunctions == undefined do
if SMTDFunctions == undefined do
(
(
deleteFile localScript
deleteFile localScript
copyFile remoteScript localScript
copyFile remoteScript localScript
fileIn localScript
fileIn localScript
)
)


SMTDFunctions.loadSettings()
SMTDFunctions.loadSettings()
SMTDSettings.JobName = maxFileName + " [SIMPLE MXS SUBMISSION]"
SMTDSettings.JobName = maxFileName + " [SIMPLE MXS SUBMISSION]"
SMTDSettings.Comment = "Created using the simplest Deadline submission script imaginable."
SMTDSettings.Comment = "Created using the simplest Deadline submission script imaginable."



local maxFileToSubmit = SMTDPaths.tempdir + maxFileName
local maxFileToSubmit = SMTDPaths.tempdir + maxFileName
SMTDFunctions.SaveMaxFileCopy maxFileToSubmit


local SubmitInfoFile = SMTDPaths.tempdir + "\\max_submit_info.job"
local SubmitInfoFile = SMTDPaths.tempdir + "\\max_submit_info.job"
local JobInfoFile = SMTDPaths.tempdir+ "\\max_job_info.job"
local JobInfoFile = SMTDPaths.tempdir+ "\\max_job_info.job"


SMTDFunctions.CreateSubmitInfoFile SubmitInfoFile
SMTDFunctions.CreateSubmitInfoFile SubmitInfoFile
SMTDFunctions.CreateJobInfoFile JobInfoFile
SMTDFunctions.CreateJobInfoFile JobInfoFile


----------------------------------------------------------------
local initialArgs = "\""+SubmitInfoFile+"\" \""+JobInfoFile+"\" \""+maxFileToSubmit+"\" "
--NEW CODE STARTS HERE: External Files Submission via initalArgs file
local result = SMTDFunctions.waitForCommandToComplete initialArgs SMTDSettings.TimeoutSubmission

initialArgs = "" as stringstream --We need to write the initial arguments to a stream to be output to a file
--Define the output files for deadlinecommandbg.exe
format "-outputfiles\n%\n%\n" SMTDPaths.SubmitOutput SMTDPaths.SubmitExitCode to:initialArgs
format "%\n%\n%\n" SubmitInfoFile JobInfoFile maxFileToSubmit to:initialArgs --Output the job and the MAX file

setIniSetting SMTDPaths.InIFile "RenderingOptions" "SubmitExternalFilesMode" ((SMTDSettings.SubmitExternalFilesMode = 3 as string))
--SMTDSettings.SubmitExternalFilesMode = 3 --Set the external files mode to 3 (copy all files)
bitmapFilenames = SMTDFunctions.returnAllBitmaps() --Collect all external files, this also removes the path part
BitmapsCopyData = SMTDFunctions.GetExternalFilesToCopy() --This builds an array of the full name and the stripped name

for aBitmap in BitmapsCopyData do --Write the files to send with the job to the arguments
format "%\n" aBitmap[1] to:initialArgs

local initialArgsFileName = (getFileNamePath SMTDPaths.JobInfoFile + "initialArgsFile.txt") --Define the name of the initial arguments file
local initialArgsFile = createFile initialArgsFileName --Create the file with that name
format "%\n" (initialArgs as string) to:initialArgsFile --Write the strinstream to the file
close initialArgsFile --close the file
initialArgsFileName = "\""+initialArgsFileName+"\"" --add quatation marks around it

SMTDFunctions.SaveMaxFileCopy maxFileToSubmit --save the temp. MAX file with the stripped paths.
--Call the submitter, telling the function that the arguments are from a file instead of a string
result = SMTDFunctions.waitForCommandToComplete initialArgsFileName SMTDSettings.TimeoutSubmission paramIsFile:true



local renderMsg = SMTDFunctions.getRenderMessage()
local renderMsg = SMTDFunctions.getRenderMessage()
SMTDFunctions.getJobIDFromMessage renderMsg
SMTDFunctions.getJobIDFromMessage renderMsg
SMTDFunctions.restoreExternalReferencePaths() --Restore the paths in the MAX file to the original ones

if result == #success then
if result == #success then
(
(
format "Submitted successfully as Job %.\n\n%\n\n" \
format "Submitted successfully as Job %.\n\n%\n\n" \
SMTDSettings.DeadlineSubmissionLastJobID renderMsg
SMTDSettings.DeadlineSubmissionLastJobID renderMsg
)
)
else
else
format "Job Submission FAILED.\n\n%" renderMsg
format "Job Submission FAILED.\n\n%" renderMsg
)--end if
)--end if
)--end on button pressed
)--end on button presse