def write_defor_geo(file_path)
try:
pm.openFile(file_path, f=1)
except:
pass
for i in pm.ls(type='skinCluster'):
info = pm.skinCluster(i, q=1, g=1)
if not info:
continue
if not i.hasAttr('t_geo'):
i.addAttr('t_geo', dt='string')
all_info = []
for m in info:
if isinstance(m, str):
all_info.append(m)
else:
all_info.append(m.fullPath())
i.t_geo.set(str(all_info))
for i in pm.ls(type='blendShape'):
info = pm.blendShape(i, q=1, g=1)
if not info:
continue
if not i.hasAttr('t_geo'):
i.addAttr('t_geo', dt='string')
all_info = []
for m in info:
if isinstance(m, str):
all_info.append(m)
else:
all_info.append(m.fullPath())
i.t_geo.set(str(all_info))
pm.saveAs(file_path[:-3]+'repair.ma', f=1)
def repair_bs(file_path):
try:
pm.openFile(file_path[:-3]+'repair.ma', f=1)
except:
pass
for i in pm.ls(typ='blendShape'):
g_mesh = eval(i.t_geo.get())
pm.blendShape(i, e=1, g=g_mesh)
for i in pm.ls(typ='skinCluster'):
g_mesh = eval(i.t_geo.get())
pm.skinCluster(i, e=1, g=g_mesh)
pm.saveFile(f=1)