AWS Thinkbox Discussion Forums

Possible to modify the draft submission ui to add some bits?

Heya Folks,

I’m not an amazing coder by any means but I can fiddle my way around scripts to an extent. Just curious if it’d be possible to add in some extra commands into the submission ui that are taken care of by settings in the templates? We’re using draft to replace a previous quicktime creator that we had custom written and draft does pretty much the lot save for having the frame rate, lut and a few extra text boxes for notes and so on exposed. I know they’re available in the templates but it’d make things handier for the producers in here to be able to do that via ui rather than anyone having to make a new template.

Is the submission script ui available in a human readable format that I’d be able to tinker with to get the above behaving or is it more in depth than that?

Cheers!

John

Hi John!

That depends… do you consider python scripts human readable? (I do, but I know lots of folks who don’t. :wink: ) You can find the script that creates the submission dialog in YourDeadlineRepository/scripts/Jobs/DraftSubmission.py. (Or YourDeadlineRepository/scripts/Submission/DraftSubmission.py for submission using Shotgun, I believe.)

You add the controls in main, and the arguments are processed in SubmitButtonPressed. Any additional parameters you add there can then be read from the parameter dictionary the same way the existing parameters are. If you have any specific questions about the script after having a look around, let me know!

Note: Also check out the documentation on this page: http://www.thinkboxsoftware.com/draft-custom-args-recipe/

Cheers,
Andrea

Thanks Andrea, no doubt I’ll be back with a few dumb questions. As an aside it’d be great to get a few more pointers with how the additional args type in at the bottom of the submitter is handled internally in terms of using params[‘arg name here’] or params.get[‘arg name here’] and so on - I’ve gotten a few things by fiddling around with it but the errors are a tiny bit random as to whether it’s my syntax or what draft is expecting.

Much appreciated!

“Additional Args” are entered in the format: argName1=value1 argName2=value2 etc, with spaces between args, and the value in quotation marks where necessary. The “argName” argument names can be whatever you want (within reason… no spaces, etc… I suggest sticking to alpha-numeric ascii). You can then add these arguments to your expectedTypes dictionary and use the ParseCommandLine method to get them converted into the types you’re expecting. So, if I had entered the following additional args: myIntegerArg=5 myFloatArg=3.14 myStringArg="To be or not to be" In my code I would have:[code]expectedTypes = dict()
expectedTypes[‘myIntegerArg’] = ‘’
expectedTypes[‘myStringArg’] = ‘’
expectedTypes[‘myFloatArg’] = ‘’

Parse the command line arguments.

params = ParseCommandLine( expectedTypes, sys.argv ) # params now contains a dictionary of the parameters initialized to values from the command line arguments.
myIntegerArg = params[‘myIntegerArg’]
myStringArg = params[‘myStringArg’]
myFloatArg = params[‘myFloatArg’][/code]Note: * The order in the dictionary doesn’t need to match the order you enter them in the additional args field.

  • Any argument that appears in the additional arguments field but not in the expectedTypes dictionary will still end up in params, but will not be converted from the string format (allowing you to have them as optional arguments and manually convert them to what you’re expecting).

If you tell me your error messages and what you’re putting in the additional arguments field, I can be more specific about what went wrong.

See also: http://www.thinkboxsoftware.com/draft-using-custom-parameters/

That’s plenty to mull over - many thanks Andrea!

That’s worked beautifully - much appreciated!

The custom arguments are doing pretty much everything we need right now with the default submitter and draft templates but what I’ll likely try next is gutting the ui and streamlining it for the type of bits we need day to day. I’ve tried a few dumb things like adding in additional controls, renaming things and so on with slightly less luck, I’m either getting no ui on launch (I’d imagine this is down to me using an editor that wasn’t set properly for python tabs and spacing) or getting nothing when I hit submit (again likely not adding in my extra bits into the on submit event). I’m only new to python so I’m not expecting too much yet but thanks so much for the pointers, it’s sorted all of the work bits we need to do at the minute!

Cheers,

John

Welcome! I’m glad to hear at least some of it is working for you.

For the UI changes, go gradual at first while you get the hang of it… if you make small changes and test, it’s easier to figure out what went wrong. If you think it might be a tab/space issue, many text editors have a “show invisibles” that will show symbols for spaces and tabs so that it’s easier to see what is where. Good luck, and let us know if we can help!

So I ran into a few issues with a ui launching fine and asking me do I want to create folders that don’t exist on submitting and nothing happening after (that was a slight pain since there’s no crash log or error thrown to chase with) but it was just a case of me renaming a UI for my own purposes that was far more important than just a dumb text box, once I put that back in I was fine.

Much appreciated for all of the guidance Andrea, we’re back up with the same functionality we had before so the producers in here owe you a pint :smiley:

Yeah, when you’re thinking of renaming one of the UI elements, it helps to do a search on the name to see if it gets used anywhere else. :wink:

You’re welcome… you can drink my pint for me, and let me know it was good. :wink:

Just for the sake of convenience I was going to add in the lut options in a drop down combo box and then pass that into an if statement in the draft template. It seems as if drop down controls have far more complexity in the normal submission dialogs and they’re configured function and content wise in a different file? Is this the case and if so where would I look for some more bits to copy / paste and make everything explode?

I probably should have mentioned this before, but I forgot that it was there… in YourDeadlineRepository/scripts/General there’s a ScriptUIExample.py file, with examples of how to set up the various UI components. The sample combo box is: scriptDialog.AddControl( "ComboLabel", "LabelControl", "Select An Item", labelWidth, -1 ) scriptDialog.AddComboControl( "ComboBox", "ComboControl", "2008", ( "2007", "2008", "2009", "2010", "2011" ), dialogWidth - labelWidth - 24 - 200, -1 )Here we can see that the values we have to choose from are given as a list of strings: ( “2007”, “2008”, “2009”, “2010”, “2011” ), and the argument before the list would be the item selected by default. (I think the combo boxes that are defined in another file are commonly used ones, and it’s not necessary to have them in another file.)

Another user previously asked me to set up source and output LUT controls… I haven’t tested this on the latest Deadline, but this is what I sent him:[code] scriptDialog.AddRow()
scriptDialog.AddControl( “SourceColorLabel”, “LabelControl”, “Source Color Space”, labelWidth, -1 )
scriptDialog.AddComboControl( “SourceColorComboBox”, “ComboControl”, “none”, (“none”,“Cineon”,“Alexa”,“sRGB”,“Rec709”,“custom gamma”), dialogWidth - labelWidth - 24 - 200, -1 )
scriptDialog.AddControl( “SourceGammaLabel”, “LabelControl”, “Gamma”, 50, -1 )
scriptDialog.AddControl( “SourceGammaBox”, “TextControl”, “”, 100, -1 )
scriptDialog.EndRow()

scriptDialog.AddRow()
scriptDialog.AddControl( "DestColorComboLabel", "LabelControl", "Dest Color Space", labelWidth, -1 )
scriptDialog.AddComboControl( "DestColorComboBox", "ComboControl", "none", ("none","Cineon","Alexa","sRGB","Rec709","custom gamma"), dialogWidth - labelWidth - 24 - 200, -1 )
scriptDialog.AddControl( "DestGammaLabel", "LabelControl", "Gamma", 50, -1 )
scriptDialog.AddControl( "DestGammaBox", "TextControl", "", 100, -1 )
scriptDialog.EndRow()[/code]Then, in SubmitDraftJob, you'd add:[code]
	args.append( 'inColor="%s" ' % scriptDialog.GetValue( "SourceColorComboBox" ) )
	args.append( 'inGamma="%s" ' % scriptDialog.GetValue( "SourceGammaBox" ) )
	args.append( 'outColor="%s" ' % scriptDialog.GetValue( "DestColorComboBox" ) )
	args.append( 'outGamma="%s" ' % scriptDialog.GetValue( "DestGammaBox" ) )[/code]In __main__, don't forget to add "SourceColorComboBox","SourceGammaBox","DestColorComboBox","DestGammaBox" to settings, so that you can have them be sticky as well.

In your Draft script, the selected LUT would come in as a string which you would then use in a conditional statement as you expected. I would recommend not adding the gamma fields to the expectedTypes dictionary, so that they can be treated as optional.

Let me know if this is sufficient assistance on this, or if you have more questions.

This has worked fabulously Andrea - much appreciated for keeping up the tradition of thinkbox being a great company to work with. I’ve gotten everything behaving in there although the lut’s seem quite heavy handed - we only use them for sending back to vfx edits so I think it’s arbitrary which one is used to give it a roughly correct black level. Now the only thing to fix is support for multiple jobs from one dialog which I’ve broken along the way, should be fine with the output from the error logs though.

Much appreciated for everything!

Glad to hear! Thanks, and you’re welcome!

Privacy | Site terms | Cookie preferences