View Full Version : scriptJob events

12-22-2003, 01: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.


12-22-2003, 06: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];
print $newSelection; //will show you the new elements. But is not required

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

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

:: Galactor ::

12-23-2003, 09: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:

12-23-2003, 09: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.

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

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

12-23-2003, 11: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:


CGTalk Moderation
01-17-2006, 12:00 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.