Post frame script submission.

I am submitting a render by 3dsmax MXS. Along with the render frame I am setting

smtdsettings.RunPostFrameScript = true
smtdsettings.PostFrameScriptFile = “O:\Max Scripts\Utilities\Images-Files\invert shadow.ms”

When the frame does render successfully, I get an error when it tries to run the post frame script

Exception during render: An error occurred in RenderTasks(): RenderTask: Unexpected exception (Exception caught in 3ds max: mxs::file_in() - Tried to execute a maxscript file which doesn’t exist: “C:/Documents and Settings/All Users/Application Data/Frantic Films/Deadline/slave/jobsData/invert shadow.ms”
2010/07/26 11:49:38 INF: Loaded C:/Documents and Settings/All Users/Application Data/Frantic Films/Deadline/slave/jobsData/2944C14_Corner Brook_STATIC_ONLY_STD-2-FOR FURNITURE-1.max
2010/07/26 11:49:38 INF: Job: C:/Documents and Settings/All Users/Application Data/Frantic Films/Deadline/slave/jobsData/2944C14_Corner Brook_STATIC_ONLY_STD-2-FOR FURNITURE-1.max
) (Deadline.Plugins.ScriptPlugin+FailRenderException) (Deadline.Plugins.RenderPluginException)
at Deadline.Plugins.ScriptPlugin.RenderTasks(Int32 startFrame, Int32 endFrame, String& outMessage)

Checking the repository folder for this job, the script

“O:\Max Scripts\Utilities\Images-Files\invert shadow.ms”

has not been copied to the folder.

Also checking the ‘max_job_info.job’ file I do not see any mention of the setting for RunPostFrameScript

but there is one for PostFrameScript

PostFrameScript=invert shadow.ms

Looks like the full path of the script is not in the setting for PostFrameScript.

If I manually set PostFrameScript to

PostFrameScript=“O:\Max Scripts\Utilities\Images-Files\invert shadow.ms” in the ‘max_job_info.job’ file and requeue, it does render the frame and the post frame script is run and the result is correct.

I am running Dealine 3.0 SP1 ond Max2009 64bit.

Is this a possible bug?

Thank you in advance

Ken Chase

Soory looks like posted in wrong forum. I see there is a maxscript group. PLease move if necessary.

Thanks

Ken Chase

Hi Ken,

Are you using a custom submission script that uses the smtdsettings struct to collect the properties? If so, specifying the RunPostFrameScript and PostFrameScriptFile is halfway there. The other half requires that you specify the .ms script as an auxiliary file when submitting the job to Deadline. So for example, you may have this command already:

deadlinecommand "job_info.job" "plugin_info.job" "my_scene.max"

You would have to add the .ms file to the end of this, like so:

deadlinecommand "job_info.job" "plugin_info.job" "my_scene.max" "O:\Max Scripts\Utilities\Images-Files\invert shadow.ms"

If you’re just doing a regular submission (ie: you’re not using a custom script that makes use of the SMTDSettings struct), let us know.

Cheers,

  • Ryan

Thanks for the reply Ryan.

Actually wrote MXS for submitting through MXS years ago. Now I’m adding a post render script for image processing. Here’s a portion of my submission script

renderscenedialog.close()
smtdsettings.jobName = (substring maxfilename 1 (maxfilename.count - 4) + “-” + abc)
smtdsettings.comment = “247 Render Submission”
smtdsettings.priority = 100
smtdsettings.poolname = “247”
smtdsettings.poolexclusive = false
smtdsettings.submitassuspended = false
smtdsettings.submitasmxsjob = false
smtdsettings.singletaskjob = true
smtdsettings.ForceWorkstationMode = false
smtdsettings.RestartRenderer = false
smtdsettings.SubmitAsDependent = false
smtdsettings.DependencyJobItems = #{}
smtdsettings.SubmitVisibleObjectsOnly = false
smtdsettings.RemovePadding = true
smtdsettings.RunPostFrameScript = true
smtdsettings.PostFrameScriptFile = “O:\Max Scripts\Utilities\Images-Files\invert shadow.ms”
my_result = #failed
while my_result != #success do
(
my_result = smtdfunctions.submitjob()
)
my_message = smtdfunctions.getrendermessage()

The post frame script will do an image inversion once the initial image is rendered.
I was looking for the SMTDsettings struct member signalling an auxilary file.

Thanks

Ken

This additional file would have to be manually specified, as shown in my previous post. I’m assuming your custom maxscript is already building up the command line itself, is that correct? If so, then all you should have to do is include the path to the maxscript file as the last argument in the command and you should be good to go.

Cheers,

  • Ryan

I am submitting to deadline using the MXS as in my previous reply, not building up for ‘deadlinecommand’ command.
From what I think I understand to be the equivalent in MXS using smtdsettings struct I have set

smtdsettings.RunPostFrameScript = true
smtdsettings.PostFrameScriptFile = “O:\Max Scripts\Utilities\Images-Files\invert shadow.ms”

Will this not do?

Sorry, I missed the last few lines of the script:

while my_result != #success do
(
    my_result = smtdfunctions.submitjob()
)

