当前位置: 首页>>代码示例>>Python>>正文


Python AssetUtils.getVersions方法代码示例

本文整理汇总了Python中ueCore.AssetUtils.getVersions方法的典型用法代码示例。如果您正苦于以下问题:Python AssetUtils.getVersions方法的具体用法?Python AssetUtils.getVersions怎么用?Python AssetUtils.getVersions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ueCore.AssetUtils的用法示例。


在下文中一共展示了AssetUtils.getVersions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getUeConstant

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
def getUeConstant():
    n = nuke.thisNode()

    spec = 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(),
                       n.knob("vers").value())

    if not spec.proj == "" and not spec.grp == "" and \
       not spec.asst == "" and not spec.elclass == "" and \
       not spec.eltype == "" and not spec.elname == "" and \
       not spec.vers == "":
        versions = ueAssetUtils.getVersions(spec)
        if int(spec.vers) > len(versions):
            return
        v = versions[int(spec.vers)-1]
        if v:
            layerFile = os.path.join(v["path"], "%s.col" % v["file_path"])
            if os.path.exists(layerFile):
                f = open(layerFile)
                palette = json.loads(layerfile.read())
                f.close()
                if spec.elname in palette:
                    colour.knob("color").setValue(palette[spec.elname][0], 0)
                    colour.knob("color").setValue(palette[spec.elname][1], 1)
                    colour.knob("color").setValue(palette[spec.elname][2], 2)
                    colour.knob("color").setValue(1.0, 3)
开发者ID:hdd,项目名称:ue,代码行数:32,代码来源:__init__.py

示例2: getReadGeoPath

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
def getReadGeoPath():
    n = nuke.thisNode()

    spec = 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(),
                       n.knob("vers").value())

    p = os.path.join(os.getenv("UE_PATH"), "lib",
                     "placeholders", "nuke.obj")

    if not spec.proj == "" and not spec.grp == "" and \
       not spec.asst == "" and not spec.elclass == "" and \
       not spec.eltype == "" and not spec.elname == "" and \
       not spec.vers == "":
        versions = ueAssetUtils.getVersions(spec)
        if int(spec.vers) > len(versions):
            return p
        v = versions[int(spec.vers)-1]
        if v:
            files = glob.glob(os.path.join(v["path"], v["file_name"]+"*.obj"))
            if len(files) < 1:
                return p
            ext = files[0].split(".")[-1]
            if len(files) == 1:
                p = os.path.join(v["path"], v["file_name"]+"."+ext)
            else:
                p = os.path.join(v["path"], v["file_name"]+".%04d."+ext)
#                p = os.path.join(v["path"], elpassDir,
#                                 v["file_name"]+elpassFile+".%04d."+ext)

    return p
开发者ID:hdd,项目名称:ue,代码行数:37,代码来源:__init__.py

示例3: createVersion

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
def createVersion(spec, dbMeta={}, layer=None):
    version = {}

    spec.vers = len(ueAssetUtils.getVersions(spec))+1

    version["version"] = spec.vers
    version["created_by"] = getpass.getuser()

    for m in dbMeta:
        version[m] = dbMeta[m]

    if not layer == None:
        p = os.path.join(version["path"])

    ueClient.client.saveVersion(spec, version)

    return ueAssetUtils.getVersions(spec)[spec.vers-1]
开发者ID:hdd,项目名称:ue,代码行数:19,代码来源:Create.py

示例4: loadVersions

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
 def loadVersions(self):
     self.elname = str(self.backgroundList.currentItem().text())
     self.versList.clear()
     spec = ueSpec.Spec(proj, grp, asst, __bgClass__, __bgType__, self.elname)
     vers = ueAssetUtils.getVersions(spec)
     for v in sorted(range(len(vers)), reverse=True):
         item = QtGui.QListWidgetItem("%04d" % int(v + 1))
         self.versList.addItem(item)
     self.versList.setCurrentItem(self.versList.item(0))
开发者ID:theomission,项目名称:ue,代码行数:11,代码来源:Read.py

