新增检测工具
parent
7b6a78d6df
commit
1dd592cb96
|
|
@ -39,9 +39,17 @@ def parse_psd(path):
|
||||||
sbad_stages = {}
|
sbad_stages = {}
|
||||||
auto_stages = {}
|
auto_stages = {}
|
||||||
|
|
||||||
|
patch_names = []
|
||||||
|
bad_names = []
|
||||||
|
|
||||||
|
spatch_parent_name = []
|
||||||
|
sbad_parent_name = []
|
||||||
|
|
||||||
#patch的末尾数字
|
#patch的末尾数字
|
||||||
patch_end = []
|
patch_end = []
|
||||||
|
spatch_end = []
|
||||||
bad_end = []
|
bad_end = []
|
||||||
|
sbad_end = []
|
||||||
line_end = []
|
line_end = []
|
||||||
|
|
||||||
max_width = 0
|
max_width = 0
|
||||||
|
|
@ -101,28 +109,61 @@ def parse_psd(path):
|
||||||
|
|
||||||
patch_stages[nArr[1]].append(nArr[2])
|
patch_stages[nArr[1]].append(nArr[2])
|
||||||
|
|
||||||
|
if item.name not in patch_names:
|
||||||
|
patch_names.append(item.name)
|
||||||
|
|
||||||
patch_end.append(item.name.replace("patch", ""))
|
patch_end.append(item.name.replace("patch", ""))
|
||||||
elif nArr[0] == 'spatch':
|
elif nArr[0] == 'spatch':
|
||||||
if nArr[1] not in spatch_stages:
|
if nArr[1] not in spatch_stages:
|
||||||
spatch_stages[nArr[1]] = []
|
spatch_stages[nArr[1]] = []
|
||||||
|
|
||||||
spatch_stages[nArr[1]].append(f"{nArr[2]}_{nArr[3]}")
|
spatch_stages[nArr[1]].append(nArr[2])
|
||||||
|
|
||||||
patch_end.append(item.name.replace("spatch", ""))
|
#检测父节点
|
||||||
|
#通过正则表达式,筛选出#开头与#结尾的字符串
|
||||||
|
parr = item.name.split('#')
|
||||||
|
if len(parr) != 3:
|
||||||
|
log.append("spatch图层命名错误,找不到父节点:{}".format(item.name))
|
||||||
|
else:
|
||||||
|
parent = parr[1]
|
||||||
|
if parent not in spatch_parent_name:
|
||||||
|
spatch_parent_name.append(parent)
|
||||||
|
tarr = parent.split('_')
|
||||||
|
if tarr[0] != "patch":
|
||||||
|
log.append("spatch图层命名错误,父节点不是patch:{}".format(item.name))
|
||||||
|
|
||||||
|
spatch_end.append(item.name.replace("spatch", "").replace(f"_#{parent}#", ""))
|
||||||
elif nArr[0] == 'bad':
|
elif nArr[0] == 'bad':
|
||||||
if nArr[1] not in bad_stages:
|
if nArr[1] not in bad_stages:
|
||||||
bad_stages[nArr[1]] = []
|
bad_stages[nArr[1]] = []
|
||||||
|
|
||||||
bad_stages[nArr[1]].append(nArr[2])
|
bad_stages[nArr[1]].append(nArr[2])
|
||||||
|
|
||||||
|
if item.name not in bad_names:
|
||||||
|
bad_names.append(item.name)
|
||||||
|
|
||||||
bad_end.append(item.name.replace("bad", ""))
|
bad_end.append(item.name.replace("bad", ""))
|
||||||
elif nArr[0] == 'sbad':
|
elif nArr[0] == 'sbad':
|
||||||
if nArr[1] not in sbad_stages:
|
if nArr[1] not in sbad_stages:
|
||||||
sbad_stages[nArr[1]] = []
|
sbad_stages[nArr[1]] = []
|
||||||
|
|
||||||
sbad_stages[nArr[1]].append(f"{nArr[2]}_{nArr[3]}")
|
sbad_stages[nArr[1]].append(nArr[2])
|
||||||
|
|
||||||
bad_end.append(item.name.replace("sbad", ""))
|
#检测父节点
|
||||||
|
#通过正则表达式,筛选出#开头与#结尾的字符串
|
||||||
|
parr = item.name.split('#')
|
||||||
|
if len(parr) != 3:
|
||||||
|
log.append("sbad图层命名错误,找不到父节点:{}".format(item.name))
|
||||||
|
else:
|
||||||
|
parent = parr[1]
|
||||||
|
if parent not in sbad_parent_name:
|
||||||
|
sbad_parent_name.append(parent)
|
||||||
|
tarr = parent.split('_')
|
||||||
|
if tarr[0] != "bad":
|
||||||
|
log.append("sbad图层命名错误,父节点不是bad:{}".format(item.name))
|
||||||
|
|
||||||
|
|
||||||
|
sbad_end.append(item.name.replace("sbad", "").replace(f"_#{parent}#", ""))
|
||||||
elif nArr[0] == 'auto':
|
elif nArr[0] == 'auto':
|
||||||
if nArr[1] not in auto_stages:
|
if nArr[1] not in auto_stages:
|
||||||
auto_stages[nArr[1]] = []
|
auto_stages[nArr[1]] = []
|
||||||
|
|
@ -198,6 +239,14 @@ def parse_psd(path):
|
||||||
if item not in bad_end:
|
if item not in bad_end:
|
||||||
log.append("拼图图层找不到bad图层:patch{}".format(item))
|
log.append("拼图图层找不到bad图层:patch{}".format(item))
|
||||||
|
|
||||||
|
for item in sbad_end:
|
||||||
|
if item not in spatch_end:
|
||||||
|
log.append("sbad图层找不到拼图图层:sbad{}".format(item))
|
||||||
|
|
||||||
|
for item in spatch_end:
|
||||||
|
if item not in sbad_end:
|
||||||
|
log.append("拼图图层找不到sbad图层:spatch{}".format(item))
|
||||||
|
|
||||||
for stage in spatch_stages:
|
for stage in spatch_stages:
|
||||||
tmp = {}
|
tmp = {}
|
||||||
for item in spatch_stages[stage]:
|
for item in spatch_stages[stage]:
|
||||||
|
|
@ -206,6 +255,23 @@ def parse_psd(path):
|
||||||
else:
|
else:
|
||||||
tmp[item] = 0
|
tmp[item] = 0
|
||||||
|
|
||||||
|
for stage in sbad_stages:
|
||||||
|
tmp = {}
|
||||||
|
for item in sbad_stages[stage]:
|
||||||
|
if item in tmp:
|
||||||
|
log.append("存在重复图层:sbad_{}_{}".format(stage, item))
|
||||||
|
else:
|
||||||
|
tmp[item] = 0
|
||||||
|
|
||||||
|
#检测sbad的父节点是否存在
|
||||||
|
for a_sbad_name in sbad_parent_name:
|
||||||
|
if a_sbad_name not in bad_names:
|
||||||
|
log.append(f"sbad中配置的主节点{a_sbad_name} 实际找不到")
|
||||||
|
|
||||||
|
#检测spatch的父节点是否存在
|
||||||
|
for a_spatch_name in spatch_parent_name:
|
||||||
|
if a_spatch_name not in patch_names:
|
||||||
|
log.append(f"spatch中配置的主节点{a_spatch_name} 实际找不到")
|
||||||
|
|
||||||
log.append("检测结束")
|
log.append("检测结束")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue