Selection Constraint Mel

Selection Constraint Mel

Anonymous
Not applicable
2,315 Views
5 Replies
Message 1 of 6

Selection Constraint Mel

Anonymous
Not applicable

Hi ! Im trying to find the commands for the "Selection constraints" (Edge loop, edge ring, border,etc) which are at the modeling toolkit, in Maya 2018.

I want to make a Mel script to toggle between these ones with a single key.

 

If anyone knows it would be very helpful !

Thank you!

0 Likes
Accepted solutions (1)
2,316 Views
5 Replies
Replies (5)
Message 2 of 6

trs_andre
Collaborator
Collaborator

Hi!

In the script editor, in the History Menu, if you press "Echo All Commands", you will get the commands you are looking for when you change the Selection Constraint 😉

Hope it helps!

André Moreira

Game Developer / Technical Artist

LinkedIn

0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi there! Yes I have the commands ! What im looking for its how to check the state of the "Selection Constraint". 

For instance, I have this script for toggle between Transform Constraint

 

string $SlideStatus = `xformConstraint -query -type`;

if ($SlideStatus == "none") {
dR_DoCmd("slideEdge");
inViewMessage -smg "Slide Edge is On" -pos topCenter -bkc 0x00000000 -fade;
}

else if ($SlideStatus == "edge") {
dR_DoCmd("slideSurface");
inViewMessage -smg "Slide Surface is On" -pos topCenter -bkc 0x00000000 -fade;
}

else if ($SlideStatus == "surface") {
dR_DoCmd("slideOff");
inViewMessage -smg "Slide Transform is Off" -pos topCenter -bkc 0x00000000 -fade;
}

This works like a charm ! But now, I want to do the same with "Selection Constraint"

string $ConstraintStatus = `xformConstraint -query -type`;

if ($ConstraintStatus == "none") {
dR_DoCmd("selConstraintEdgeRing");
inViewMessage -smg "Constraint Edge Ring is On" -pos topCenter -bkc 0x00000000 -fade;
}

else if ($ConstraintStatus == "???????") {
dR_DoCmd("selConstraintOff");
inViewMessage -smg "Constraint is Off" -pos topCenter -bkc 0x00000000 -fade;
}

Im dont know how to check the status of the Selection Constraint (missing code at the ????) and even if this belongs to xformConstraint.

 

Hope now its more clear, im quite new at this!

 

Thank you for you answer!

Message 4 of 6

trs_andre
Collaborator
Collaborator
Accepted solution

I see!

I believe for Selection Constraint you should use polySelectConstraint

By running

polySelectConstraint -query -sts;

you can query the actual state.

It returns a rather long string but you should be able to filter it by flag.

 

Reference: https://help.autodesk.com/cloudhelp/2015/ENU/Maya-Tech-Docs/Commands/polySelectConstraint.html#flagt...

 

Hope it helps!

André Moreira

Game Developer / Technical Artist

LinkedIn

Message 5 of 6

Anonymous
Not applicable

Thank you ! It seems to be that! Now I have to figure it out how to make it work!

But flags seem to be right.

 

Thank you very much!

Message 6 of 6

rayx_dna_xem
Explorer
Explorer

-ringPropagation, -loopPropagation, -borderPropagation, -anglePropagation