Oh, right, the latest version of SMTD has some code in it to allow canceling the job via the submit button. Originally, a variable SMTDIsCurrentlySubmitting was initialized to false, and set to true when the checkbutton is pressed. In your version, it remains false, and causes the WaitForCommandToComplete function to bail out early. So in your version the first job might submit, but the rest of the SMTD functions would never know.
Recently I changed this variable to start as undefined because it was causing exactly this premature canceling of the deadlineCommand wait in other scripts, including all non-Deadline integrations like Krakatoa, XMesh, Stoke etc. That fix might be in 9.0.2.0, but you don’t have it yet. The fix makes the variable basically have 3 states - undefined, true, and false.
- undefined means “outside of submission process”,
- true means “submission started and not canceled”, and
- false means “user just canceled by unchecking the UI SUBMIT checkbutton”…
Here is a fix where we set the variable to true before submission, and to undefined when it is done…
[code](–start local scope
–If SMTD has not been opened yet, or has been closed since the start of 3ds Max, launch its UI:
if SMTD_MainRollout == undefined or not SMTD_MainRollout.open do macros.run “Deadline” “SubmitMaxToDeadline”
local theRenderer = renderers.current --get the current renderer
if isKindOf theRenderer VRay do --if it is VRay, we are good to go
(
–Render final image is disabled, light cache is set to render in the output dir
local oldRenderDialogState = renderSceneDialog.isopen() --see if the render dialog was open
renderSceneDialog.close() --close it before submission
rendSaveFile = false --disable output file saving
theRenderer.options_dontRenderImage = true --disable the rendering
local lcpath = getFileNamePath rendOutputFilename + getFileNameFile rendOutputFilename + “.vrlmap” --build the LC path name
theRenderer.lightcache_autoSave = true --enable LC auto-save
theRenderer.lightcache_autoSaveFileName = lcpath --and set the file name to the cache path
–Job sends to deadline
::SMTDIsCurrentlySubmitting = true
SMTDSettings.PreviousJobsArray = #() --clear the dependencies list
SMTDSettings.SubmitAsDependent = false --disable dependencies for first job submission
SMTD_MainRollout.getNameFromMaxScene() --update the job name in the UI
local oldJobName = SMTDSettings.JobName --store the current job name
SMTDSettings.JobName = oldJobName+" [VRay LC]" --set the LC job’s name
local batchName = oldJobName + " [VRay LC + Render]" --a batch name to combine the two jobs
local result = SMTDFunctions.SubmitJobFromUI batchName:batchName --submit the job to Deadline as part of the batch
format “%\n” result
if SMTDSettings.PreviousJobsArray.count > 0 do
(
–Render final image is enabled, lc is switched to “from file” and uses the precalced light cache
rendSaveFile = true --re-enable output file saving
theRenderer.options_dontRenderImage = false --re-enable rendering
theRenderer.lightcache_autoSave = false --disable the auto save mode
local old_lightcache_mode = theRenderer.lightcache_mode --store the old mode
theRenderer.lightcache_mode = 2 --set LC mode to From File
theRenderer.lightcache_loadFileName = lcpath --set the load file to the cached path from the previous submission
–Job sends to deadline with the first as a dependency.
SMTDSettings.SubmitAsDependent = true --enable dependencies
SMTDSettings.DependencyJobItems = #{1} --set the dependency on the first entry from the list
SMTDSettings.DependOnPreviousJobMode = #last --set the mode to last, so only the last job is concidered
SMTDSettings.JobName = oldJobName+" [VRay Render]" --set the job name
local result = SMTDFunctions.SubmitJobFromUI batchName:batchName --submit to Deadline as part of the same batch
format “%\n” result
SMTDSettings.JobName = oldJobName --restore the job name
SMTDSettings.SubmitAsDependent = false --disable dependencies
SMTDSettings.DependencyJobItems = #{} --and clear the dependency jobs bitarray flags
theRenderer.lightcache_mode = old_lightcache_mode --restore the old cache mode
)
if oldRenderDialogState do renderSceneDialog.open() --reopen the render dialog if needed
::SMTDIsCurrentlySubmitting = undefined
)–end if
)–end local scope[/code]