diff --git a/README.md b/README.md index 3f2df28..bec660b 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ ``` import sys -sys.path.append("c:/Arts and Spells/Scripts") +sys.path.append("C:/Arts and Spells/Metapipe Studo 1.3.0") import Body_Prep Body_Prep.run() ``` @@ -46,7 +46,7 @@ Body_Prep.run() ``` import sys -sys.path.append("c:/Arts and Spells/Scripts") +sys.path.append("C:/Arts and Spells/Metapipe Studo 1.3.0") import MetaPipeStudio MetaPipeStudio.show_dna_edit_window() ``` diff --git a/correctiveBlendshape.py b/correctiveBlendshape.py new file mode 100644 index 0000000..8251fa7 --- /dev/null +++ b/correctiveBlendshape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import maya.cmds as cmds +import sys +import importlib + +def run(): + # 获取选中的对象 + selected = cmds.ls(selection=True, transforms=True) + + # 检查是否选择了两个对象 + if len(selected) != 2: + raise RuntimeError(f"请选择两个多边形对象!") + + # 检查每个选中对象的类型 + for obj in selected: + shapes = cmds.listRelatives(obj, shapes=True) + for shape in shapes: + if cmds.nodeType(shape) != "mesh": + raise RuntimeError(f"选中的几何体不是多边形对象!") + + # 检查第一个对象是否绑定了蒙皮 + shapes = cmds.listRelatives(selected[0], shapes=True) + skin = cmds.listConnections(shapes[0], type="skinCluster") + if not skin: + raise RuntimeError(f"第一个选中的对象没有绑定蒙皮簇!") + + # 执行 extractDeltas 命令 + cmds.extractDeltas(s=selected[0], c=selected[1]) + + # 选择第二个对象 + cmds.select(selected[1], replace=True) + + # 导入并运行 bsIndex + sys.path.append('C:/Arts and Spells/Metapipe Studio 1.3.0') + import bsIndex + importlib.reload(bsIndex) + bsIndex.calc() + +if __name__ == "__main__": + run() \ No newline at end of file