1.
I need to check whether the user has a polygon mesh selected, then complete an if/else
statement with this info.

If, the user has a polygon mesh selected => execute script...
(it must be selected at object level, no faces etc)

Else, Dialogue warning window appears "Please Select Mesh".

2.
I have declared a selection variable at the start of my script...
How do I use this variable inside a procedure later on??

cheers
Sebwah

pgraham

11 November 2006, 06:28 PM

$theMeshes=`ls -sl -type mesh`;This will give you a list of all poly meshes selected. The mesh nodes must be selected, not the transform node containing the mesh. $theSelection=`ls -sl`;
$theMeshes=`listRelatives -allDescendents -type mesh $s`;This will give you all the poly meshes that are descendents of the selected nodes. It's probably the result you want.if(size(&theMeshes))
{
// do stuff
}
else{
// error message
}

grantimus

11 November 2006, 07:38 PM

There is an even easier way to do it:

$sel = `filterExpand -sm 12`;

if(size($sel)){
//stuff to do if polygon meshes are selected
} esle {
//stuff to do if polygon meshes aren't selected
}

ok so maybe it's only one less line of code, but that still means less typing.

sebwah

11 November 2006, 09:54 AM

...it's always so easy when you see it written!
thanks

CGTalk Moderation

11 November 2006, 09:54 AM

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.

Follow Us On:

The CGSociety

The CGSociety is the most respected and accessible global organization for creative digital artists. The CGS supports artists at every level by offering a range of services to connect, inform, educate and promote digital artists worldwide. More about us on TheArtSociety.com