MEL:如何选择特定IK手柄的末端效应器?

时间:2009-09-06 23:17:40

标签: maya mel

每当我通过MEL在Maya中创建一个新的IK控制柄时,它会根据场景中的内容创建一个名为“effector1”或“effector2”的终点效果器。我不想依赖末端效应器的自动名称,所以我想知道是否有办法:

a)在IK控制柄的创建时命名效应器,或

b)在MEL中选择特定IK控制柄的效应器。

非常感谢任何帮助 - 谢谢!

2 个答案:

答案 0 :(得分:3)

以下是如何获取和重命名名为ikHandle1的特定句柄的末端效应器:

string $ee = `ikHandle -q -endEffector ikHandle1`; 
// Result: effector1 //  
rename $ee "mynewname"; 
// Result: mynewname //

答案 1 :(得分:0)

我知道这已经很晚了,但我在kb的答案的帮助下制作了一个新剧本,根据已经命名的内容重命名。以防万一将来遇到这种情况。

//selects all IKHandles
select `ls -type ikHandle`;
//stores them in an array
string $handles[] = `ls -sl`;

//for each item in the array,
for($handle in $handles)
{
    //create a new name by adding "_effector" to the end
    string $newName = ($handle + "_effector");        
    //find the effector and store that name in a variable
    string $efName = `ikHandle -q -endEffector $handle`; 
    //rename the effector
    rename $efName $newName;

}

如果您不想重命名所有 IK控制柄,只需注释掉第一行代码,

select `ls -type ikHandle`;

选择要重命名的所有句柄并运行代码。