May 15, 2011

simple converter gui

I finally had the time to finish the first version of a program, that converts image sequences from one format to another. This is the first program I did with pyqt and designer, and it's still very very beta. The best thing in this is that I think I started to get the grasp of the designer-qt-python code-exe pipeline. If you want to try, you need to have nuke installed, because this program calls nuke for conversion, in command line mode. You have to set a path to a directory that contains the sequences to convert. It processes the sequences, but not the subdirectories recursively, it will be in the next release :) And you have to set the path to nuke and to the "glt_batchconvertFromCmdline2.py" file in the gui. As usual I can't guarantee anything. You can download it from here

3 comments:

  1. Hi

    I'm so glad i found this post as we are trying to figure out how to accomplish this as a python script to convert all renders from Maya's Mentelray to be Nuke friendly.

    Mentel ray's tiled exrs are very slow in nuke so we need to batch convert all of the exr's to ZIP with autocrop.

    I just tried your tool and it gives me an error:

    Traceback (most recent call last):
    File "e:/convert_gui_1.0/glt_batchconvertFromCmdline2.py", line 175, in
    convert()
    File "e:/convert_gui_1.0/glt_batchconvertFromCmdline2.py", line 61, in convert

    seqstr = nuke.tcl(compr)
    RuntimeError: compressList2: Unknown command
    compressList2: Unknown command

    ReplyDelete
  2. Hi, I put the compresslist2 tcl script in the converter zip file, because nukepedia seems to be down currently. It's a script by Frank Rueter, used in his drop script, this converts images in a sequence to a nuke-format sequence. Needs to be on a path where nuke finds it.
    Unfortunately it is a really old gui and process, we are using much more advanced now, but I don't think I can share that now. But if you have problems with this just tell me, I'll see what I can do.

    ReplyDelete
  3. Thanks!

    After a lot of reading and trying to understand python i came up with this script to automate the process in Nuke:

    def exrWrite () :

    read = nuke.allNodes("Read")


    for g in read:
    myValue = g ["colorspace"].value()
    g ["colorspace"].setValue("linear")
    write = nuke.createNode('Write', inpanel = False)
    write.setInput(0, g)
    write['channels'].setValue("all")
    write['colorspace'].setValue("linear")
    write['file_type'].setValue("exr")
    write['autocrop'].setValue(False)
    write['use_limit'].setValue(True)
    readinvalue = g ["origfirst"].value()
    writeinvalue = write ["first"].value()
    write['first'].setValue(readinvalue)
    readoutvalue = g ["origlast"].value()
    writeoutvalue = write ["last"].value()
    write['last'].setValue(readoutvalue)
    meta = g.metadata("input/bitsperchannel")
    write['datatype'].setValue(meta)
    write['beforeRender'].setValue("createWriteDir")
    write['afterFrameRender'].setValue("print nuke.filename( nuke.thisNode(), nuke.REPLACE )")
    read_path = g["file"].value()
    read_name = read_path.split("/")[-1]
    read_name = read_name.rstrip('.exr')
    read_name = read_name.rstrip('_%0123456789d')
    read_name = read_name.rstrip('_#')
    read_name = read_name.rstrip('.%0123456789d')
    read_name = read_name.rstrip('.#')
    write["file"].setValue("[python {nuke.script_directory()}]/exrScanline" + ('/') + (read_name) + ('/') + (read_name) + ('_%04d.exr'))


    # Add an exrWrite option to the Image menu
    menubar=nuke.menu('Nodes')
    m = menubar.findItem('Image')
    m.addSeparator()
    m.addCommand('exrWrite', 'exrWrite()')

    This does the following:

    - Find all read nodes and set colorspace to linear.
    - Attaches a write node to all of them.
    - Sets the output channels to All
    - Sets colorspace to linear.
    - Changes file type to exr.
    - Sets Autocrop to on.
    - Activates frame range limit.
    - Takes the frame range limitation from the read node.
    - Reads the bits per channel from the read node metadata and sets it as found.
    - Sets the write file path to where the nuke script is and creates a folder.
    - Then take the filename and strips the extension to create a sub-folder.
    - Takes the same filename and adds the proper padding and extension.
    - Finally, create a button for it.

    I'm still in the process of learning how to create that into a gui of some sort in nuke.

    ReplyDelete