コード例 #1
0
ファイル: Save.py プロジェクト: hdd/ue
def ueSaveVers():
    root = nuke.root()

    if root.name() == "Root":
        ueSaveAs()
        return

#    if not ueNuke.ueScriptSanityCheck():
#        return

    spec = ueSpec.Spec(root.knob("ueproj").value(),
                       root.knob("uegrp").value(),
                       root.knob("ueasst").value(),
                       root.knob("ueclass").value(),
                       root.knob("uetype").value(),
                       root.knob("uename").value())

    ueNukeUtils.saveUtility(spec)
コード例 #2
0
ファイル: Save.py プロジェクト: hdd/ue
def ueSaveAs():
#    if not ueNuke.ueScriptSanityCheck():
#        return

    app = QtGui.QApplication.allWidgets()
    i = 0
    for widget in app:
        if str(type(widget)) == "<class 'PyQt4.QtGui.QStackedWidget'>":
            name = "ueSaveThumbs_%04d.png" % i
            QtGui.QPixmap.grabWindow(widget.winId()).save(os.path.join(os.getenv("ASST_ROOT"), "tmp", name), "png")
            i += 1

    p = nukescripts.registerWidgetAsPanel("ueCommonSave.Save", "ueSave",
                                          "ue.panel.ueSave", create=True)
    p.setMinimumSize(400, 600)
    ueCommonSave.setClasses(__ueclasses__)

    if p.showModalDialog():
        spec, dbMeta = ueCommonSave.getValues()
        ueNukeUtils.saveUtility(spec, dbMeta=dbMeta)

    ueFileUtils.deleteFiles(os.path.join(os.path.join(os.getenv("ASST_ROOT"), "tmp", "ueSaveThumbs_*.png")))
    nukescripts.unregisterPanel("ue.panel.ueSave", lambda: "return")
コード例 #3
0
def runRender(renderOpts):
    root = nuke.root()

    if root.name() == "Root":
        ueNukeSave.ueSaveAs()

    sourceSpec = ueSpec.Spec(
        root.knob("ueproj").value(),
        root.knob("uegrp").value(),
        root.knob("ueasst").value(),
        root.knob("ueclass").value(),
        root.knob("uetype").value(),
        root.knob("uename").value(),
        root.knob("uevers").value())

    writeNodes = []
    frameRanges = []
    for i, writeNode in enumerate(renderOpts[1]):
        n = nuke.toNode(writeNode)

        destSpec = ueSpec.Spec(
            n.knob("proj").value(),
            n.knob("grp").value(),
            n.knob("asst").value(),
            n.knob("elclass").value(),
            n.knob("eltype").value(),
            n.knob("elname").value())

        # Create the element(s)/version(s) to render into
        dbMeta = {}

        e = ueAssetUtils.getElement(destSpec)
        if e == {}:
            e = ueCreate.createElement(destSpec, dbMeta=dbMeta)

        # If we're rendering into the last existing version, delete it
        if not renderOpts[2]["newVersion"]:
            versions = ueAssetUtils.getVersions(destSpec)
            destSpec.vers = len(versions)
            ueDestroy.destroyVersion(destSpec)

        if renderOpts[2]["clearLastVersion"]:
            nuke.tprint("deleting files")

        # Create a new version
        dbMeta["comment"] = "Render from %s" % str(sourceSpec)
        v = ueCreate.createVersion(destSpec, dbMeta=dbMeta)

        destSpec.vers = v["version"]

        path = v["path"]
        name = v["file_name"]

        # Set up the write nodes with the correct paths
        p = os.path.join(path, name + ".%04d." + n.knob("file_type").value())
        n.knob("file").setValue(p)

        # Get the frame range from the ueWrite gizmo, else default to
        # the scripts asset settings
        first = nuke.root().knob("first_frame").value()
        last = nuke.root().knob("last_frame").value()
        if n.knob("use_limit").value():
            first = n.knob("first").value()
            last = n.knob("last").value()

        writeNodes.append(n)
        if i == 0:
            frameRanges.append((int(first), int(last), 1))
        else:
            frameRanges.append((int(first), int(first), 1))

    dbMeta = {}
    dbMeta["comment"] = "Auto-save of render %s" % str(destSpec)

    ueNukeUtils.saveUtility(sourceSpec, dbMeta=dbMeta)
    ueNukeUtils.saveUtility(sourceSpec)

    # Render
    # 0 = Standard nuke "interactive" render
    # 1 = DrQueue render farm (os.system is a little weird, but it's
    #     so you don't have to compile it's python module for nuke)
    # 2 = Cloud render farm, maybe sometime in the future
    if renderOpts[0] == 0:
        nuke.tprint("Rendering %s ..." % str(destSpec))
        # execute() takes a string for the node name, executeMultiple() takes a tuple of node objects
        if len(writeNodes) == 1:
            nuke.execute(writeNodes[0].name(), frameRanges[0][0],
                         frameRanges[0][1], frameRanges[0][2])
        else:
            nuke.executeMultiple(tuple(writeNodes), tuple(frameRanges))
    elif renderOpts[0] == 1:
        nuke.tprint("Spooling %s ..." % str(destSpec))
        sourceSpec.vers = sourceSpec.vers - 1
        options = {}
        options["writeNode"] = []
        for render in renderOpts[1]:
            n = nuke.toNode(render)
            options["writeNode"].append(n.name())
        p = os.path.join(os.getenv("UE_PATH"), "src", "ueRender", "Spool.py")
        os.system("python %s %s %s nuke %i %i '%s'" %
                  (p, str(sourceSpec), str(destSpec), int(first), int(last),
                   json.dumps(options)))
    elif renderOpts[0] == 2:
        nuke.tprint("Spooling to cloud currently not avaliable")
