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

25 lines
670 B
Python
Raw 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 Core import GetJoints
def delete_joint_for_lod(lod):
"""
删除指定LOD级别不需要的关节
参数:
lod (int): LOD级别
"""
# 获取所有关节和指定LOD级别的关节
joint_all = GetJoints(lod=0, type="string")
joint_lod = GetJoints(lod=lod, type="string")
# 找出需要删除的关节在所有关节中但不在指定LOD级别中的关节
joint_del = list(set(joint_all) - set(joint_lod))
# 删除不需要的关节
for joint in joint_del:
if cmds.objExists(joint):
cmds.delete(joint)