I forgot to address your original question.

In your first example, LogMessage( point ) will normally call the object's 
'.Name' or .FullName property, but if it doesn't have one, it prints the 
class name. That's why it outputs "Vertex".  In your latter example, you're 
attempting to print an entire collection which in turn invokes the 
collection's .GetAsText() method.  That is why you get the output 
'Biped_Nulls.Man.pnt[1044]'.  In short, you are not getting proper handles 
on the objects before you try to work with them.

Try getting into the habit of using the .Type property and ClassName() to 
print the object's class name so you have an idea of what you're working 
with before you do stuff with them.  The Class Name is what you want when 
looking up details in the SDK manual.  You can also get the class name using 
the SDK Explorer.  This will help put it all together when using the 
Scripting Object Model.

var oItem = Selection(0);

LogMessage( "Type: " + oItem.Type );
LogMessage( "Class: " + ClassName( oItem ) );

or alternately, most objects in the Softimage SDK have an .IsClassOf() 
method which can get the same information as calling ClassName().  the 
difference is ClassName() will return the name of the class as a string, 
.IsClassOf() will compare the specified class ID to the class ID of the 
object calling the method and return true if they match, false otherwise.

if ( oItem.IsClassOf( siCollectionItemID ) ) {
    LogMessage( "It's a CollectionItem" );
}

// output
// Type: pntSubComponent
// Class: CollectionItem
// It's a CollectionItem

from this information, you look up "CollectionItem" in the SDK manuals to 
know what properties and methods are available.


If you're writing a tool to work with envelope weights, I suggest creating a 
command as a self installing plugin with the first input argument defined as 
a collection (siArgHandlerCollection).  This tells Softimage to treat all 
incoming data presented as the first argument as if it were an 
XSICollection.  If it's not a collection, try to convert it to be a 
collection.  If the argument is not provided by the caller, then the 
selection list will be used instead.  This ensures the data your code 
receives is consistent and uniform to make error checking and validation 
much simpler.  It also gives you flexibility to create your own extensions 
to the Softimage SDK for low level operations such as filtering data.  If 
that doesn't work, another technique I often employ is to call SIFilter() to 
filter the incoming collection so only the type of subcomponents or classes 
I am expecting make it into the rest of my code.  If the output of the 
command is empty, then I know the input was invalid.


Matt




Date: Sun, 3 Apr 2016 01:22:14 +0900
From: Martin Yara <[email protected]>
Subject: Re: convert edge/poly collections to points
To: "[email protected]"
<[email protected]>

Thanks Matt for your detailed response. I'll need to read it again when I 
get to my office but I think I understand it a little better now.

About the tool I'm writing, It's a simple weight tool.

Martin
Sent from my iPhone

------
Softimage Mailing List.
To unsubscribe, send a mail to [email protected] with 
"unsubscribe" in the subject, and reply to confirm.

Reply via email to