示例5: load

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
    def load(self):
        nodes = []
        for sequence in self.parent.edit["sequences"]:
            for shot in self.parent.edit[sequence]["shots"]:
                editShot = self.parent.edit[sequence][shot]
                storyboard = []
                animatic = []

                spec = ueSpec.Spec(os.getenv("PROJ"), sequence, shot, "sb", "storyboard", "master")

                storyboard = ueAssetUtils.getVersions(spec)

                if storyboard:
                    path = os.path.join(storyboard[-1]["path"], storyboard[-1]["file_name"]+".jpg")
                    spec.eltype = "animatic"
                    spec.elclass = "an"
                    animatic = ueAssetUtils.getVersions(spec)
                    if animatic:
                        path = os.path.join(animatic[-1]["path"], animatic[-1]["file_name"]+".####.jpeg")
                elif shot == "black":
                    path = os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "black.png")
                elif shot == "white":
                    path = os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "white.png")
                else:
                    path = os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "nuke.png")

                commands.addSource(path, None)

                sourceNode = commands.nodesOfType("RVSourceGroup")[-1]

                if storyboard and not animatic:
                    retimeNode = commands.newNode("RVRetimeGroup", "%s_%sRetime" % (sequence, shot))
                    commands.setNodeInputs(retimeNode, [sourceNode])
                    time = float(editShot["endFrame"])-float(editShot["startFrame"])+1
                    commands.setFloatProperty("%s_retime.visual.scale" % retimeNode, [float(time)], False)
                    node = retimeNode
                else:
                    node = sourceNode

                nodes.append(node)

        commands.setNodeInputs("defaultSequence", nodes)
        commands.setViewNode("defaultSequence")
开发者ID:hdd,项目名称:ue,代码行数:45,代码来源:EditUI.py

示例6: createScript

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
    def createScript(self):
        job = {}

        if self.run == "nuke":
            ext = "nk"

        proj = ueAssetUtils.getProject(self.destSpec)
        asst = ueAssetUtils.getAsset(self.destSpec)

        versions = ueAssetUtils.getVersions(self.sourceSpec)
        version = versions[len(versions)-1]

        p = os.path.join(version["path"], version["file_name"]+"."+ext)

        for f in range(self.frame_start, self.frame_end+1):
            frame = {}
            if self.run == "nuke":
                frame["cmd"] = "nuke -x -V -f -X %s -F %i-%i %s" % (",".join(self.options["writeNode"]),
                                                                    f, f, p)
            frame["proj"] = self.destSpec.proj
            frame["grp"] = self.destSpec.grp
            frame["asst"] = self.destSpec.asst
            frame["proj_root"] = proj["path"]
            frame["asst_root"] = asst["path"]
            job[f] = frame

        versions = ueAssetUtils.getVersions(self.destSpec)
        version = versions[len(versions)-1]

        p = os.path.join(asst["path"], "tmp", "drQueue", version["file_name"]+"."+str(int(time.time()))+".dq")

        if not os.path.exists(os.path.dirname(p)):
            import ueCore.FileUtils as ueFileUtils
            ueFileUtils.createDir(os.path.dirname(p))

        try:
            f = open(p, "w")
            f.write(json.dumps(job, sort_keys=True, indent=4))
            f.close()
        except IOError, e:
            print "ERROR: Creating job script '%s' (%s)" % (p, e)
            sys.exit(2)
开发者ID:hdd,项目名称:ue,代码行数:44,代码来源:Job.py

示例7: getLayers

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
 def getLayers(self):
     layer = str(self.layerListPickerBox.currentText())
     element = ueAssetUtils.getVersions(ueSpec.Spec(proj, grp, asst, __layerClass__, __layerType__, layer))
     fileName = os.path.join(element[-1]["path"], "%s.lay" % element[-1]["file_name"])
     if os.path.exists(fileName):
         f = open(fileName)
         layers = json.loads(f.read())
         f.close()
     else:
         layers = {}
     return layers
开发者ID:theomission,项目名称:ue,代码行数:13,代码来源:Read.py

示例8: ueOpen

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
def ueOpen():
    p = nukescripts.registerWidgetAsPanel("ueCommonOpen.Open", "ueOpen",
                                          "ue.panel.ueOpen", create=True)
    p.setMinimumSize(600, 940)
    ueCommonOpen.setClasses(__ueclasses__)

    if p.showModalDialog():
        spec = ueCommonOpen.getValues()
        version = ueAssetUtils.getVersions(spec)[spec.vers-1]
        nuke.scriptOpen(os.path.join(version["path"], version["file_name"]+".nk"))
        nuke.tprint("Opened %s" % spec)

    nukescripts.unregisterPanel("ue.panel.ueOpen", lambda: "return")
开发者ID:hdd,项目名称:ue,代码行数:15,代码来源:Open.py

