PDA

View Full Version : scriptJob events


Jhavna
12-22-2003, 12:58 PM
I'm working on a small script to count the number of selected verts using

int $numVerts = 0;
string $selection [] = `ls -sl -fl -type float3`;

$numVerts = size($selection);

print ("num verts selected: " + $numVerts + "\n");


and attach it to a SelectionChanged scriptjob. It works fine, except I'd like to be able to detect when the user is in vertex mode for selection. Either that, or just count vert types regardless of selection..

Anyone know how I can determine the current selection mode or filter out verts from the selection? As selected edges are also counted by float3.

TIA

galactor
12-22-2003, 05:49 PM
proc getVertices(string $selection[])
{
string $newSelection[];
int $e = 0;

for ($i=0;$i<size($selection);$i++)
{
if (`match "\.vtx" $selection[$i]` == "\.vtx")
{
$newSelection[$e] = $selection[$i];
$e++;
}
}
print $newSelection; //will show you the new elements. But is not required
}

string $selection[] = `ls -sl -fl -type float3`;
getVertices($selection);

I would do it this way, see if it is usefull for you !

:: Galactor ::

Jhavna
12-23-2003, 08:12 AM
Thanks.. It works.. I was thinking of doing it that way, but I wasn't sure if there was a way of doing it that didn't involve the match command (i.e. just do it based on selection type)

Maybe I'll write it as a plugin... once I get my copy of Maya... Finally get rid of PLE :bounce:

misterdi
12-23-2003, 08:39 AM
Can't you use filterExpand to expand your selection and filtered it through its magic number?.

I believe vertex should be -sm 31,


int $numVerts = 0;
string $selection [] = `ls -sl`;
$selection = `filterExpand -sm 31 $selection`;

$numVerts = size($selection);

print ("num verts selected: " + $numVerts + "\n");


This will filter out everything else except the vertices.

Jhavna
12-23-2003, 09:03 AM
That also works. Thanks. Seems to be a little quicker too...

macaroniKazoo
12-23-2003, 10:37 AM
so how come you don't just turn on the poly display HUD? it tells you how many verts u have selected...

Jhavna
12-23-2003, 10:41 AM
Originally posted by macaroniKazoo
so how come you don't just turn on the poly display HUD? it tells you how many verts u have selected...

Possibly because I have been either too dumb or too blind to notice... :blush:

Thanks...

CGTalk Moderation
01-16-2006, 11:00 PM
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.