I'm having trouble with a relatively simple script here, can I get some help?
It toggles a selection constraint for all or hard edges only.
the -q flag isn't documented for polySelectConstraint, but it works, and -sm returns an integer. But, Maya returns an error of:
Error: Cannot convert data of type int[] to type int.global proc tkToggleHardEdgeSelect()
{
int $CurMode = `polySelectConstraint -q -sm`;
if ($CurMode == "0")
{
polySelectConstraint -t 0x8000 -sm 1;
}
else if ($CurMode == "1")
{
polySelectConstraint -t 0x8000 -sm 0;
}
}
tkToggleHardEdgeSelect();
Replies
So just do something like this:
global proc tkToggleHardEdgeSelect()
{
int $CurMode[] = `polySelectConstraint -q -sm`;
if ($CurMode[0] == 0)
{
polySelectConstraint -t 0x8000 -sm 1;
}
else if ($CurMode[0] == 1)
{
polySelectConstraint -t 0x8000 -sm 0;
}
}
tkToggleHardEdgeSelect;
Error: "$CurMode" is not an array.
I don't think that's the case, "-q -sm" returns a single value of the current constraint of ede smoothness: 0,1 or 2.
Edit: actually, the command isn't working on it's own now. What could I have accidentally hit or done to change that now?
On:
polySelectConstraint -t 0x8000 -sm 1 -m 3;
Off:
polySelectConstraint -t 0x8000 -sm 0 -m 0;
But borders will also count as 'hard edges', and when you toggle it on all hard edges will automatically be selected. If you'd explain a bit more about what your trying to achieve would probably be able to help more.
And yeah, border edges are fine, this is just to speed up setting UV seams on hard edges. Selecting edges quickly can be difficult, maybe it's just my ATI card, looking to speed that process up at least.