コード例 #4
0
ファイル: publishCels.py プロジェクト: hdd/ue
        write.setInput(0, reformat2)

        # Set up the write nodes write asset
        write.knob("proj").setValue(spec.proj)
        write.knob("grp").setValue(spec.grp)
        write.knob("asst").setValue(spec.asst)
        write.knob("elclass").setValue(elclass)
        write.knob("eltype").setValue(eltype)
        write.knob("elname").setValue(elname)

        # Set up the write node compression
        # To save disk space, only write out the full rgba for line layers
        # The stuff coming out of TVP is greyscale anyway, so the colour channels
        # should be identical anyway
        write.knob("file_type").setValue("exr")
        write.knob("datatype").setValue("16 bit half")
        write.knob("compression").setValue("PIZ Wavelet (32 scanlines")
        if re.match(".*Line$", elname, flags=re.IGNORECASE):
            write.knob("channels").setValue("rgba")
        else:
            write.knob("channels").setValue("a")

        writeNodes.append(write.name())

# Save the script
ueNukeUtils.saveUtility(spec)

# Render
ueNukeRender.runRender([0, writeNodes, {"newVersion": True, "clearLastVersion": False}])

コード例 #5
0
ファイル: publishCels.py プロジェクト: theomission/ue
        write.knob("proj").setValue(spec.proj)
        write.knob("grp").setValue(spec.grp)
        write.knob("asst").setValue(spec.asst)
        write.knob("elclass").setValue(elclass)
        write.knob("eltype").setValue(eltype)
        write.knob("elname").setValue(elname)

        # Set up the write node compression
        # To save disk space, only write out the full rgba for line layers
        # The stuff coming out of TVP is greyscale anyway, so the colour channels
        # should be identical anyway
        write.knob("file_type").setValue("exr")
        write.knob("datatype").setValue("16 bit half")
        write.knob("compression").setValue("PIZ Wavelet (32 scanlines")
        if re.match(".*Line$", elname, flags=re.IGNORECASE):
            write.knob("channels").setValue("rgba")
        else:
            write.knob("channels").setValue("a")

        writeNodes.append(write.name())

# Save the script
ueNukeUtils.saveUtility(spec)

# Render
ueNukeRender.runRender(
    [0, writeNodes, {
        "newVersion": True,
        "clearLastVersion": False
    }])