I checked that function in the SubmitMaxToDeadline_Functions.ms file, and discovered that this function doesn’t add additional auxiliary files to the command line. Here is the contents of this function:

		fn SubmitJob createJobInfo:true createSubmitInfo:true timeout:3600 =
		(
			SMTDSettings.DeadlineSubmissionSuccessful = false
			SMTDSettings.DeadlineSubmissionLastJobID = "failed"
			renderSceneDialog.Commit()
			try(SMTD_TilesRendering.chk_showRegionGizmo.changed (SMTD_TilesRendering.chk_showRegionGizmo.state = false))catch()
			
			local TempMaxFile = ""
			if( SMTDSettings.SubmitScene ) then
			(
				TempMaxFile = SMTDPaths.TempDir + maxFileName
				if maxFileName == "" do TempMaxFile += "untitled.max"
				if (doesFileExist TempMaxFile) do deleteFile TempMaxFile
				result = SMTDFunctions.SaveMaxFileCopy TempMaxFile
				if result != undefined do return result
			)
			else
			(
				if maxFileName == "" then
				(
					filename = getMAXSaveFileName()
					if filename == undefined do return ""
					
					TempMaxFile = filename
				)
				else
					TempMaxFile = maxFilePath + maxFileName
				saveMaxFile TempMaxFile
			)
				
			local initialArgs = ""
			if SMTDSettings.bgSubmission do initialArgs += "-background -notify "
			if SMTDSettings.dropSubmission do initialArgs += "-drop "
				
			if createSubmitInfo do
				if ((SMTDFunctions.CreateSubmitInfoFile SMTDPaths.SubmitInfofile) != true) do return #SubmitInfoFileCreationFailed
			if createJobInfo do
				if ((SMTDFunctions.CreateJobInfoFile SMTDPaths.JobInfofile) != true) do return #JobInfoFileCreationFailed
			
			if not doesFileExist SMTDPaths.SubmitInfofile do return #SubmitInfoFileMissing
			if not doesFileExist SMTDPaths.JobInfofile do return #JobInfoFileMissing
			
			if( SMTDSettings.SubmitScene ) then
				initialArgs += "\"" + SMTDPaths.SubmitInfofile + "\" \"" + SMTDPaths.JobInfofile  + "\" \"" + TempMaxFile  + "\" "
			else
				initialArgs += "\"" + SMTDPaths.SubmitInfofile + "\" \"" + SMTDPaths.JobInfofile  + "\" "
			
			if SMTDSettings.SubmitAsMXSJob do initialArgs += "\"" + SMTDSettings.MAXScriptFile + "\" "
			
			local retCode = SMTDFunctions.waitForCommandToComplete initialArgs timeout

			SMTD_LastMessage = SMTDFunctions.getRenderMessage()
			if retCode == #success then
			(
				SMTDSettings.DeadlineSubmissionSuccessful = true
				SMTDFunctions.getJobIDFromMessage SMTD_LastMessage
				SMTDFunctions.CopyExternalFilesToRepository() --try to copy external bitmaps
				SMTDFunctions.SubmitTransferJob() -- submits a remote transfer job if necessary
				try(FF_AssetTracker_Functions.TrackDeadlineRender SMTDSettings.DeadlineSubmissionLastJobID)catch()
			)	
			retCode 
		)

You could probably just recreate this function in your maxscript, and then tweak it to add the required maxscript to the command line arguments.

Cheers,
- Ryan

I should note that I grabbed this code from the latest version of Deadline. Since you’re still using Deadline 3, you may want to grab this code yourself from SubmitMaxToDeadline_Functions.ms in \your\repository\submission\3dsmax.

I just whipped up a second submission following the first render submission which is a dependent on the first as a maxscript.

This renders the frame(s)

renderscenedialog.close()
smtdsettings.jobName = (substring maxfilename 1 (maxfilename.count - 4) + “-” + abc)
smtdsettings.comment = “247 Render Submission”
smtdsettings.priority = 100
smtdsettings.poolname = “247”
smtdsettings.poolexclusive = false
smtdsettings.submitassuspended = false
smtdsettings.submitasmxsjob = false
smtdsettings.singletaskjob = true
smtdsettings.ForceWorkstationMode = false
smtdsettings.RestartRenderer = false
smtdsettings.SubmitAsDependent = false
smtdsettings.DependencyJobItems = #{}
smtdsettings.SubmitVisibleObjectsOnly = false
smtdsettings.RemovePadding = true
smtdsettings.RunPostFrameScript = false
smtdsettings.PostFrameScriptFile = “”
my_result = #failed
while my_result != #success do
(
my_result = smtdfunctions.submitjob()
)
my_message = smtdfunctions.getrendermessage()

and this processes the image(s)

renderscenedialog.close()
jobs_array = #()
SMTDFunctions.CollectJobs()
jobs_array = smtdsettings.jobsarray
last_job_submit_id = smtdsettings.DeadlineSubmissionLastJobID
for ccc = 1 to jobs_array.count do
(
if (findstring ((jobs_array[ccc])[2]) last_job_submit_id) != undefined then
(
job_id_found_in_jobs_array = ccc
last_job_submit_name = (jobs_array[ccc])[1]
new_job_submit_name = (substring last_job_submit_name 1 (last_job_submit_name.count - 12)) + “-INVERT_IMAGE”
)
)
smtdsettings.jobName = new_job_submit_name
smtdsettings.comment = “247 Invert Image Submission”
smtdsettings.priority = 100
smtdsettings.poolname = “247”
smtdsettings.poolexclusive = false
smtdsettings.submitassuspended = false
smtdsettings.submitasmxsjob = true
smtdsettings.maxscriptfile = “O:\Max Scripts\Utilities\Images-Files\invert shadow.ms”
smtdsettings.singletaskjob = true
smtdsettings.ForceWorkstationMode = false
smtdsettings.RestartRenderer = false
smtdsettings.SubmitAsDependent = true
smtdsettings.DependencyJobItems = #(job_id_found_in_jobs_array)
my_result = #failed
while my_result != #success do
(
my_result = smtdfunctions.submitjob()
)
my_message = smtdfunctions.getrendermessage()

and it seems to be working