AWS Thinkbox Discussion Forums

Client Render

This is sort of a feature request.
I know Draft was built to render through a Deadline job, but I’d like it to be supported client side as well.
I use it to give the user a preview render of a single slate frame inside the submission window, so they have an idea of what the final render will look like.
I’ve actually been able to get client renders working on Windows, but Mac has been a headache.
I get a:
RuntimeError: unidentifiable C++ Exception
I don’t really expect a solution, but more of hoping that in future releases we could ‘import Draft’ in a Deadline submission window.

I don’t fully understand what exactly you’re trying to do here. Could you provide a more detailed explanation? What client(s) are you trying to use it in? Perhaps you could send us a sample script, either a working Windows one and/or the non-working Mac one? If you don’t want to post those publicly, you can send them to us attached to a support ticket. (Reference this thread in the ticket.)

I can’t show you the exact thing I made, but I was able to throw some generic slate preview tool together by modifying [Deadline Repo]\scripts\Submission\DraftSubmission.py and [Deadline Repo]\draft\Samples\Encode\simple_slate_h264_with_proxy.py. I’ve attached an image of what it looks like. This forum won’t let me attach Python files, and there’s quite a bit of code in the submitter, so I’ll just paste the important parts in this post. What’s happening is the button runs the Draft script. The Draft script saves the image to disk. Then the image on the disk is loaded back in with Qt QPixmap.
Here’s the code for the Preview button and the image. I import SlateTest at the top of the file:

scriptDialog.AddRow()
previewButton = scriptDialog.AddControl( "PreviewButton", "ButtonControl", "Preview", controlWidth, -1 )
previewButton.ValueModified.connect(PreviewPressed)
scriptDialog.EndRow()

previewRow = scriptDialog.AddRow()
scriptDialog.EndRow()
previewLabel = QLabel()
previewLabel.setFixedWidth(tabWidth - 16)
previewLabel.setFixedHeight(291)
previewLabel.setScaledContents(True)
previewRow.insertWidget(0, previewLabel)

and here’s the callback for the Preview button:

def PreviewPressed(*args):
global previewLabel

writePath = str(os.path.join(ClientUtils.GetDeadlineTempPath(), "slate_preview.png"))
print "writePath = " + writePath
SlateTest.MakePreview(writePath)
previewPixmap = QPixmap(writePath)
previewLabel.setPixmap(previewPixmap)

and here’s the whole SlateTest.py file:

import sys
import os

from System import *
from System.IO import *

from Deadline.Scripting import *

# Find where the Draft path is, then add it to the Python path
draftPath = os.path.join(RepositoryUtils.GetRootDirectory(), "draft")

if SystemUtils.IsRunningOnMac():
	draftPath = Path.Combine( draftPath, "Mac" )
else:
	if SystemUtils.IsRunningOnLinux():
		draftPath = Path.Combine( draftPath, "Linux" )
	else:
		draftPath = Path.Combine( draftPath, "Windows" )
	
	if SystemUtils.Is64Bit():
		draftPath = Path.Combine( draftPath, "64bit" )
	else:
		draftPath = Path.Combine( draftPath, "32bit" )

if draftPath not in sys.path:
	sys.path.append(draftPath)

import Draft

def MakePreview(writePath):
	slateFrame = str(os.path.join(RepositoryUtils.GetRootDirectory(), "Draft", "Samples", "slateFrame.png"))

	outWidth = 1920
	outHeight = 1080

	#Annotation info used for burn ins
	annotationInfo = Draft.AnnotationInfo()
	annotationInfo.PointSize = int( outHeight * 0.045 )
	annotationInfo.Color = Draft.ColorRGBA( 1.0, 1.0, 1.0, 1.0 )
	#Font type must be specified otherwise an error will occur.
	#Change this path to a valid font path
	annotationInfo.FontType = r"C:\Windows\Fonts\ARIAL.TTF"

	#prep the Slate Frame
	slate = Draft.Image.ReadFromFile( slateFrame )

	slate.Resize( outWidth, outHeight )

	#sets up the text on the slate frame
	slateAnnotations = [
		("Here is", "some slate text"),
		("Another line", "of slate text")
	]

	#comp the annotations over top the slate frame
	for i in range( 0, len( slateAnnotations ) ):
		annotationTuple = slateAnnotations[i]

		lineNum = i
		if ( annotationTuple[0] != "" ):
			annotation = Draft.Image.CreateAnnotation( slateAnnotations[i][0] + ": ", annotationInfo )
			slate.CompositeWithPositionAndAnchor( annotation, 0.45, 0.7 - (lineNum * 0.06), Draft.Anchor.SouthEast, Draft.CompositeOperator.OverCompositeOp )

		if ( annotationTuple[1] != "" ):
			annotation = Draft.Image.CreateAnnotation( slateAnnotations[i][1], annotationInfo )
			slate.CompositeWithPositionAndAnchor( annotation, 0.46, 0.7 - (lineNum * 0.06), Draft.Anchor.SouthWest, Draft.CompositeOperator.OverCompositeOp )

	slate.WriteToFile(writePath)

Hope this clears things up.

Privacy | Site terms | Cookie preferences