DefaultEngine.iniに記載されているので無理やり読む
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
project_config_dir=unreal.Paths.project_config_dir()
#D:\MOSAProduct\MOSAProduct\Config\DefaultEngine.ini
DefaultEngineINI_Path=project_config_dir+"DefaultEngine.ini"
print("DefaultEngineINI_Path="+DefaultEngineINI_Path)
#fout = codecs.open('sjis.txt', 'w', 'shift_jis')
import re
def get_CollisionProfileNameStr(content):
#m = re.search('"(.*)".*', content)
result = re.findall('"(.*?)"', content)
print("result[0]="+str(result[0]))
#print("result[1]="+str(result[1]))
return str(result[0])
CollisionProfileStrArr=[]
for line in codecs.open(DefaultEngineINI_Path, 'r', 'utf_8'):
#fout.write(line)
#print(line)
if("-Profiles=(Name=" in line):
ProfilesName=get_CollisionProfileNameStr(line)
CollisionProfileStrArr.append(ProfilesName)
if("+Profiles=(Name=" in line):
ProfilesName=get_CollisionProfileNameStr(line)
CollisionProfileStrArr.append(ProfilesName)
print("-----------------------Do Unique-----------------------------")
CollisionProfileStrSet = set(CollisionProfileStrArr)
CollisionProfileStrArr = list(CollisionProfileStrSet)
CollisionProfileStrArr.sort()
CollisionProfileStrArrBuildCSV=""
for CollisionProfileStr in CollisionProfileStrArr:
print("CollisionProfileStr="+CollisionProfileStr)
CollisionProfileStrArrBuildCSV=CollisionProfileStrArrBuildCSV+","+CollisionProfileStr
print("CollisionProfileStrArrBuildCSV="+CollisionProfileStrArrBuildCSV)