修改测试PSD

main
程祎 2023-11-06 12:10:24 +08:00
parent 4d1c9182ef
commit c8f158a5aa
3 changed files with 35 additions and 11 deletions

Binary file not shown.

View File

@ -24,6 +24,7 @@ def parse_psd(path):
log.append("开始检测:{}".format(file_name))
psd = PSDImage.open(path)
print("psd width height", psd.width, psd.height)
try:
image = psd.composite()
except Exception as e:
@ -33,25 +34,31 @@ def parse_psd(path):
has_finish = False
lines = {}
patch_stages = {}
bad_stages = {}
auto_stages = {}
#patch的末尾数字
patch_end = []
bad_end = []
line_end = []
max_width = 0
max_height = 0
is_activity_main_psd = path.find("activity/main_psd/") != -1
for item in psd.descendants():
if not item.is_group():
nArr = item.name.split('_')
#在活动背景中基础图为base_1
if item.name == "base" or (is_activity_main_psd and item.name == "base_1"):
max_width = item.width
max_height = item.height
break
#活动地图读取整个PSD的宽高
if is_activity_main_psd:
max_width = psd.width
max_height = psd.height
else:
#普通资源读取base的宽高
for item in psd.descendants():
if not item.is_group():
nArr = item.name.split('_')
if item.name == "base":
max_width = item.width
max_height = item.height
break
for item in psd.descendants():
if not item.is_group():
@ -87,6 +94,13 @@ def parse_psd(path):
patch_stages[nArr[1]].append(nArr[2])
patch_end.append(item.name.replace("patch", ""))
elif nArr[0] == 'bad':
if nArr[1] not in bad_stages:
bad_stages[nArr[1]] = []
bad_stages[nArr[1]].append(nArr[2])
bad_end.append(item.name.replace("bad", ""))
elif nArr[0] == 'auto':
if nArr[1] not in auto_stages:
auto_stages[nArr[1]] = []
@ -118,7 +132,7 @@ def parse_psd(path):
if not has_base:
log.append("未检测到base图层\n")
if not has_finish:
if not is_activity_main_psd and not has_finish:
log.append("未检测到finish图层\n")
for stage in patch_stages:
@ -149,6 +163,16 @@ def parse_psd(path):
if item not in patch_end:
log.append("描线找不到patch图层line{}".format(item))
if is_activity_main_psd:
for item in bad_end:
if item not in patch_end:
log.append("bad图层找不到拼图图层bad{}".format(item))
for item in patch_end:
if item not in bad_end:
log.append("拼图图层找不到bad图层patch{}".format(item))
log.append("检测结束")
if len(log) == 2:

View File

@ -1606,7 +1606,7 @@
"9": "8763b1aaa2f9e912fafc62d8ece7936e2b6715a6",
"90": "2501bfb8d3b01598d3bb57a7dc54c518ca62e228",
"900": "2539dfe26204667c84db16b49ba9cae98289e633",
"90000": "dc2eaf10c6c61cb22a339e3eeaefe20bcd37cca8",
"90000": "d9faaeb31403d13fff9459a278505cbe42fe7986",
"901": "d17f1c1954d16b9adfae896ffb79235601c14226",
"902": "7db0cd70ad3bfda76b59bdfa3bfd89e0c5e84294",
"903": "7c553c29367cdcce406ac2a7d563192ff7d6c529",