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

29 lines
754 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import maya.cmds as cmds
from scripts.utils.Core import GetMeshes, SetMeshes
def standardized_naming():
"""
标准化所有网格的命名
将所有网格重命名为标准名称
"""
# 获取所有标准网格名称
meshes = GetMeshes()
# 遍历每个网格索引
for i in range(len(meshes)):
# 获取当前网格
mesh = GetMeshes(m=i)
# 如果网格存在,进行重命名
if cmds.objExists(mesh):
# 重命名网格并更新引用
new_name = cmds.rename(mesh, meshes[i])
SetMeshes(m=i, value=new_name)
# 如果直接运行此脚本
if __name__ == '__main__':
standardized_naming()