本文整理汇总了Python中ueCore.AssetUtils.getAsset方法的典型用法代码示例。如果您正苦于以下问题:Python AssetUtils.getAsset方法的具体用法?Python AssetUtils.getAsset怎么用?Python AssetUtils.getAsset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ueCore.AssetUtils
的用法示例。
在下文中一共展示了AssetUtils.getAsset方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ueNewScriptSetup
# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getAsset [as 别名]
def ueNewScriptSetup():
root = nuke.root()
context = ueSpec.Context()
spec = context.spec
asset = ueAssetUtils.getAsset(spec)
formatName = "ueProjectRes"
root.knob("fps").setValue(int(asset["frameRate"]))
root.knob("first_frame").setValue(int(asset["startFrame"]))
root.knob("last_frame").setValue(int(asset["endFrame"]))
x = int(asset["xRes"])+int(asset["xPad"])
y = int(asset["yRes"])+int(asset["yPad"])
nuke.addFormat("%i %i %s" % (x, y, formatName))
# nuke.addFormat("%i %i %i %i %i %i %d %s" % (x, y, int(config["xPad"]), int(config["yPad"]),
# int(config["xRes"]), int(config["yRes"]),
# float(config["aspectRatio"]), formatName))
root.knob("format").setValue(formatName)
os.environ["FRAME_RATE"] = asset["frameRate"]
os.environ["FIRST_FRAME"] = asset["startFrame"]
os.environ["LAST_FRAME"] = asset["endFrame"]
示例2: createAsset
# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getAsset [as 别名]
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)
示例3: listAssets
# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getAsset [as 别名]
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
示例4: printInfo
# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getAsset [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 ""
示例5: createScript
# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getAsset [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)
示例6: changeAsset
# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getAsset [as 别名]
def changeAsset():
spec = ueSpec.Spec(sys.argv[-1])
if not spec.proj in ueAssetUtils.getProjectsList():
print "ERROR: Project does not exist"
sys.exit(2)
if not spec.grp in ueAssetUtils.getGroupsList(spec):
print "ERROR: Group does not exist"
sys.exit(2)
if not spec.asst in ueAssetUtils.getAssetsList(spec):
print "ERROR: Asset does not exist"
sys.exit(2)
project = ueAssetUtils.getProject(spec)
asset = ueAssetUtils.getAsset(spec)
print "export PROJ=%s; " % spec.proj
print "export GRP=%s; " % spec.grp
print "export ASST=%s; " % spec.asst
print "export PROJ_ROOT=%s; " % project["path"]
print "export ASST_ROOT=%s" % asset["path"]
示例7: printTree
# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getAsset [as 别名]
def printTree():
if "spec" not in info:
print "ERROR: Spec not set"
sys.exit(2)
spec = ueSpec.Spec(info["spec"])
print "Asset tree on asset:"
print spec
print "|"
groups = ueAssetUtils.getGroupsList(spec)
lastGroup = "|"
for g, group in enumerate(sorted(groups)):
spec.grp = group
group = ueAssetUtils.getGroup(spec)
if g == len(groups) - 1:
lastGroup = " "
groupSpaceCount = 34
printLine = "+-+-> %s" % group["name"]
printLine += (groupSpaceCount - len(printLine)) * " "
if info["time"]:
printLine += "%s - %s" % (str(group["startFrame"]), str(group["endFrame"]))
groupSpaceCount += 10
printLine += (groupSpaceCount - len(printLine)) * " "
if info["path"]:
printLine += group["path"]
groupSpaceCount += 30
printLine += (groupSpaceCount - len(printLine)) * " "
if info["date"]:
printLine += "%s, %s" % (
ueCore.formatDatetime(group["created_at"]),
ueCore.formatDatetime(group["updated_at"]),
)
groupSpaceCount += 38
printLine += (groupSpaceCount - len(printLine)) * " "
if info["user"]:
printLine += group["created_by"]
print printLine
assets = ueAssetUtils.getAssetsList(spec)
for asset in sorted(assets):
spec.asst = asset
asset = ueAssetUtils.getAsset(spec)
assetSpaceCount = 34
printLine = "%s +---> %s" % (lastGroup, asset["name"])
printLine += (assetSpaceCount - len(printLine)) * " "
if info["time"]:
printLine += "%s - %s" % (str(asset["startFrame"]), str(asset["endFrame"]))
assetSpaceCount += 10
printLine += (assetSpaceCount - len(printLine)) * " "
if info["path"]:
printLine += group["path"]
assetSpaceCount += 30
printLine += (assetSpaceCount - len(printLine)) * " "
if info["date"]:
printLine += "%s, %s" % (
ueCore.formatDatetime(asset["created_at"]),
ueCore.formatDatetime(asset["updated_at"]),
)
assetSpaceCount += 38
printLine += (assetSpaceCount - len(printLine)) * " "
if info["user"]:
printLine += asset["created_by"]
print printLine
print ""
示例8: updateAsset
# 需要导入模块: from ueCore import AssetUtils [as 别名]
# 或者: from ueCore.AssetUtils import getAsset [as 别名]
def updateAsset(spec, asstType="default", dbMeta={}):
ueClient.client.updateAsset(spec, dbMeta)
return ueAssetUtils.getAsset(spec)