def assetPath_to_HDpath(self,assetPath):
get_project_file_path=unreal.Paths.get_project_file_path()
HD_get_project_file_path=os.path.abspath(get_project_file_path)
project_file_dir=os.path.dirname(HD_get_project_file_path)
project_file_dir=project_file_dir.replace("\\","/")
unreal.log_warning("project_file_dir= "+project_file_dir)
# /Game/
assetHDPath=project_file_dir+"/Content"+assetPath[5:]
assetHDPath_without_ext = os.path.splitext(assetHDPath)[0]
assetHDPath_uasset=assetHDPath_without_ext+".uasset"
unreal.log_warning("assetHDPath_uasset= "+assetHDPath_uasset)
#print("")
return assetHDPath_uasset
def uasset_textFile_read(self,path):
file = open(path, 'rb')
#file = open(path, encoding="utf8", errors='ignore')
print("1 binary open!!")
BytesDataBox=b""
BytesDataStr=u""
#BytesDataStr = file.read()
#print("BytesDataStr="+BytesDataStr)
bytes = file.read(1)
#print("2 binary valiabled!!")
while bytes:
#print(bytes)
#print("2 printed!!")
BytesDataBox = BytesDataBox+bytes
#print("2 BytesDataBox added !!")
#decoded=bytes.decode("utf-8")
#print("2 decoded!!")
#print(decoded)
#print("2 decoded printed!!")
#ByteDataBox=ByteDataBox+decoded
#print("2 ByteDataBox insert!!")
bytes = file.read(1)
#print("2 byte = file.read(1)!!")
print("3 while byte end!!")
print("BytesDataBox= ")
#print(BytesDataBox)
print("4 printed!!")
print(type(BytesDataBox))
print("4 class printed!!")
BytesDataBox=BytesDataBox.strip()
print("4 striped!!")
file.close()
#BytesDataStr = str(BytesDataBox, 'utf-8')
#BytesDataStr=BytesDataBox.decode(encoding ='utf-8', errors='ignore')
self.fileWrite_byte(BytesDataBox)
BytesDataStr=self.fileRead_byte_()
print("4 decoded!!")
pattern = r'/Game/.*?\\'
# findall
results = re.findall(pattern, BytesDataStr, re.S)
results_len=len(results)
print("results_len= "+str(results_len))
# Type:list
print(type(results))
print("4 all hit list printed!!")
# 抽出
for result in results:
result_len=len(result)
good_result=result[0:result_len-1]
print("result_len= "+str(result_len)+" good_result= "+ good_result)
print("4 for printed!!")
def fileWrite_byte(self,s):
ReportFolderPath=self.getMyDir()+"Report"
self.my_makedirs(ReportFolderPath)
path_cp=ReportFolderPath+"/bytes_"+".txt"
fout_utf = codecs.open(path_cp, 'w', encoding='cp932')
fout_utf.write(s)
def fileRead_byte_(self):
ReportFolderPath=self.getMyDir()+"Report"
self.my_makedirs(ReportFolderPath)
path_cp=ReportFolderPath+"/bytes_"+".txt"
fout_utf = codecs.open(path_cp, 'r', encoding='cp932')
data=fout_utf.read()
print("4 data!!="+data)
return data
コメント