maya2016用
GroupNode
・Mesh
・SK_Mannequin/root
にしてから実行
Pythonで書き直した。2021年12月DragonNightにWaterモーション追加時に追記
Daz StudioのジョイントをHumanIKに追加用
# -*- coding: utf-8 -*-
from maya import cmds
import maya.mel as mel
import re
import pymel.core as pm
def makeHumanIkDef_from_selected_groupName():
selectedGlp=""
characterName=""
selectedArr=cmds.ls(sl=1)
print("selectedArr= "+str(selectedArr))
if(str(selectedArr)=="[]"):
print("You Should Select root Group Node!!!")
else:
selectedGlp=selectedArr[0]
characterName=pm.mel.hikCreateCharacter(selectedGlp)
#evalStr='$characterName = `hikCreateCharacter('+selectedGlp+')`'
#myPythonVar=mel.eval('$tempMelVar=$gMainWindow')
#characterName=mel.eval(evalStr)
print(u"characterName= " + str(characterName))
return characterName,selectedGlp
def LongNameToShortName(LongName):
#childfullpath= |group_meshHIK_Tpose_jointUE4name5|SK_Mannequin|root|hip|spine_01
LongNameArr=LongName.split("|")
LongNameArrLong=len(LongNameArr)
shortName=LongNameArr[LongNameArrLong-1]
return shortName
def Group_in_joint(GroupName,jointName):
print("jointName= "+jointName)
HitJointFullPath=""
groupChild=cmds.ls(GroupName,dag=1,long=1)
for childfullpath in groupChild:
searchStr=r'.*'+'\|'+jointName+r'$'
print("searchStr= "+searchStr +" childfullpath= "+childfullpath)
MatchObj=re.match(searchStr, childfullpath)
MatchBool=bool(MatchObj)
if(MatchBool==True):
HitJointFullPath=childfullpath
print("HitJointFullPath !!!!!!!!= "+HitJointFullPath)
break
#shortjointNameArr=cmds.ls(childfullpath,shortNames=1)
#shortjointName=shortjointNameArr[0]
shortjointName=LongNameToShortName(childfullpath)
print("searchStr= "+jointName +" shortjointName= "+shortjointName)
if(str(shortjointName)==str(jointName)):
HitJointFullPath=childfullpath
print("HitJointFullPath !!!!!!!!= "+shortjointName)
break
print("HitJointFullPath= "+HitJointFullPath)
return HitJointFullPath
def setCharacterObject(GroupName,jointName,characterDefName,RigInt,RigInt2):
#MEL setCharacterObject("root",$characterDefName,0,0);
jointFullName=Group_in_joint(GroupName,jointName)
evalStr='setCharacterObject("'+jointFullName+'","'+characterDefName+'",'+str(RigInt)+','+str(RigInt2)+');'
print("evalStr= "+ evalStr)
mel.eval(evalStr)
def UE4JointSetToHumanIK():
characterDefName,GroupName= makeHumanIkDef_from_selected_groupName()
#print("characterDefName= "+characterDefName)
setCharacterObject(GroupName,"root",characterDefName,0,0);
setCharacterObject(GroupName,"hip",characterDefName,1,0);
setCharacterObject(GroupName,"thigh_l",characterDefName,2,0);
setCharacterObject(GroupName,"calf_l",characterDefName,3,0);
setCharacterObject(GroupName,"foot_l",characterDefName,4,0);
setCharacterObject(GroupName,"thigh_r",characterDefName,5,0);
setCharacterObject(GroupName,"calf_r",characterDefName,6,0);
setCharacterObject(GroupName,"foot_r",characterDefName,7,0);
setCharacterObject(GroupName,"spine_01",characterDefName,8,0);
setCharacterObject(GroupName,"upperarm_l",characterDefName,9,0);
setCharacterObject(GroupName,"lowerarm_l",characterDefName,10,0);
setCharacterObject(GroupName,"hand_l",characterDefName,11,0);
setCharacterObject(GroupName,"upperarm_r",characterDefName,12,0);
setCharacterObject(GroupName,"lowerarm_r",characterDefName,13,0);
setCharacterObject(GroupName,"hand_r",characterDefName,14,0);
setCharacterObject(GroupName,"head",characterDefName,15,0);
setCharacterObject(GroupName,"thumb_02_l",characterDefName,50,0);
setCharacterObject(GroupName,"thumb_03_l",characterDefName,51,0);
setCharacterObject(GroupName,"thumb_04_l",characterDefName,52,0);
setCharacterObject(GroupName,"index_01_l",characterDefName,54,0);
setCharacterObject(GroupName,"index_02_l",characterDefName,55,0);
setCharacterObject(GroupName,"index_03_l",characterDefName,56,0);
setCharacterObject(GroupName,"middle_01_l",characterDefName,58,0);
setCharacterObject(GroupName,"middle_02_l",characterDefName,59,0);
setCharacterObject(GroupName,"middle_03_l",characterDefName,60,0);
setCharacterObject(GroupName,"ring_01_l",characterDefName,62,0);
setCharacterObject(GroupName,"ring_02_l",characterDefName,63,0);
setCharacterObject(GroupName,"ring_03_l",characterDefName,64,0);
setCharacterObject(GroupName,"pinky_01_l",characterDefName,66,0);
setCharacterObject(GroupName,"pinky_02_l",characterDefName,67,0);
setCharacterObject(GroupName,"pinky_03_l",characterDefName,68,0);
setCharacterObject(GroupName,"thumb_02_r",characterDefName,74,0);
setCharacterObject(GroupName,"thumb_03_r",characterDefName,75,0);
setCharacterObject(GroupName,"thumb_04_r",characterDefName,76,0);
setCharacterObject(GroupName,"index_01_r",characterDefName,78,0);
setCharacterObject(GroupName,"index_02_r",characterDefName,79,0);
setCharacterObject(GroupName,"index_03_r",characterDefName,80,0);
setCharacterObject(GroupName,"middle_01_r",characterDefName,82,0);
setCharacterObject(GroupName,"middle_02_r",characterDefName,83,0);
setCharacterObject(GroupName,"middle_03_r",characterDefName,84,0);
setCharacterObject(GroupName,"ring_01_r",characterDefName,86,0);
setCharacterObject(GroupName,"ring_02_r",characterDefName,87,0);
setCharacterObject(GroupName,"ring_03_r",characterDefName,88,0);
setCharacterObject(GroupName,"pinky_01_r",characterDefName,90,0);
setCharacterObject(GroupName,"pinky_02_r",characterDefName,91,0);
setCharacterObject(GroupName,"pinky_03_r",characterDefName,92,0);
UE4JointSetToHumanIK()
MEL(UE4グレイマンジョイントをリファレンスしてる場合) Ver.3
//selected_gloup_nodeName_to_HumanIKCharacterName UE4 joint Refferenced. Ver3
//you shuld Select Root Joint
global proc string makeHumanIkDef_from_selected_groupName()
{
string $selectedArr[] = `ls -sl`;
print($selectedArr);
string $selectedGlp = $selectedArr[0];
$characterName = `hikCreateCharacter($selectedGlp)`;
print("characterName= "+$characterName+"\n");
return $characterName;
};
global proc string Get_RefferenceName_selected_groupName()
{
string $RefferenceName ="";
string $selectedArr[] = `ls -sl`;
print($selectedArr);
string $selectedGlp = $selectedArr[0];
string $buffer[];
$numTokens = `tokenize $selectedGlp ":" $buffer`;
//print("$buffer= "+$buffer+"\n");
$RefferenceName=$buffer[0];
print("$RefferenceName= "+$RefferenceName+"\n");
return $RefferenceName;
};
global proc UE4JointSetToHumanIK()
{
string $selectedArr[] = `ls -sl`;
print($selectedArr);
if($selectedArr[0]==""){
print("You Should Select joint And Mesh Group!!!!!!!");
}else{
$RefferenceName= `Get_RefferenceName_selected_groupName`;
print("$RefferenceName= "+$RefferenceName+"\n");
$characterDefName= `makeHumanIkDef_from_selected_groupName`;
print("characterDefName= "+$characterDefName+"\n");
//setCharacterObject to UnrealEngine4 (UE4)Joint
setCharacterObject($RefferenceName+":root",$characterDefName,0,0);
setCharacterObject($RefferenceName+":pelvis",$characterDefName,1,0);
setCharacterObject($RefferenceName+":thigh_l",$characterDefName,2,0);
setCharacterObject($RefferenceName+":calf_l",$characterDefName,3,0);
setCharacterObject($RefferenceName+":foot_l",$characterDefName,4,0);
setCharacterObject($RefferenceName+":thigh_r",$characterDefName,5,0);
setCharacterObject($RefferenceName+":calf_r",$characterDefName,6,0);
setCharacterObject($RefferenceName+":foot_r",$characterDefName,7,0);
setCharacterObject($RefferenceName+":spine_01 ",$characterDefName,8,0);
setCharacterObject($RefferenceName+":upperarm_l ",$characterDefName,9,0);
setCharacterObject($RefferenceName+":lowerarm_l ",$characterDefName,10,0);
setCharacterObject($RefferenceName+":hand_l ",$characterDefName,11,0);
setCharacterObject($RefferenceName+":upperarm_r ",$characterDefName,12,0);
setCharacterObject($RefferenceName+":lowerarm_r ",$characterDefName,13,0);
setCharacterObject($RefferenceName+":hand_r ",$characterDefName,14,0);
setCharacterObject($RefferenceName+":head ",$characterDefName,15,0);
setCharacterObject($RefferenceName+":thumb_01_l ",$characterDefName,50,0);
setCharacterObject($RefferenceName+":thumb_02_l ",$characterDefName,51,0);
setCharacterObject($RefferenceName+":thumb_03_l ",$characterDefName,52,0);
setCharacterObject($RefferenceName+":index_01_l ",$characterDefName,54,0);
setCharacterObject($RefferenceName+":index_02_l ",$characterDefName,55,0);
setCharacterObject($RefferenceName+":index_03_l ",$characterDefName,56,0);
setCharacterObject($RefferenceName+":middle_01_l ",$characterDefName,58,0);
setCharacterObject($RefferenceName+":middle_02_l ",$characterDefName,59,0);
setCharacterObject($RefferenceName+":middle_03_l ",$characterDefName,60,0);
setCharacterObject($RefferenceName+":ring_01_l ",$characterDefName,62,0);
setCharacterObject($RefferenceName+":ring_02_l ",$characterDefName,63,0);
setCharacterObject($RefferenceName+":ring_03_l ",$characterDefName,64,0);
setCharacterObject($RefferenceName+":pinky_01_l ",$characterDefName,66,0);
setCharacterObject($RefferenceName+":pinky_02_l ",$characterDefName,67,0);
setCharacterObject($RefferenceName+":pinky_03_l ",$characterDefName,68,0);
setCharacterObject($RefferenceName+":thumb_01_r ",$characterDefName,74,0);
setCharacterObject($RefferenceName+":thumb_02_r ",$characterDefName,75,0);
setCharacterObject($RefferenceName+":thumb_03_r ",$characterDefName,76,0);
setCharacterObject($RefferenceName+":index_01_r ",$characterDefName,78,0);
setCharacterObject($RefferenceName+":index_02_r ",$characterDefName,79,0);
setCharacterObject($RefferenceName+":index_03_r ",$characterDefName,80,0);
setCharacterObject($RefferenceName+":middle_01_r ",$characterDefName,82,0);
setCharacterObject($RefferenceName+":middle_02_r ",$characterDefName,83,0);
setCharacterObject($RefferenceName+":middle_03_r ",$characterDefName,84,0);
setCharacterObject($RefferenceName+":ring_01_r ",$characterDefName,86,0);
setCharacterObject($RefferenceName+":ring_02_r ",$characterDefName,87,0);
setCharacterObject($RefferenceName+":ring_03_r ",$characterDefName,88,0);
setCharacterObject($RefferenceName+":pinky_01_r ",$characterDefName,90,0);
setCharacterObject($RefferenceName+":pinky_02_r ",$characterDefName,91,0);
setCharacterObject($RefferenceName+":pinky_03_r ",$characterDefName,92,0);
}
};
UE4JointSetToHumanIK()
MEL(UE4ジョイントがシーンに2つある場合用) hipがないタイプ用
//selected_group_nodeName_to_HumanIKCharacterName
string $selectedArr[] = `ls -sl`;
print($selectedArr);
string $selectedGlp = $selectedArr[0];
global proc string makeHumanIkDef_from_selected_groupName()
{
string $selectedArr[] = `ls -sl`;
print($selectedArr);
string $selectedGlp = $selectedArr[0];
$characterName = `hikCreateCharacter($selectedGlp)`;
print("characterName= "+$characterName+"\n");
return $characterName;
};
global proc UE4_pelvis_JointSetToHumanIK_FullPath(string $selectedGlp)
{
$characterDefName= `makeHumanIkDef_from_selected_groupName`;
print("characterDefName= "+$characterDefName+"\n");
//setCharacterObject to UnrealEngine4 (UE4)Joint
setCharacterObject($selectedGlp+"|SK_Mannequin|root",$characterDefName,0,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis",$characterDefName,1,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|thigh_l",$characterDefName,2,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|thigh_l|calf_l",$characterDefName,3,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|thigh_l|calf_l|foot_l",$characterDefName,4,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|thigh_r",$characterDefName,5,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|thigh_r|calf_r",$characterDefName,6,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|thigh_r|calf_r|foot_r",$characterDefName,7,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01 ",$characterDefName,8,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l",$characterDefName,9,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l",$characterDefName,10,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l",$characterDefName,11,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r",$characterDefName,12,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r",$characterDefName,13,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r",$characterDefName,14,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|neck_01|head",$characterDefName,15,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|thumb_01_l",$characterDefName,50,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|thumb_01_l|thumb_02_l",$characterDefName,51,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|thumb_01_l|thumb_02_l|thumb_03_l",$characterDefName,52,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|index_01_l",$characterDefName,54,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|index_01_l|index_02_l",$characterDefName,55,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|index_01_l|index_02_l|index_03_l",$characterDefName,56,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|middle_01_l",$characterDefName,58,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|middle_01_l|middle_02_l",$characterDefName,59,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|middle_01_l|middle_02_l|middle_03_l",$characterDefName,60,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|ring_01_l",$characterDefName,62,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|ring_01_l|ring_02_l",$characterDefName,63,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|ring_01_l|ring_02_l|ring_03_l",$characterDefName,64,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|pinky_01_l",$characterDefName,66,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|pinky_01_l|pinky_02_l",$characterDefName,67,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|pinky_01_l|pinky_02_l|pinky_03_l",$characterDefName,68,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|thumb_01_r",$characterDefName,74,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|thumb_01_r|thumb_02_r",$characterDefName,75,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|thumb_01_r|thumb_02_r|thumb_03_r",$characterDefName,76,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|index_01_r",$characterDefName,78,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|index_01_r|index_02_r",$characterDefName,79,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|index_01_r|index_02_r|index_03_r",$characterDefName,80,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|middle_01_r",$characterDefName,82,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|middle_01_r|middle_02_r",$characterDefName,83,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|middle_01_r|middle_02_r|middle_03_r",$characterDefName,84,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|ring_01_r",$characterDefName,86,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|ring_01_r|ring_02_r",$characterDefName,87,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|ring_01_r|ring_02_r|ring_03_r",$characterDefName,88,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|pinky_01_r",$characterDefName,90,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|pinky_01_r|pinky_02_r",$characterDefName,91,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|pelvis|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|pinky_01_r|pinky_02_r|pinky_03_r",$characterDefName,92,0);
}
UE4_pelvis_JointSetToHumanIK_FullPath($selectedGlp)
MEL (UE4ジョイントがシーンに2つある場合用) hipがあるタイプ用
//selected_gloup_nodeName_to_HumanIKCharacterName
string $selectedArr[] = `ls -sl`;
print($selectedArr);
string $selectedGlp = $selectedArr[0];
global proc string makeHumanIkDef_from_selected_groupName()
{
string $selectedArr[] = `ls -sl`;
print($selectedArr);
string $selectedGlp = $selectedArr[0];
$characterName = `hikCreateCharacter($selectedGlp)`;
print("characterName= "+$characterName+"\n");
return $characterName;
};
global proc UE4JointSetToHumanIK_FullPath(string $selectedGlp)
{
$characterDefName= `makeHumanIkDef_from_selected_groupName`;
print("characterDefName= "+$characterDefName+"\n");
//setCharacterObject to UnrealEngine4 (UE4)Joint
setCharacterObject($selectedGlp+"|SK_Mannequin|root",$characterDefName,0,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip",$characterDefName,1,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|pelvis|thigh_l",$characterDefName,2,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|pelvis|thigh_l|calf_l",$characterDefName,3,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|pelvis|thigh_l|calf_l|foot_l",$characterDefName,4,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|pelvis|thigh_r",$characterDefName,5,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|pelvis|thigh_r|calf_r",$characterDefName,6,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|pelvis|thigh_r|calf_r|foot_r",$characterDefName,7,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01 ",$characterDefName,8,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l",$characterDefName,9,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l",$characterDefName,10,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l",$characterDefName,11,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r",$characterDefName,12,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r",$characterDefName,13,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r",$characterDefName,14,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|neck_01|neckUpper|head",$characterDefName,15,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|thumb_01_l",$characterDefName,50,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|thumb_01_l|thumb_02_l",$characterDefName,51,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|thumb_01_l|thumb_02_l|thumb_03_l",$characterDefName,52,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|index_01_l",$characterDefName,54,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|index_01_l|index_02_l",$characterDefName,55,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|index_01_l|index_02_l|index_03_l",$characterDefName,56,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|middle_01_l",$characterDefName,58,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|middle_01_l|middle_02_l",$characterDefName,59,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|middle_01_l|middle_02_l|middle_03_l",$characterDefName,60,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|ring_01_l",$characterDefName,62,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|ring_01_l|ring_02_l",$characterDefName,63,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|ring_01_l|ring_02_l|ring_03_l",$characterDefName,64,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|pinky_01_l",$characterDefName,66,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|pinky_01_l|pinky_02_l",$characterDefName,67,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_l|upperarm_l|lowerarm_l|hand_l|pinky_01_l|pinky_02_l|pinky_03_l",$characterDefName,68,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|thumb_01_r",$characterDefName,74,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|thumb_01_r|thumb_02_r",$characterDefName,75,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|thumb_01_r|thumb_02_r|thumb_03_r",$characterDefName,76,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|index_01_r",$characterDefName,78,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|index_01_r|index_02_r",$characterDefName,79,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|index_01_r|index_02_r|index_03_r",$characterDefName,80,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|middle_01_r",$characterDefName,82,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|middle_01_r|middle_02_r",$characterDefName,83,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|middle_01_r|middle_02_r|middle_03_r",$characterDefName,84,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|ring_01_r",$characterDefName,86,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|ring_01_r|ring_02_r",$characterDefName,87,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|ring_01_r|ring_02_r|ring_03_r",$characterDefName,88,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|pinky_01_r",$characterDefName,90,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|pinky_01_r|pinky_02_r",$characterDefName,91,0);
setCharacterObject($selectedGlp+"|SK_Mannequin|root|hip|spine_01|spine_02|spine_03|clavicle_r|upperarm_r|lowerarm_r|hand_r|pinky_01_r|pinky_02_r|pinky_03_r",$characterDefName,92,0);
}
UE4JointSetToHumanIK_FullPath($selectedGlp)
MEL (UE4 ジョイントはシーンに1つ用)
//selected_gloup_nodeName_to_HumanIKCharacterName
global proc string makeHumanIkDef_from_selected_groupName()
{
string $selectedArr[] = `ls -sl`;
print($selectedArr);
string $selectedGlp = $selectedArr[0];
$characterName = `hikCreateCharacter($selectedGlp)`;
print("characterName= "+$characterName+"\n");
return $characterName;
};
global proc UE4JointSetToHumanIK()
{
$characterDefName= `makeHumanIkDef_from_selected_groupName`;
print("characterDefName= "+$characterDefName+"\n");
//setCharacterObject to UnrealEngine4 (UE4)Joint
setCharacterObject("root",$characterDefName,0,0);
setCharacterObject("root|hip",$characterDefName,1,0);
setCharacterObject("thigh_l",$characterDefName,2,0);
setCharacterObject("calf_l",$characterDefName,3,0);
setCharacterObject("foot_l",$characterDefName,4,0);
setCharacterObject("thigh_r",$characterDefName,5,0);
setCharacterObject("calf_r",$characterDefName,6,0);
setCharacterObject("foot_r",$characterDefName,7,0);
setCharacterObject("spine_01 ",$characterDefName,8,0);
setCharacterObject("upperarm_l ",$characterDefName,9,0);
setCharacterObject("lowerarm_l ",$characterDefName,10,0);
setCharacterObject("hand_l ",$characterDefName,11,0);
setCharacterObject("upperarm_r ",$characterDefName,12,0);
setCharacterObject("lowerarm_r ",$characterDefName,13,0);
setCharacterObject("hand_r ",$characterDefName,14,0);
setCharacterObject("neck_01|neckUpper|head ",$characterDefName,15,0);
setCharacterObject("thumb_01_l ",$characterDefName,50,0);
setCharacterObject("thumb_02_l ",$characterDefName,51,0);
setCharacterObject("thumb_03_l ",$characterDefName,52,0);
setCharacterObject("index_01_l ",$characterDefName,54,0);
setCharacterObject("index_02_l ",$characterDefName,55,0);
setCharacterObject("index_03_l ",$characterDefName,56,0);
setCharacterObject("middle_01_l ",$characterDefName,58,0);
setCharacterObject("middle_02_l ",$characterDefName,59,0);
setCharacterObject("middle_03_l ",$characterDefName,60,0);
setCharacterObject("ring_01_l ",$characterDefName,62,0);
setCharacterObject("ring_02_l ",$characterDefName,63,0);
setCharacterObject("ring_03_l ",$characterDefName,64,0);
setCharacterObject("pinky_01_l ",$characterDefName,66,0);
setCharacterObject("pinky_02_l ",$characterDefName,67,0);
setCharacterObject("pinky_03_l ",$characterDefName,68,0);
setCharacterObject("thumb_01_r ",$characterDefName,74,0);
setCharacterObject("thumb_02_r ",$characterDefName,75,0);
setCharacterObject("thumb_03_r ",$characterDefName,76,0);
setCharacterObject("index_01_r ",$characterDefName,78,0);
setCharacterObject("index_02_r ",$characterDefName,79,0);
setCharacterObject("index_03_r ",$characterDefName,80,0);
setCharacterObject("middle_01_r ",$characterDefName,82,0);
setCharacterObject("middle_02_r ",$characterDefName,83,0);
setCharacterObject("middle_03_r ",$characterDefName,84,0);
setCharacterObject("ring_01_r ",$characterDefName,86,0);
setCharacterObject("ring_02_r ",$characterDefName,87,0);
setCharacterObject("ring_03_r ",$characterDefName,88,0);
setCharacterObject("pinky_01_r ",$characterDefName,90,0);
setCharacterObject("pinky_02_r ",$characterDefName,91,0);
setCharacterObject("pinky_03_r ",$characterDefName,92,0);
}
UE4JointSetToHumanIK()
Python のsetCharacterObjectはないみたい。mel.evalで呼ぶこともできるかなあ。
ちょっとめんどいのでまた今度。
UE4ジョイントが二つあった場合にうまく動かないのでフルパスに更新予定
//以下調べもの用
HumanIKをコマンドで操作する
https://qiita.com/amanatsu-knit/items/8c66297b012d74f7438a
whatIs hikCreateCharacter;
whatIs setCharacterObject;
C:/Program Files/Autodesk/Maya2016/scripts/others/hikGlobalUtils.mel
[MEL] 戻り値を配列で返す
なぜかずっと出来ないと思っていた、
プロシージャの戻り値を配列で返す方法。
以下サンプル。
proc string[] sample(string $param[])
{
string $return[];
for ($i = 0 ; $i < size($param) ; $i++)
{
$return[$i] = “Re_”+$param[$i];
}
return $return;
}
sample({“aaa”,”bbb”,”ccc”});
// Result: Re_aaa Re_bbb Re_ccc //
//HumanIKのコントローラー番号
for($i = 0; $i < 212; $i++)
{
$HIKname = GetHIKNodeName($i);
print ($i + ” :” + $HIKname + “\n”);
};
0 :Reference
1 :Hips
2 :LeftUpLeg
3 :LeftLeg
4 :LeftFoot
5 :RightUpLeg
6 :RightLeg
7 :RightFoot
8 :Spine
9 :LeftArm
10 :LeftForeArm
11 :LeftHand
12 :RightArm
13 :RightForeArm
14 :RightHand
15 :Head
16 :LeftToeBase
17 :RightToeBase
18 :LeftShoulder
19 :RightShoulder
20 :Neck
21 :LeftFingerBase
22 :RightFingerBase
23 :Spine1
24 :Spine2
25 :Spine3
26 :Spine4
27 :Spine5
28 :Spine6
29 :Spine7
30 :Spine8
31 :Spine9
32 :Neck1
33 :Neck2
34 :Neck3
35 :Neck4
36 :Neck5
37 :Neck6
38 :Neck7
39 :Neck8
40 :Neck9
41 :LeftUpLegRoll
42 :LeftLegRoll
43 :RightUpLegRoll
44 :RightLegRoll
45 :LeftArmRoll
46 :LeftForeArmRoll
47 :RightArmRoll
48 :RightForeArmRoll
49 :HipsTranslation
50 :LeftHandThumb1
51 :LeftHandThumb2
52 :LeftHandThumb3
53 :LeftHandThumb4
54 :LeftHandIndex1
55 :LeftHandIndex2
56 :LeftHandIndex3
57 :LeftHandIndex4
58 :LeftHandMiddle1
59 :LeftHandMiddle2
60 :LeftHandMiddle3
61 :LeftHandMiddle4
62 :LeftHandRing1
63 :LeftHandRing2
64 :LeftHandRing3
65 :LeftHandRing4
66 :LeftHandPinky1
67 :LeftHandPinky2
68 :LeftHandPinky3
69 :LeftHandPinky4
70 :LeftHandExtraFinger1
71 :LeftHandExtraFinger2
72 :LeftHandExtraFinger3
73 :LeftHandExtraFinger4
74 :RightHandThumb1
75 :RightHandThumb2
76 :RightHandThumb3
77 :RightHandThumb4
78 :RightHandIndex1
79 :RightHandIndex2
80 :RightHandIndex3
81 :RightHandIndex4
82 :RightHandMiddle1
83 :RightHandMiddle2
84 :RightHandMiddle3
85 :RightHandMiddle4
86 :RightHandRing1
87 :RightHandRing2
88 :RightHandRing3
89 :RightHandRing4
90 :RightHandPinky1
91 :RightHandPinky2
92 :RightHandPinky3
93 :RightHandPinky4
94 :RightHandExtraFinger1
95 :RightHandExtraFinger2
96 :RightHandExtraFinger3
97 :RightHandExtraFinger4
98 :LeftFootThumb1
99 :LeftFootThumb2
100 :LeftFootThumb3
101 :LeftFootThumb4
102 :LeftFootIndex1
103 :LeftFootIndex2
104 :LeftFootIndex3
105 :LeftFootIndex4
106 :LeftFootMiddle1
107 :LeftFootMiddle2
108 :LeftFootMiddle3
109 :LeftFootMiddle4
110 :LeftFootRing1
111 :LeftFootRing2
112 :LeftFootRing3
113 :LeftFootRing4
114 :LeftFootPinky1
115 :LeftFootPinky2
116 :LeftFootPinky3
117 :LeftFootPinky4
118 :LeftFootExtraFinger1
119 :LeftFootExtraFinger2
120 :LeftFootExtraFinger3
121 :LeftFootExtraFinger4
122 :RightFootThumb1
123 :RightFootThumb2
124 :RightFootThumb3
125 :RightFootThumb4
126 :RightFootIndex1
127 :RightFootIndex2
128 :RightFootIndex3
129 :RightFootIndex4
130 :RightFootMiddle1
131 :RightFootMiddle2
132 :RightFootMiddle3
133 :RightFootMiddle4
134 :RightFootRing1
135 :RightFootRing2
136 :RightFootRing3
137 :RightFootRing4
138 :RightFootPinky1
139 :RightFootPinky2
140 :RightFootPinky3
141 :RightFootPinky4
142 :RightFootExtraFinger1
143 :RightFootExtraFinger2
144 :RightFootExtraFinger3
145 :RightFootExtraFinger4
146 :LeftInHandThumb
147 :LeftInHandIndex
148 :LeftInHandMiddle
149 :LeftInHandRing
150 :LeftInHandPinky
151 :LeftInHandExtraFinger
152 :RightInHandThumb
153 :RightInHandIndex
154 :RightInHandMiddle
155 :RightInHandRing
156 :RightInHandPinky
157 :RightInHandExtraFinger
158 :LeftInFootThumb
159 :LeftInFootIndex
160 :LeftInFootMiddle
161 :LeftInFootRing
162 :LeftInFootPinky
163 :LeftInFootExtraFinger
164 :RightInFootThumb
165 :RightInFootIndex
166 :RightInFootMiddle
167 :RightInFootRing
168 :RightInFootPinky
169 :RightInFootExtraFinger
170 :LeftShoulderExtra
171 :RightShoulderExtra
172 :
173 :
174 :
175 :
176 :
コメント