一些重要的mel命令

时间:2023-03-09 07:56:47
一些重要的mel命令
一些重要的mel命令

查询多边形顶点

  1. xform -q -worldSpace -t "pCylinderShape1.vtx[0]"

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


自定义命令的注意事项

flag的短名称必须全部小写