Noob Maxscript question...


#1

I’m currently dissecting the available maxscripts for deadline, but I was hoping to get some heads up in the mean time.



Basically we need to submit a scene to a single server, apply some additional processing to it (via maxscript) and then spit that result backout to deadline and the rest of the farm.



I’ve seen some mention about this, but I’m still coming to grips with the code.



Any samples, docs, pointers, suggestions etc would be greatful



Cheers


#2

Hi Shane

There are several possible approaches:



You could submit a MAXScript job using the Submit Max To Deadline (SMTD) script. It has the option to create a MAXScript job and also provides a template where you can enter your processing code. Note that since you will be saving the processed scene to disk, you will have to run the Slave in Workstation mode (with UI and using up a Max license).



Then, as part of your code, you would have to perform a regular job submission. Here you can also go two ways - you could either load and call the submission functions defined in the file SubmitMaxToDeadline_Functions.ms located in your Repository\submission\3dsmax or you could try to launch the SMTD Script including UI and just press its submit button via MAXScript, too. The latter approach is a bit of a hack, but a lot easier to implement I guess.



If you decided to use the SMTD Functions, you would have to look deeper into the files in the Repository\submission\3dsmax folder - the SMTD Script supports several features that cause a master script job to be sent to Deadline and to spawn new regular jobs, so the examples is right there.



For example, the file MaxTileSubmitter.ms is a script used by the Master MAXScript Job that creates Tile rendering jobs, while MaxBatchSubmitter.ms is the script used by the Batch Rendering Master MAXScript Job. Both find out the location of the Repository, load the SMTD_Functions and then call a function in that structure. You will have to locate those functions and see how a regular submission is performed by MAXScript.



A completely different approach would be to implement your own simple submission script that does only the very basic steps - creating the two INI files for the submission, saving the Max file and calling the DeadlineCommand.exe with the correct switches to get the job(s) submitted.



But since all this functionality is more or less there in the SMTD_Functions structure, this approach would be a bit too difficult unless you know Deadline inside-out…



Please ask questions and we will try to guide you through the development process!


#3

Hi Bobo!



Once again, thank you. Always love reading your replies.



Basically, at this time, we need to submit a script job to a single machine. If possible this is what I want to automate, so the user hits a single “submit” button and it gets sent off.



The process script will then use rpm to build all the passes and have the submitted to deadline for the final render…so most of my work is dealing with deadline.



Shane


#4

So in short you want a MacroScript with the text “Send” on it somewhere on a toolbar, no real UI like the SMTD provides. This would mean that the script would have all relevant options like pool name, priority etc. hardcoded, right?



Do you want the script to submit an existing MAX file from disk, or the content of the current scene?



I will try to put together a quick example of what such a script would look like, then you could expand on it or ask new questions :wink:



(This will happen tomorrow, it is 0:30 am now so I am going to bed)


#5

Hi Bobo!



Yeah, that’s about the extent of it.



We’re only using a single pool and repository at the moment and the intention is to send the job to a single, dedicated system.



The max scene will be from an existing file…



The artiest will load the maxfile and click the submit button, then repeat…basically



Shane


#6

Attached is a Sample Submit script.



It lets you pick a .MAX file to submit and an .MS file to apply to the scene, then submits both to Deadline and runs a job which can change the submitted scene using the provided script.



In my test, I created a MAX file containing some teapots and run a script which changes the number of segments of each teapot to 32, then saves the file on the network.



This is really just a simple example with the very basic features included.



It assumes that your pool is called “3dsmax”, so you might want to edit the hard-coded name to whatever your pool name is.



Also, it assumes that the MAX file selected will be processed by Deadline using the Max version that was used to perform the submission. Thus, if you used Max 9 to send a 2008 MAX file, it would fail, but if you used Max 2008 to submit a Max 9 file, it would work.



Note that the job will run in Workstation mode, so it will attempt to pull a Max license - you have to have Max installed and usable in workstation mode for this to work as MAXScript cannot perform save scene operations in Slave mode.



I have included my Max 9 file containing one teapot with 1 segment and the script which processes it. It is hardcoded to save to a network path at Frantic, be sure to edit it to point at a valid network location (mapped drive) for it to work.



So in short,

*Evaluate the file SampleSubmissionScript.ms

*Customize a Toolbar, drag “SampleSubmit” from the “Deadline” category

*Press the button

*Select the scene TeapotScene_Test.max when asked for MAX file

*Select the script TeapotIncreaseSegments.ms when asked for script file

*In the Listener, you should see the result of the submission, either SUCCESS or FAILURE



If the submission worked and the job worked too, you should get a new MAX file called “TeapotIncreasedSegments.max” at the hard-coded location you entered in the TeapotIncreaseSegments.ms processing script…



I have commented the code heavily, hope it is self-explanatory.



If you want to submit the resulting processed file from the Deadline job, you would have to implement most of the submission code I provided inside the processing script, including figuring out the network root, creating the two control files (but this time disabling the MAXScript Job and Workstation Mode flags if you want to render) and calling the submitter with the command line…



If you have any questions, please feel free to ask.


#7

Sorry for the late reply Bobo, we’ve just moved buildings. I really appreciate you going to all this effort and as soon as I can, I will look into it further



Cheers

Shane


#8

Hi Bobo,

Could you provide this script again, its not attached to this thread anymore?

Best,
Fabian-Around


#9

Hi!

I am sorry, I switched computers several times in the past 11 years, it is unlikely I still have those examples saved anywhere.

Cheers,
Bobo