MetaFusion/scripts/utils/UnbindSkinCluster.py
2025-02-07 05:10:30 +08:00

27 lines
782 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import maya.cmds as cmds
from scripts.utils.Core import GetMeshes, FindSkinCluster
def unbind_skin_cluster():
"""
解除所有网格的蒙皮绑定
遍历前54个网格如果存在蒙皮变形器则解除绑定
"""
# 遍历所有网格
for i in range(54):
# 获取网格
mesh = GetMeshes(m=i)
if cmds.objExists(mesh):
# 查找关联的蒙皮变形器
skin_cluster = FindSkinCluster(mesh)
# 如果存在蒙皮变形器,解除绑定
if cmds.objExists(skin_cluster):
cmds.skinCluster(mesh, edit=True, unbind=True)
# 如果直接运行此脚本
if __name__ == '__main__':
unbind_skin_cluster()