示例9: getReadPath

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
def getReadPath():
    n = nuke.thisNode()

    elpass = n.knob("elpass").value()
    if elpass == "":
        elpass = None

    spec = 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(),
                       n.knob("vers").value(),
                       elpass)

    p = os.path.join(os.getenv("UE_PATH"), "lib",
                     "placeholders", "nuke.png")

    if not spec.proj == "" and not spec.grp == "" and \
       not spec.asst == "" and not spec.elclass == "" and \
       not spec.eltype == "" and not spec.elname == "" and \
       not spec.vers == "":
        versions = ueAssetUtils.getVersions(spec)
        if int(spec.vers) > len(versions):
            return p
        v = versions[int(spec.vers)-1]
        if v:
            elpassDir = ""
            elpassFile = ""
            if not spec.elpass == None:
                elpassDir = spec.elpass
                elpassFile = "_"+spec.elpass
            files = glob.glob(os.path.join(v["path"], elpassDir,
                                           v["file_name"]+elpassFile+"*"))
            if len(files) > 0:
                ext = files[0].split(".")[-1]

                if len(files) == 1:
                    p = os.path.join(v["path"], elpassDir,
                                     v["file_name"]+elpassFile+"."+ext)
                else:
                    p = os.path.join(v["path"], elpassDir,
                                     v["file_name"]+elpassFile+".%04d."+ext)

                nuke.thisNode().knob("first").setValue(1)
                nuke.thisNode().knob("last").setValue(len(files))
                nuke.thisNode().knob("origfirst").setValue(1)
                nuke.thisNode().knob("origlast").setValue(len(files))

    return p
开发者ID:hdd,项目名称:ue,代码行数:53,代码来源:__init__.py

示例10: printInfo

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
def printInfo():
    if "spec" not in info:
        print "ERROR: Spec not set"
        sys.exit(2)

    spec = ueSpec.Spec(info["spec"])

    if spec.grp == None:
        # Project info
        assetType = "project"
        assetInfo = ueAssetUtils.getProject(spec)
    elif spec.asst == None:
        # Group info
        assetType = "group"
        assetInfo = ueAssetUtils.getGroup(spec)
    elif spec.elclass == None and \
         spec.eltype == None and \
         spec.elname == None:
        # Asset info
        assetType = "asset"
        assetInfo = ueAssetUtils.getAsset(spec)
    elif spec.vers == None:
        # Element info
        assetType = "element"
        assetInfo = ueAssetUtils.getElement(spec)
        assetInfo = assetInfo[spec.elclass][spec.eltype][spec.elname]
    elif spec.elpass == None:
        # Version info
        assetType = "version"
        assetInfo = ueAssetUtils.getVersions(spec)[int(spec.vers)-1]
    else:
        print "ERROR: Could not identify spec as a valid element"
        sys.exit(2)

    print "Information on %s:\n%s\n" % (assetType, str(info["spec"]))

    for a in sorted(assetInfo):
        # Get a padding value so the key/value columns will be neatly aligned
        spacePadding = 28-len(a)

        # Parse the version and datetime info correctly
        if a == "versions":
            assetInfo[a] = len(assetInfo[a])
        elif a in ["created_at", "updated_at"]:
            assetInfo[a] = ueCore.formatDatetime(str(assetInfo[a]))

        # Get rid of the keys with _id because they're database stuff
        if not re.match(".*_id$", a):
            print "%s:%s%s" % (a, " "*spacePadding, str(assetInfo[a]))

    print ""
开发者ID:hdd,项目名称:ue,代码行数:53,代码来源:ueInfo.py

