cazanerd
cazanerd

Reputation: 21

AttrFieldSliderGrp command used in MEL/Python in Maya

I wanna move the edge of 3D object with a slider in Maya UI.

Is it possible to move any component (vertex, edge or face) but not the whole object with the attrFieldSliderGrp command using -at flag?

Thank you for your help.

Upvotes: 2

Views: 709

Answers (1)

Andy Jazz
Andy Jazz

Reputation: 58493

Using AttrFieldSliderGrp command you can translate a vertex:

window -title "Sliders for moving a vertex";
    polySphere;
    string $sphere[] = `select -r pSphere1.vtx[199]`;
    columnLayout;
    attrFieldSliderGrp -min -5.0 -max 5.0 -at ($sphere[0]+".pntx");
    attrFieldSliderGrp -min -5.0 -max 5.0 -at ($sphere[0]+".pnty");
    attrFieldSliderGrp -min -5.0 -max 5.0 -at ($sphere[0]+".pntz");
showWindow;

enter image description here

But you can't translate edges and faces with AttrFieldSliderGrp command because there are no tx, ty and tz attributes for them. Nonetheless, there are polyMoveEdge and polyMoveFacet (cmds.polyMoveEdge() and cmds.polyMoveFacet()) commands for moving edges and faces via MEL and Python:

polySphere -name myEdges;
select myEdges.e[199];
polyMoveEdge -t 2.0 1.0 0.7 myEdges.e[199];

polySphere -name myFaces;
select myFaces.f[200:201];
polyMoveFacet -t 1.8 0.8 1.1 myFaces.f[200:201];

Upvotes: 1

Related Questions