#!/usr/bin/env python # -*- coding: utf-8 -*- """ 版权所有: 深圳时光科技有限公司 联系方式: q.100@qq.com 创建日期: 2023/08/08 """ import maya.cmds as cmds def sg_refresh_neutral_joint_translation(): """ 刷新关节的中性位置平移值 """ # 获取所有关节 joints = cmds.SGGetJoints() # 遍历每个关节 for i, joint in enumerate(joints): # 获取关节的平移值 pos = cmds.getAttr(f"{joint}.t")[0] # 设置关节的中性位置 cmds.SGSetNeutralJointTranslations(i, pos[0], pos[1], pos[2]) # 如果直接运行此脚本 if __name__ == '__main__': sg_refresh_neutral_joint_translation()