Update Export_FBX.py

This commit is contained in:
Jeffreytsai1004 2025-01-20 23:01:48 +08:00
parent 2eafdd7fad
commit 2f5c7233af

View File

@ -9,35 +9,35 @@ def export_fbx(ROOT_DIR):
# Set the path and filename for the FBX file
# 设置FBX文件的路径和文件名
path = f"{ROOT_DIR}/output"
filename = "body.fbx"
filepath = path + "/" + filename
cmds.select(clear=True)
cmds.select("body_rig", add=True)
cmds.select("DHIbody:root", add=True)
# Export the selected objects as FBX
# 导出选定的对象为FBX
cmds.file(filepath, force=True, options="groups=0;ptgroups=0;materials=0;smoothing=1;normals=1", type='FBX export', exportSelected=True)
filename = "head.fbx"
filepath = path + "/" + filename
cmds.select("DHIbody:spine_04", hi=True) # Select "DHIbody:spine_04" and its children
cmds.delete() # Delete the selected objects
cmds.select("DHIbody:thigh_r", hi=True) # Select "DHIbody:spine_04" and its children
cmds.delete() # Delete the selected objects
cmds.select("DHIbody:thigh_l", hi=True) # Select "DHIbody:spine_04" and its children
cmds.delete() # Delete the selected objects
cmds.select("DHIbody:spine_04", hi=True) # 选择"DHIbody:spine_04"及其子对象
cmds.delete() # 删除选定的对象
cmds.select("DHIbody:thigh_r", hi=True) # 选择"DHIbody:spine_04"及其子对象
cmds.delete() # 删除选定的对象
cmds.select("DHIbody:thigh_l", hi=True) # 选择"DHIbody:spine_04"及其子对象
cmds.delete() # 删除选定的对象
# Parent "DHIhead:spine_04" under "DHIbody:spine_03"
# 将"DHIhead:spine_04"作为"DHIbody:spine_03"的子对象
cmds.parent("DHIhead:spine_04", "DHIbody:spine_03")
# Print the new parent of "DHIhead:spine_04"
# 打印"DHIhead:spine_04"的新父对象
print(cmds.listRelatives("DHIhead:spine_04", parent=True))
cmds.select(clear=True)
cmds.select("head_grp", add=True)
cmds.select("DHIbody:root", add=True)
# Export the selected objects as FBX
# 导出选定的对象为FBX
cmds.file(filepath, force=True, options="groups=0;ptgroups=0;materials=0;smoothing=1;normals=1", type='FBX export', exportSelected=True)
cmds.undo()