If I understand you correctly, you are asking how to do the dependency part (since the rest looks pretty good to me).
Assuming that your code for submitting the lighting calculations job came before the code your posted, you would need to insert the following between the two parts of the script:
--(YOUR LIGHTING JOB SUBMISSION CODE GOES HERE)
--Get the message from the previous submission:
renderMsg = SMTDFunctions.getRenderMessage()
--Extract the JobID of the first submission from that message:
SMTDFunctions.getJobIDFromMessage renderMsg
--Assuming the previous submission was successful, you can find it here:
if SMTDSettings.DeadlineSubmissionLastJobID != "failed" do
(
--get all jobs from Deadline Repository:
result = SMTDFunctions.CollectJobs()
--if the call was successful, the property SMTDSettings.JobsArray would contain the jobs
if result == #success do
(
--collect an array with the indices of jobs matching your previous submission:
depJobs = for i = 1 to SMTDSettings.JobsArray.count where SMTDSettings.JobsArray[i][2] == SMTDSettings.DeadlineSubmissionLastJobID collect i
--assign the result as the bitarray of enabled dependency IDs
SMTDSettings.DependencyJobItems = depJobs as bitarray
)
)
--After the above code, if you have
SMTDSettings.SubmitAsDependent = true
--and you call any functions that produce a JobInfoFile (like you do with the tile submission),
--the file entry "JobDependencies" will be set to the ID of the previously submitted job.
--(YOUR TILE SUBMISSION CODE GOES HERE)
for some reason. The trouble is that every time you call waitForCommandToComplete(), the “render message” file is overwritten. So when you tried to submit the dependent Render job with the second button, it did not find the message from the first submission, but the message from the -ResumeJob attempt!
was a great idea since it would have captured the correct ID at the right time and passed it over to the render job, but you never used it in the Render submission.
I assume you were just too afraid to touch my code Don’t be, it did not include any knowledge of what else was going on in your code.
So just modify it like this:
--Get the message from the previous submission:
--renderMsg = SMTDFunctions.getRenderMessage() --BOBO: WE DON'T NEED THIS ANYMORE!
--Extract the JobID of the first submission from that message:
--SMTDFunctions.getJobIDFromMessage renderMsg --BOBO: WE DON'T NEED THIS ANYMORE!
--Assuming the previous submission was successful, you can find it here:
if irr_dep_job != "failed" do --BOBO: WE USE THE JOB ID VARIABLE FROM THE PREVIOUS SUBMISSION!
(
--get all jobs from Deadline Repository:
result = SMTDFunctions.CollectJobs()
--if the call was successful, the property SMTDSettings.JobsArray would contain the jobs
if result == #success do
(
--collect an array with the indices of jobs matching your previous submission:
depJobs = for i = 1 to SMTDSettings.JobsArray.count where SMTDSettings.JobsArray[i][2] == irr_dep_job collect i --BOBO: USE THE JOB ID VARIABLE
--assign the result as the bitarray of enabled dependency IDs
SMTDSettings.DependencyJobItems = depJobs as bitarray
)
)
When I make these modifications, I get 3 jobs - the Caching job in green, the Render job as dependency in orange, and a tile assembly job dependent on the render job in orange.
honestly never touched maxscript at all, so surprised i got this far without breaking something, and was definitely afriad to hack into your code too much.