• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python ueCore.AssetUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: listAssets

def listAssets():
    for asset in sorted(ueAssetUtils.getAssetsList(settings["spec"])):
        settings["spec"].asst = asset
        asset = ueAssetUtils.getAsset(settings["spec"])
        printLine = asset["name"]
        if "paths" in settings:
            printLine += " -> %s" % asset["path"]
        print printLine
开发者ID:hdd,项目名称:ue,代码行数:8,代码来源:ueListAssets.py


示例2: printInfo

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,代码行数:51,代码来源:ueInfo.py


示例3: createElement

def createElement(spec, dbMeta={}):
    element = ueAssetUtils.getElement(spec)

    if element:
        return element

    element["created_by"] = getpass.getuser()

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

    ueClient.client.saveElement(spec, element)

    return ueAssetUtils.getElement(spec)
开发者ID:hdd,项目名称:ue,代码行数:14,代码来源:Create.py


示例4: createProject

def createProject(spec, dbMeta={}):
    project = ueAssetUtils.getProject(spec)

    if project:
        return project

    project["name"] = spec.proj
    project["created_by"] = getpass.getuser()

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

    ueClient.client.saveProject(spec, project)

    return ueAssetUtils.getProject(spec)
开发者ID:hdd,项目名称:ue,代码行数:15,代码来源:Create.py


示例5: createAsset

def createAsset(spec, asstType="default", dbMeta={}):
    asset = ueAssetUtils.getAsset(spec)

    if asset:
        return asset

    asset["name"] = spec.asst
    asset["asset_type"] = asstType
    asset["created_by"] = getpass.getuser()

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

    ueClient.client.saveAsset(spec, asset)

    return ueAssetUtils.getAsset(spec)
开发者ID:hdd,项目名称:ue,代码行数:16,代码来源:Create.py


示例6: createGroup

def createGroup(spec, grpType="default", dbMeta={}):
    group = ueAssetUtils.getGroup(spec)

    if group:
        return group

    group["name"] = spec.grp
    group["group_type"] = grpType
    group["created_by"] = getpass.getuser()

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

    ueClient.client.saveGroup(spec, group)

    return ueAssetUtils.getGroup(spec)
开发者ID:hdd,项目名称:ue,代码行数:16,代码来源:Create.py


示例7: ueNewScriptSetup

def ueNewScriptSetup():
    context = ueSpec.Context()
    spec = context.spec

    asset = ueAssetUtils.getAsset(spec)

    # Set up renderer - default to Mental Ray
    loadPlugin("Mayatomr.so")
    maya.cmds.setAttr("defaultRenderGlobals.currentRenderer", "mentalRay", type="string")

    # Set up the timeline
    maya.cmds.playbackOptions(animationStartTime=float(asset["startFrame"]),
                              animationEndTime=float(asset["endFrame"]),
                              minTime=float(asset["startFrame"]),
                              maxTime=float(asset["endFrame"]))

    x = int(asset["xRes"])+int(asset["xPad"])
    y = int(asset["yRes"])+int(asset["yPad"])

    # Set up renderGlobals
    maya.cmds.setAttr("defaultRenderGlobals.outFormatControl", 0)
    maya.cmds.setAttr("defaultRenderGlobals.animation", 1)
    maya.cmds.setAttr("defaultRenderGlobals.startFrame", float(asset["startFrame"]))
    maya.cmds.setAttr("defaultRenderGlobals.endFrame", float(asset["endFrame"]))
    maya.cmds.setAttr("defaultResolution.pixelAspect", float(asset["aspectRatio"]))
    maya.cmds.setAttr("defaultResolution.deviceAspectRatio", float(x)/float(y))
    maya.cmds.setAttr("defaultResolution.width", x)
    maya.cmds.setAttr("defaultResolution.height", y)

    os.environ["FRAME_RATE"] = asset["frameRate"]
    os.environ["FIRST_FRAME"] = asset["startFrame"]
    os.environ["LAST_FRAME"] = asset["endFrame"]
开发者ID:hdd,项目名称:ue,代码行数:32,代码来源:__init__.py


示例8: getReadGeoPath

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,代码行数:35,代码来源:__init__.py


示例9: getUeConstant

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,代码行数:30,代码来源:__init__.py


示例10: loadElements

 def loadElements(self):
     global asst
     asst = str(self.asstMenu.currentText())
     spec = ueSpec.Spec(proj, grp, asst)
     self.elements = ueAssetUtils.getElements(spec)
     #        self.eltypeList.clear()
     self.loadTypes()
开发者ID:theomission,项目名称:ue,代码行数:7,代码来源:Open.py


示例11: updateVersInfo

    def updateVersInfo(self):
        try:
            ver = self.versions[int(vers) - 1]
            spec = ueSpec.Spec(proj, grp, asst, elclass, eltype, elname, vers, elpass)

            self.verCreatedBy.setText(ver["created_by"])
            self.verCreatedAt.setText(ueCore.formatDatetime(ver["created_at"]))

            files = glob.glob(os.path.join(ver["path"], ver["file_name"] + "*"))
            self.verFilesList.clear()
            for f in sorted(files):
                self.verFilesList.addItem(QtGui.QListWidgetItem(os.path.basename(f)))

            if "comment" in ver:
                self.verComment.setText(ver["comment"])
            else:
                self.verComment.setText("N/A")

            if "thumbnail" in ver:
                spec = ueSpec.Spec(proj, grp, asst, elclass, eltype, elname, vers)
                f = ueAssetUtils.getThumbnailPath(spec)
                img = QtGui.QImage(f)
                imgs = img.scaled(200, 80, aspectRatioMode=QtCore.Qt.KeepAspectRatio)
                self.verThumb.setPixmap(QtGui.QPixmap.fromImage(imgs))
            else:
                img = QtGui.QImage(os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "thumbnail.png"))
                imgs = img.scaled(200, 80, aspectRatioMode=QtCore.Qt.KeepAspectRatio)
                self.verThumb.setPixmap(QtGui.QPixmap.fromImage(imgs))
        except IndexError:
            pass
开发者ID:theomission,项目名称:ue,代码行数:30,代码来源:Open.py


示例12: addFiles

def addFiles():
    if not "files" in config:
        print "ERROR: No files given"
        sys.exit(2)

    if not "spec" in config:
        print "ERROR: Spec not set"
        sys.exit(2)

    e = ueAssetUtils.getElement(config["spec"])
    if e == {}:
        e = ueCreate.createElement(config["spec"])

    v = ueCreate.createVersion(config["spec"])

    config["spec"].vers = v["version"]

    files = glob.glob(config["files"])

    path = v["path"]
    name = v["file_name"]
    ext = files[0].split(".")[-1]

    if len(files) == 1:
        dest = os.path.join(path, "%s.%s" % (name, ext))
        ueFileUtils.copyFile(files[0], dest)
    else:
        for f in sorted(files):
            dest = os.path.join(path, "%s.%04d.%s" % (name, files.index(f)+1, ext))
            ueFileUtils.copyFile(f, dest)
开发者ID:hdd,项目名称:ue,代码行数:30,代码来源:ueAddFiles.py


示例13: loadLayerLists

 def loadLayerLists(self):
     elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))
     self.layerListPickerBox.clear()
     if __layerClass__ in elements:
         if __layerType__ in elements[__layerClass__]:
             for layerList in sorted(elements[__layerClass__][__layerType__]):
                 self.layerListPickerBox.addItem(layerList)
开发者ID:theomission,项目名称:ue,代码行数:7,代码来源:Read.py


示例14: loadElements

 def loadElements(self):
     global asst, elements
     asst = str(self.asstMenu.currentText())
     elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))
     self.animationTab.reload()
     self.backgroundTab.reload()
     self.renderTab.reload()
开发者ID:theomission,项目名称:ue,代码行数:7,代码来源:Read.py


示例15: createVersion

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,代码行数:17,代码来源:Create.py


示例16: loadGroups

 def loadGroups(self):
     global proj
     proj = str(self.projMenu.currentText())
     spec = ueSpec.Spec(proj)
     gl = sorted(ueAssetUtils.getGroupsList(spec))
     self.grpMenu.clear()
     for g in gl:
         self.grpMenu.addItem(g)
     self.loadAssets()
开发者ID:hdd,项目名称:ue,代码行数:9,代码来源:Save.py


示例17: loadElements

 def loadElements(self):
     self.elements = ueAssetUtils.getElements(self.spec)
     if "arc" in self.elements:
         spec = copy.deepcopy(self.spec)
         spec.elclass = "arc"
         for eltype in self.elements["arc"]:
             spec.eltype = eltype
             self.libraryWidgets.append(LibraryWidget(self.elements["arc"][eltype], parent=self))
         self.drawLibraryWidgets()
开发者ID:hdd,项目名称:ue,代码行数:9,代码来源:ArchitectUI.py


示例18: loadAssets

 def loadAssets(self):
     global grp
     grp = str(self.grpMenu.currentText())
     spec = ueSpec.Spec(proj, grp)
     al = sorted(ueAssetUtils.getAssetsList(spec))
     self.asstMenu.clear()
     for a in al:
         self.asstMenu.addItem(a)
     self.loadElements()
开发者ID:hdd,项目名称:ue,代码行数:9,代码来源:Save.py


示例19: loadVersions

 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,代码行数:9,代码来源:Read.py


示例20: loadEdits

 def loadEdits(self):
     elements = ueAssetUtils.getElements(self.spec)
     self.editMenu.clear()
     if self.spec.elclass in elements:
         if self.spec.eltype in elements[self.spec.elclass]:
             for name in elements[self.spec.elclass][self.spec.eltype]:
                 self.editMenu.addItem(name)
             self.spec.elname = str(self.editMenu.currentText())
             self.loadEditVersions()
开发者ID:hdd,项目名称:ue,代码行数:9,代码来源:EditUI.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python uf.buildtree函数代码示例发布时间:2022-05-27
下一篇:
Python logger.debug函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap