I have an if statement that I want to use to see if the object is selected or the polygon face is selected, when I use the right click menu to switch to face mode it appears to mess up the -q -polymeshFace and it will return true even though I'm in object mode. Does anyone know how to reliably query if you have faces selected or objects selected.
Hey so I figured this out with some help from my friend at work. One reliable way to query if you have a face selected or not is to use gmatch. This is the code that works for me.
Right click the button on the shelf you want to change and choose open.
At the far right of icon name you can click the Maya icon and browse all
the icons Maya comes with, if you want to use a custom icon from your
desktop you can click the folder beside Maya icon. If you want no icon
at all you could make a 32x32 pixel png that has no background so it
will be 100% transparent when you load it into Maya.
Another way you can do this is by using filterExpand
//this gets the faces that are selected - 34 is the filter code for faces<br>string $selectionFaces[] = `filterExpand -sm 34`; <br><br>//test to see if faces are selected<br>if ( size($selectionFaces) == 0 ) {<br> print "no faces selected";<br>}
Replies
if(`gmatch $maArray[0] "*.f*"`)
{
print "Some faces selected";}
else
{
print "No faces selected";
}Need some help I want to remove the Maya Icon from my script how to replace or remove it.
https://help.autodesk.com/cloudhelp/2015/CHS/Maya-Tech-Docs/Commands/filterExpand.html