获取变换、形状和历史节点

创建对象时,会创建变换节点、形状节点和历史节点等。选择对象,您将看到横跨“属性编辑器”(Attribute Editor)顶部的选项卡显示这些节点。

如果使用 MEL 创建对象;例如:

string $plane[] = `polyPlane`;

脚本编辑器的顶部选项卡将显示以下结果:

// Result: pPlane1 polyPlane1 // 

换句话说,$plane[0] 指向 pPlane1(变换节点),$plane[1] 指向 polyPlane1(历史节点)。

形状节点是变换节点的子节点。在这种情况下,形状节点将是 pPlaneShape1

若要从其变换节点获取形状节点,请使用 listRelatives 命令:

{
//Lists the transform nodes of all selected objects in the scene
string $nodes[] = `ls -selection`;

for ($node in $nodes)
{
//From each transform node, obtain its shape node and print its name
string $shapes[] = `listRelatives -shapes $node`;
print $shapes;
}
}

相关主题