コード例 #6
0
ファイル: Render.py プロジェクト: hdd/ue
def runRender(renderOpts):
    root = nuke.root()

    if root.name() == "Root":
        ueNukeSave.ueSaveAs()

    sourceSpec = ueSpec.Spec(root.knob("ueproj").value(),
                             root.knob("uegrp").value(),
                             root.knob("ueasst").value(),
                             root.knob("ueclass").value(),
                             root.knob("uetype").value(),
                             root.knob("uename").value(),
                             root.knob("uevers").value())

    writeNodes = []
    frameRanges = []
    for i, writeNode in enumerate(renderOpts[1]):
        n = nuke.toNode(writeNode)

        destSpec = ueSpec.Spec(n.knob("proj").value(),
                               n.knob("grp").value(),
                               n.knob("asst").value(),
                               n.knob("elclass").value(),
                               n.knob("eltype").value(),
                               n.knob("elname").value())

        # Create the element(s)/version(s) to render into
        dbMeta = {}

        e = ueAssetUtils.getElement(destSpec)
        if e == {}:
            e = ueCreate.createElement(destSpec, dbMeta=dbMeta)

        # If we're rendering into the last existing version, delete it
        if not renderOpts[2]["newVersion"]:
            versions = ueAssetUtils.getVersions(destSpec)
            destSpec.vers = len(versions)
            ueDestroy.destroyVersion(destSpec)

        if renderOpts[2]["clearLastVersion"]:
            nuke.tprint("deleting files")

        # Create a new version
        dbMeta["comment"] = "Render from %s" % str(sourceSpec)
        v = ueCreate.createVersion(destSpec, dbMeta=dbMeta)

        destSpec.vers = v["version"]

        path = v["path"]
        name = v["file_name"]

        # Set up the write nodes with the correct paths
        p = os.path.join(path, name+".%04d."+n.knob("file_type").value())
        n.knob("file").setValue(p)

        # Get the frame range from the ueWrite gizmo, else default to
        # the scripts asset settings
        first = nuke.root().knob("first_frame").value()
        last = nuke.root().knob("last_frame").value()
        if n.knob("use_limit").value():
            first = n.knob("first").value()
            last = n.knob("last").value()

        writeNodes.append(n)
        if i == 0:
            frameRanges.append((int(first), int(last), 1))
        else:
            frameRanges.append((int(first), int(first), 1))

    dbMeta = {}
    dbMeta["comment"] = "Auto-save of render %s" % str(destSpec)

    ueNukeUtils.saveUtility(sourceSpec, dbMeta=dbMeta)
    ueNukeUtils.saveUtility(sourceSpec)

    # Render
    # 0 = Standard nuke "interactive" render
    # 1 = DrQueue render farm (os.system is a little weird, but it's
    #     so you don't have to compile it's python module for nuke)
    # 2 = Cloud render farm, maybe sometime in the future
    if renderOpts[0] == 0:
        nuke.tprint("Rendering %s ..." % str(destSpec))
        # execute() takes a string for the node name, executeMultiple() takes a tuple of node objects
        if len(writeNodes) == 1:
            nuke.execute(writeNodes[0].name(), frameRanges[0][0], frameRanges[0][1], frameRanges[0][2])
        else:
            nuke.executeMultiple(tuple(writeNodes), tuple(frameRanges))
    elif renderOpts[0] == 1:
        nuke.tprint("Spooling %s ..." % str(destSpec))
        sourceSpec.vers = sourceSpec.vers-1
        options = {}
        options["writeNode"] = []
        for render in renderOpts[1]:
            n = nuke.toNode(render)
            options["writeNode"].append(n.name())
        p = os.path.join(os.getenv("UE_PATH"), "src", "ueRender", "Spool.py")
        os.system("python %s %s %s nuke %i %i '%s'" % (p, str(sourceSpec), str(destSpec),
                                                       int(first), int(last),
                                                       json.dumps(options)))
    elif renderOpts[0] == 2:
        nuke.tprint("Spooling to cloud currently not avaliable")