選択以下のジョイントで、末端にあるもののジョイント方向(Joint Orient)を0にするPythonスクリプトです。
Maya用です。
末端のジョイント方向は0にする仕様が結構多いので作ってみました。
スクリプトエディターに貼り付けたりシェルフに登録して実行してください。
import maya.cmds as cmds
def zero_out_end_joint_orient():
# 選択されたジョイントを取得
selected_joints = cmds.ls(selection=True, type='joint')
# 選択されたジョイントとその子孫ジョイントを含むリストを作成
all_joints = []
for joint in selected_joints:
all_joints.append(joint)
descendants = cmds.listRelatives(joint, allDescendents=True, type='joint') or []
all_joints.extend(descendants)
# 末端のジョイントを見つける
end_joints = []
for joint in all_joints:
children = cmds.listRelatives(joint, children=True, type='joint') or []
if not children:
end_joints.append(joint)
# 末端のジョイントの向きを0に設定
for joint in end_joints:
cmds.setAttr(joint + '.jointOrient', 0, 0, 0, type='double3')
# スクリプトの実行
zero_out_end_joint_orient()