Submit with Draft on with custom MAxscript submitter?

No matter what I try to set properties in SMTDSettings.
Deadline seems remembering the value once I set with Pipeline Tool UI.

What could be the way to submit Deadline job with Draft on?

The SMTDSettings struct does NOT deal with the Pipeline Tools. The Pipeline Tools are external tools to 3ds Max, and are identical in all 3D applications that implement them. They are written in Python and are implemented by the scripts found in \\DeadlineRepository10\submission\Integration\Main\

SMTD merely calls these Python scripts via deadlinecommand script execution and passes arguments like the name of the scene and the batch name. The Pipeline Tools remember these settings for that specific scene by writing to a settings file. This is why you are not allowed to open the Pipeline Tools until you have saved your scene file, as the scene is used as a key to store that information. Thus, the enabling of Draft for a particular .MAX scene persists between sessions, but not via any content written in the .MAX file or the SMTD settings - it is stored by the Pipeline Tools themselves (see ..\submission\Integration\Main\PipelineToolsSettingsWriter.py)

Try this:

  • Create a scene with a Teapot, save it as “c:/temp/test.max”
  • Open SMTD, open Pipeline Tools, enable Draft (“Draft On” shows up in the UI)
  • Now go to File>Reset and reset the scene to Untitled
  • Reopen SMTD - the UI shows “Draft Off”
  • Close 3ds Max
  • Start 3ds Max again
  • Load the recent test.max scene
  • Open SMTD - you get “Draft On” because SMTD calls SMTDFunctions.GetPipelineToolStatus(), which calls the JobWriter.py in the ..\submission\Integration\Main\ folder to read the value corresponding to that particular scene path.
  • Now go to File > Save As… and save as test2.max
  • Reopen SMTD - you get “Draft Off” because there is no record against that scene name in the Pipeline Tools settings.

When SMTD submits a job after the Pipeline Tools have been enabled, it eventually calls the function SMTDFunctions.ConcatenatePipelineSettingsToJob() which also executes the JobWriter.py script. But this time it tells it to append the Draft settings for the current scene to the .JOB file already created by SMTD. It uses the ExtraInfoKeyValue#=Key=Value entries to do so.

So you could look at what ExtraInfoKeyValue entries a Draft submission produces, and set your own ExtraInfoKeyValue entries via SMTD without ever enabling the Pipeline Tools Draft option for your specific scene. Just pretend that the values you output were created by the Pipeline Tools…

Here is what I got when I enabled Quick Draft in Pipeline Tools and submitted without touching any other settings:

In the Submission Params, you can see them in the Job Info Parameters list:

Since SMTD allows you to set your own Extra Keys via the SMTDSettings.ExtraInfoKeyValues array, you would have to set it to something like

SMTDSettings.ExtraInfoKeyValues = #(
    #("DraftFrameRate","24"),
    #("DraftType","movie"),
    #("DraftExtension","mov"),
    #("DraftCodec","mjpeg"),
    #("DraftQuality","85"),
    #("DraftColorSpaceIn","Identity"),
    #("DraftColorSpaceOut","Identity"),
    #("DraftResolution","1"),
    #("SubmitQuickDraft","True")
)

So even if your SMTD has “Draft Off” in the UI, this should have the same effect at the end of the rendering of your new job - a QuickDraft job would be spawned!

This is not exactly public knowledge (it is not documented as far as I can tell), but it is also not secret as all the code in SMTD and the Integration scripts is available… I will make a note that it needs to be documented better.

Continuing from my previous post, the solution only works if the scene in question does NOT have its Pipeline Tools enabled.

This is because the concatenate function in the JobWriter.py script reads the JOB file written by SMTD into a dictionary, kills the custom extra keys you might have provided, and injects its own, then writes out a new file that contains the Pipeline Tools values and excludes yours.

In other words, the SMTD UI Pipeline Tools settings always override any custom values from SMTDSettings.ExtraInfoKeyValues.

But in a custom submission pipeline that does not even expose the SMTD UI to the end user, this should not be an issue - just define the required values in the SMTDSettings.ExtraInfoKeyValues array of arrays, and your jobs should spawn Draft jobs when they finish rendering.

1 Like

The script file PipelineToolsSettingsWriter.py is responsible for storing the Pipeline Tools data on disk. You can find in the last lines of the script how the JSON filename is built:

def GetPathToPipelineToolSettings( appName, user, sceneName, sceneKey ):
    """ Method for generating the path to a scene's pipeline tool settings.
                Arguments:
                    appName (str): Name of the application being used (Ex. Maya, 3ds Max).
                    user (str): Name of the machines user (Ex. chris)
                    sceneName (str): Name of the current scene.
                    sceneKey (str): 10 character unique key
    """
    return os.path.join(ClientUtils.GetUsersSettingsDirectory(), "pipeline_tools",
                 appName + "_" + user + "_" + sceneName + "_" + sceneKey + ".JSON")

So if I set up a MAX scene with the name “Drafttest”, I can see in the folder C:\Users\bobop\AppData\Local\Thinkbox\Deadline10\settings\pipeline_tools the corresponding file 3dsmax_bobop_drafttest_30cc2ef230.JSON which contains the settings for that specific scene. Note that the hexadecimal hash portion at the end of the filename reflects both the path and the filename of the MAX scene. This is true for other applications like Maya, except their settings files will have a “Maya” prefix instead.

The file contains something like

{"DraftFrameRate": "24", "DraftType": "movie", "DraftExtension": "mov", "DraftCodec": "mjpeg", "DraftQuality": 85, "DraftColorSpaceIn": "Identity", "DraftColorSpaceOut": "Identity", "DraftResolution": "1", "SubmitQuickDraft": true}

Deleting the file disables the Draft settings of the Pipeline Tools for that particular scene!