修改测试PSD
parent
4d1c9182ef
commit
c8f158a5aa
Binary file not shown.
|
|
@ -24,6 +24,7 @@ def parse_psd(path):
|
||||||
log.append("开始检测:{}".format(file_name))
|
log.append("开始检测:{}".format(file_name))
|
||||||
|
|
||||||
psd = PSDImage.open(path)
|
psd = PSDImage.open(path)
|
||||||
|
print("psd width height", psd.width, psd.height)
|
||||||
try:
|
try:
|
||||||
image = psd.composite()
|
image = psd.composite()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -33,22 +34,28 @@ def parse_psd(path):
|
||||||
has_finish = False
|
has_finish = False
|
||||||
lines = {}
|
lines = {}
|
||||||
patch_stages = {}
|
patch_stages = {}
|
||||||
|
bad_stages = {}
|
||||||
auto_stages = {}
|
auto_stages = {}
|
||||||
|
|
||||||
#patch的末尾数字
|
#patch的末尾数字
|
||||||
patch_end = []
|
patch_end = []
|
||||||
|
bad_end = []
|
||||||
line_end = []
|
line_end = []
|
||||||
|
|
||||||
max_width = 0
|
max_width = 0
|
||||||
max_height = 0
|
max_height = 0
|
||||||
|
|
||||||
is_activity_main_psd = path.find("activity/main_psd/") != -1
|
is_activity_main_psd = path.find("activity/main_psd/") != -1
|
||||||
|
#活动地图读取整个PSD的宽高
|
||||||
|
if is_activity_main_psd:
|
||||||
|
max_width = psd.width
|
||||||
|
max_height = psd.height
|
||||||
|
else:
|
||||||
|
#普通资源读取base的宽高
|
||||||
for item in psd.descendants():
|
for item in psd.descendants():
|
||||||
if not item.is_group():
|
if not item.is_group():
|
||||||
nArr = item.name.split('_')
|
nArr = item.name.split('_')
|
||||||
|
if item.name == "base":
|
||||||
#在活动背景中,基础图为base_1
|
|
||||||
if item.name == "base" or (is_activity_main_psd and item.name == "base_1"):
|
|
||||||
max_width = item.width
|
max_width = item.width
|
||||||
max_height = item.height
|
max_height = item.height
|
||||||
break
|
break
|
||||||
|
|
@ -87,6 +94,13 @@ def parse_psd(path):
|
||||||
patch_stages[nArr[1]].append(nArr[2])
|
patch_stages[nArr[1]].append(nArr[2])
|
||||||
|
|
||||||
patch_end.append(item.name.replace("patch", ""))
|
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':
|
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]] = []
|
||||||
|
|
@ -118,7 +132,7 @@ def parse_psd(path):
|
||||||
if not has_base:
|
if not has_base:
|
||||||
log.append("未检测到base图层\n")
|
log.append("未检测到base图层\n")
|
||||||
|
|
||||||
if not has_finish:
|
if not is_activity_main_psd and not has_finish:
|
||||||
log.append("未检测到finish图层\n")
|
log.append("未检测到finish图层\n")
|
||||||
|
|
||||||
for stage in patch_stages:
|
for stage in patch_stages:
|
||||||
|
|
@ -149,6 +163,16 @@ def parse_psd(path):
|
||||||
if item not in patch_end:
|
if item not in patch_end:
|
||||||
log.append("描线找不到patch图层:line{}".format(item))
|
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("检测结束")
|
log.append("检测结束")
|
||||||
|
|
||||||
if len(log) == 2:
|
if len(log) == 2:
|
||||||
|
|
|
||||||
|
|
@ -1606,7 +1606,7 @@
|
||||||
"9": "8763b1aaa2f9e912fafc62d8ece7936e2b6715a6",
|
"9": "8763b1aaa2f9e912fafc62d8ece7936e2b6715a6",
|
||||||
"90": "2501bfb8d3b01598d3bb57a7dc54c518ca62e228",
|
"90": "2501bfb8d3b01598d3bb57a7dc54c518ca62e228",
|
||||||
"900": "2539dfe26204667c84db16b49ba9cae98289e633",
|
"900": "2539dfe26204667c84db16b49ba9cae98289e633",
|
||||||
"90000": "dc2eaf10c6c61cb22a339e3eeaefe20bcd37cca8",
|
"90000": "d9faaeb31403d13fff9459a278505cbe42fe7986",
|
||||||
"901": "d17f1c1954d16b9adfae896ffb79235601c14226",
|
"901": "d17f1c1954d16b9adfae896ffb79235601c14226",
|
||||||
"902": "7db0cd70ad3bfda76b59bdfa3bfd89e0c5e84294",
|
"902": "7db0cd70ad3bfda76b59bdfa3bfd89e0c5e84294",
|
||||||
"903": "7c553c29367cdcce406ac2a7d563192ff7d6c529",
|
"903": "7c553c29367cdcce406ac2a7d563192ff7d6c529",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue