本文整理汇总了Python中misc.ExtMap.ExtMap.items方法的典型用法代码示例。如果您正苦于以下问题:Python ExtMap.items方法的具体用法?Python ExtMap.items怎么用?Python ExtMap.items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc.ExtMap.ExtMap
的用法示例。
在下文中一共展示了ExtMap.items方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createResourceStruct
# 需要导入模块: from misc.ExtMap import ExtMap [as 别名]
# 或者: from misc.ExtMap.ExtMap import items [as 别名]
def createResourceStruct(resources, formatAsTree=False, updateOnlyExistingSprites=False):
skippatt = re.compile(r'\.(meta|py)$', re.I)
result = {}
if formatAsTree:
result = ExtMap()
# Filter unwanted files
for res in resources:
if skippatt.search(res.path):
continue
result[res.id] = res
# Update simple images
for combImg in (x for x in result.values() if isinstance(x, CombinedImage)):
for embImg in combImg.embeds:
if embImg.id in result:
result[embImg.id].attachCombinedImage(combImg)
elif not updateOnlyExistingSprites:
embImg.attachCombinedImage(combImg)
result[embImg.id] = embImg
# Flatten out the resource representation
for resid, res in result.items():
result[resid] = res.toResinfo()
# ExtMap returns nested maps
if formatAsTree:
result = result.getData()
return result
示例2: createResourceStruct
# 需要导入模块: from misc.ExtMap import ExtMap [as 别名]
# 或者: from misc.ExtMap.ExtMap import items [as 别名]
def createResourceStruct(resources, formatAsTree=False, updateOnlyExistingSprites=False):
skippatt = re.compile(r'\.(meta|py)$', re.I)
result = {}
if formatAsTree:
result = ExtMap()
# Filter unwanted files
for res in resources:
if skippatt.search(res.path):
continue
result[res.id] = res
# Update simple images
for combImg in (x for x in result.values() if isinstance(x, CombinedImage)):
for embImg in combImg.embeds:
if embImg.id in result:
result[embImg.id].attachCombinedImage(combImg)
elif not updateOnlyExistingSprites:
embImg.attachCombinedImage(combImg)
result[embImg.id] = embImg
# Flatten out the resource representation
for resid, res in result.items():
result[resid] = res.toResinfo()
# Unify font map aliases
if isinstance(res, FontMap):
for glyphname, code in res.mapping.iteritems():
fdsc = "@%s/%s" % (res.alias, glyphname)
if not fdsc in result:
result[fdsc] = [result[resid][1], round(result[resid][2] / code[1]), code[0]]
del result[resid][4]
# ExtMap returns nested maps
if formatAsTree:
result = result.getData()
return result