Draft Reference Manual
Creating Draft Templates
In order to use Draft, you can take advantage of the scripts that we have packaged with Draft. These scripts are stored in the /Draft/Samples folder of the repository.
If you want to something more advanced that what the samples provide you will need to write your own Draft Template scripts. Draft Scripts are simply Python scripts that import the Draft Module. Developers can look the Draft Cookbook to find helpful recipes for building Draft Templates. The following sections of this manual focus on the reference material for the Draft Module.
If you are using Draft as a standalone tool, you will need to ensure Python knows where to look for the Draft module, either by including its install directory in the PYTHONPATH environment variable, or by appending it to sys.path before you do the import. You will also need to set the MAGICK_CONFIGURE_PATH environment variable to point to your install directory; this is so that ImageMagick knows where to find its 'type.xml' file (see entry on Fonts below for more details). If you are simply planning on using Draft through Deadline, however, you do not need to worry about this at all as Deadline ensures that the enviroment is properly configured when a Draft Template is run
The sample templates typically expect a number of command line parameters (that are usually passed in by Deadline). These parameters can be taken of advantage of in your own scripts. Further implementation examples are in the Deadline Integration Section of the Cookbook.
The parameters expected at the top of the sample scripts are all supplied by Deadline's Draft Event Plugin. Currently, the list of supplied arguments is as follows:
username # Provided by the user when setting up the Draft job. entity # Provided by the user when setting up the Draft job. version # Provided by the user when setting up the Draft job. frameList # The complete list of rendered frames. startFrame # The first frame number of the sequence. endFrame # The last frame number of the sequence. infile # The padded frame sequence filename; padding is denoted by # characters outfile # An output file width # The width of the input images (NOT ALWAYS SUPPLIED) height # The height of the input images (NOT ALWAYS SUPPLIED))
Submitting Draft Jobs to Deadline
Currently, we have hooked up Draft functionality to our integrated submitters. Using the Draft functionality in these integrated submission scripts will submit a Draft job to Deadline upon completion of the primary job (using the Draft Event Plugin). The Deadline Draft plugin will be invoked for this second job, and simply runs the Draft template (python script), supplying it any parameters given upon submission. Note that in order to use this functionality, the Draft Event Plugin must be enabled (this can be done through the Deadline Monitor).
Alternatively, there is also a dedicated Draft submission script available in the Deadline Monitor that will allow you to independently submit Draft jobs.
Draft API Reference
This enum contains all the operators available when compositing images.
UndefinedCompositeOp OverCompositeOp InCompositeOp OutCompositeOp AtopCompositeOp XorCompositeOp PlusCompositeOp MinusCompositeOp AddCompositeOp SubtractCompositeOp DifferenceCompositeOp MultiplyCompositeOp BumpmapCompositeOp CopyCompositeOp CopyRedCompositeOp CopyGreenCompositeOp CopyBlueCompositeOp CopyOpacityCompositeOp
compOperator = Draft.CompositeOperator.OverCompositeOp
This enum contains the different values that can be provided to functions that require positional anchor arguments.
NorthWest North NorthEast West Center East SouthWest South SouthEast
anchor = Draft.Anchor.NorthWest
This class represents a color, in RGBA format.
R -- A decimal value representing the red component (normally 0.0-1.0) G -- A decimal value representing the green component (normally 0.0-1.0) B -- A decimal value representing the blue component (normally 0.0-1.0) A -- A decimal value representing the alpha component (normally 0.0-1.0)
newColor = Draft.ColorRGBA( 0.75, 0.54, 0.975, 1.0 )
newColor = Draft.ColorRGBA() newColor.R = 0.75 newColor.G = 0.54 newColor.B = 0.975 newColor.A = 1.0
A class to retrieve font and text properties for annotations.
Ascent -- The distance in pixels from the text baseline to the highest/upper grid coordinate used to place an outline point. Descent -- The distance in pixels from the baseline to the lowest grid coordinate used to place an outline point. Always a negative value. TextHeight -- The height in pixels of the text written, this does not include any padding TextWidth -- The width in pixels of the text written, this does not include any padding BaselineOffset -- Offset in pixels from the bottom of the image to the baseline used to write the text. Use this to align text from different point sizes and fonts. MaxHorizontalAdvance -- Maximum horizontal advance in pixels.
A class that contains properties used for textual annotations.
PointSize -- An integer value denoting the size of the font. (Defaults to 32.) FontType -- A string value denoting the type of font to use. (Defaults to Adobe's Source Sans Pro.) FontMetric -- A FontTypeMetric object used to retrieve font and text properties for the annotation. Values are set when the annotation is created. Padding -- A decimal value denoting the padding around the text. (Defaults to 0.0.) Color -- A Draft.ColorRGBA value denoting the color of the text. (Defaults to white.) BackgroundColor -- A Draft.ColorRGBA value denoting the background color. (Defaults to transparent.) DrawShadow -- A boolean value denoting whether or not to draw a shadow around the text. (Defaults to false.) ShadowColor -- A Draft.ColorRGBA value denoting the color of the Shadow. (Defaults to black.)
textInfo = Draft.AnnotationInfo() textInfo.PointSize = 24 textInfo.FontType = "Helvetica" textInfo.Color = Draft.ColorRGBA( 0.75, 0.54, 0.975, 1.0 ) textInfo.BackgroundColor = Draft.ColorRGBA( 0.0, 0.0, 0.0, 0.0