One Class Issue

Hi, guys.

I wanted to create a panel to batch making snapshot.
The idea is to render the first frame of each quicktime file.
I created a function to do the batch render thing. Then I created the panel.

Here’s the function:


# create a function to make snapshots
def makeSnap(qtPath, snapPath, snapFrame):
    qts = os.listdir(qtPath)
    for i in qts:
        if i[0] != '.' and i[-4:] == '.mov':
            # create a Read node with the qt file
            setFile = 'file '
            setFile += '"' + qtPath + i
            setFile += '"'
            qt = nuke.createNode('Read', setFile, inpanel=False)
            # create a Write node with jpg output
            splitextArray = os.path.splitext(i)
            qtName = splitextArray[0]
            snapName = qtName + '.jpg'   
            write = nuke.nodes.Write()
            write['file'].setValue(snapPath + snapName)
            write.setInput(0, qt)
            # start render
            nuke.render('root.%s' %, snapFrame, snapFrame)
            # after rendering, delete nodes
            for n in [qt, write]:

I worked pretty well. But when I wanted to wrap the script into a Class, the problem came out.

It seems like that when the function wraps into the Class, this line, write[‘file_type’].setValue(‘jpeg’), doesn’t work out.

When this line runs just as a part of the function, it works well. But when this line runs as a part of the Class, it’s only changing the file_type property of the write node, but the relative ‘_jpey_quality’ doesn’t come out. So I got a problem when the line write[‘_jpeg_quality’].setValue(1) runs.

Is there something I need to pay attention to when building Class?

No Responses to “One Class Issue”

Post a Comment