示例11: main

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
def main():
    spec = ueSpec.Spec(options["spec"])

    edit = ueEdit.getEdit(spec)

    if options["assets"]:
        if options["print"]:
            for sequence in edit["sequences"]:
                print "-> %s" % sequence
                for shot in edit[sequence]["shots"]:
                    print "---> %s" % shot
        elif options["create"]:
            # Get the group and check agains the data in the edit file to see if anything has changed
            spec = ueSpec.Spec(proj=os.getenv("PROJ"))
            for sequence in edit["sequences"]:
                print "-> Creating sequence %s ..." % sequence
                spec.grp = sequence
                ueCreate.createGroup(spec, "default")
                for shot in edit[sequence]["shots"]:
                    if shot not in excludedShotNames:
                        print "---> Creating shot %s ..." % shot
                        spec.asst = shot
                        ueCreate.createAsset(spec, "default", dbMeta=edit[sequence][shot])
    elif options["play"]:
        shots = []
        for sequence in edit:
            spec.grp = sequence
            for shot in edit[sequence]:
                spec.asst = shot
                spec.eltype = "storyboard"
                spec.elname = "master"
                spec.elclass = "sb"

                versions = ueAssetUtils.getVersions(spec)

                if len(versions) == 0:
                    print "Nothing"
                    shots.append(os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "edit.1-24.png"))
                else:
                    print "Something"
                    shots.append(os.path.join(versions[-1]["path"], "edit.1-24.png"))

        arguments = ""
        for path in shots:
            arguments += " %s" % (path)

        print arguments

        os.system("rv %s" % arguments)
开发者ID:hdd,项目名称:ue,代码行数:51,代码来源:ueEditTool.py

示例12: loadVers

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
 def loadVers(self):
     global elname, vers
     elname = str(self.elnameList.currentItem().text())
     spec = ueSpec.Spec(proj, grp, asst, elclass, eltype, elname)
     self.versions = ueAssetUtils.getVersions(spec)
     self.versList.clear()
     if len(self.versions) > 0:
         for v in sorted(range(len(self.versions)), reverse=True):
             self.versList.addItem(QtGui.QListWidgetItem("%04d" % int(v + 1)))
         self.versList.setCurrentItem(self.versList.item(0))
         vers = str(self.versList.currentItem().text())
     else:
         vers = None
     self.loadPasses()
     self.updateElInfo()
开发者ID:theomission,项目名称:ue,代码行数:17,代码来源:Open.py

示例13: getPalette

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
    def getPalette(self):
        character = str(self.characterPickerBox.currentText())

        spec = ueSpec.Spec(proj, __colGroup__, character, __colClass__, __colType__, __colName__)
        versions = ueAssetUtils.getVersions(spec)
        spec.vers = versions[-1]["version"]

        fileName = os.path.join(versions[-1]["path"], "%s.col" % versions[-1]["file_name"])
        if os.path.exists(fileName):
            f = open(fileName)
            palette = json.loads(f.read())
            f.close()
        else:
            palette = {}

        return palette, spec
开发者ID:theomission,项目名称:ue,代码行数:18,代码来源:Read.py

示例14: createRef

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
 def createRef(self):
     spec = ueCommonOpen.getValues()
     version = ueAssetUtils.getVersions(spec)[int(spec.vers)-1]
     if spec.elclass == "geo":
         ext = "obj"
     elif spec.elclass == "cam":
         ext = "fbx"
     elif spec.elclass == "lgt":
         ext = "fbx"
     else:
         ext = "ma"
     maya.cmds.file(os.path.join(version["path"], version["file_name"]+"."+ext),
                    namespace=version["file_name"], r=True)
     if self.redrawRefList:
         refEditor.drawRefList()
     self.close()
开发者ID:hdd,项目名称:ue,代码行数:18,代码来源:ReferenceEditor.py

示例15: nukeImportLayer

# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getVersions [as 别名]
    def nukeImportLayer(self):
        palette, paletteSpec = self.getPalette()

        if not palette:
            return

        layers = self.getLayers()

        if not layers:
            return

        n = []
        x = None
        y = None
        for elpass in reversed(layers):
            spec = ueSpec.Spec(proj, grp, asst, __anClass__, self.eltype, elpass)
            versions = ueAssetUtils.getVersions(spec)
            node = self.nukeImportPass(
                name=elpass.strip(), version=len(versions), x=x, y=y, palette=palette, paletteSpec=paletteSpec
            )
            x = node.xpos() + 200
            y = node.ypos()
            n.append(node)

        for i, nn in enumerate(n):
            if i == 0:
                # Create a dot node
                dot = nuke.nodes.Dot(xpos=nn.xpos(), ypos=nn.ypos())
                dot.setInput(0, nn)
                nn = dot
            if i < len(n) - 1:
                # Create the merge
                m = nuke.nodes.Merge(inputs=[nn, n[i + 1]])
                n[i + 1] = m
            if i == 0:
                y = m.ypos() + 20
            m.setXpos(m.xpos())
            m.setYpos(y)
开发者ID:theomission,项目名称:ue,代码行数:40,代码来源:Read.py


注:本文中的ueCore.AssetUtils.getVersions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。