一些重要的mel命令
xform -q -worldSpace -t "pCylinderShape1.vtx[0]"
设置顶点坐标
xform -objectSpace -t $x $y $z "pCylinderShape1.vtx[0]"
获取多边形的信息
// query the number of faces
polyEvaluate -f;
// Result: 16
// query the number of triangles
polyEvaluate -t;
// Result: 32
// query the number of selected faces
polyEvaluate -faceComponent;
// Result: 2
// query the number of vertices and faces
polyEvaluate -v -f;
// Result: 25 16
// formatted query of the number of vertices and faces
polyEvaluate -v -f -fmt;
// Result: vertex=25 face=16
获取某个节点的连接信息
// List all connections to BALL
string $list[] = `listConnections BALL`;
// List only incoming connections from BALL.tx
listConnections -d off -s on BALL.tx;
// List connections from BALL to nodes of type 'transform'
listConnections -t transform;
// List connections on BALL, ignoring unit conversion nodes
listConnections -scn on BALL;
创建、取消节点连接
// Connect the translation of two nodes together
connectAttr firstGuy.t secondGuy.translate;
// Connect the rotation of one node to the override colour
// of a second node.
connectAttr firstGuy.rotate secondGuy.overrideColor;
// Break the connection between the rotate attributes.
//
disconnectAttr ($sph[0] + ".r") ($con[0] + ".r");
由变换节点获得形状节点
$shapes = `listRelatives -shapes pCylinder1`;
// List the name of the shape below the transform node.
// (The result of the command is shown)
string $shapes[] = `listRelatives -s -path "nexus"`;
// Result: nexus|nexusShape //
粒子系统相关命令
clearParticleStartState $ptclShape; // 把粒子的初始状态设为空,也就是清除所有粒子
emit -object $ptclShape -pos $x $y $z; // 往粒子系统添加粒子
saveInitialState $ptclShape; // 把当前状态设置为初始状态
自定义命令的注意事项
flag的短名称必须全部小写