that was the boy.
Thanks, Stephen.
_____
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of
Stephen Blair
Sent: 11 July 2005 17:54
To: XSI(at)Softimage.COM
Subject: RE: Collection as argument to cpp plugin command.
Try treating args[0] as a CValueArray, e.g.:
Worked for me.
XSIPLUGINCALLBACK CStatus NewCommand_Execute( CRef& in_ctxt )
{
Context ctxt( in_ctxt );
CValueArray args = ctxt.GetAttribute(L"Arguments");
CValueArray oObjectCollection = args[0];
for ( long i=0; i<oObjectCollection.GetCount(); i++ ) {
CRef ref( oObjectCollection[i] );
if ( ref.IsA( siSIObjectID ) ) {
Application().LogMessage( L"siSI" );
}
if ( ref.IsA( siX3DObjectID ) ) {
Application().LogMessage( L"siX3SI" );
}
}
return CStatus::OK;
}
-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of
kim aldis
Sent: Mon 11 July 2005 11:58 AM
To: XSI(at)Softimage.COM
Subject: Collection as argument to cpp plugin command.
Any of you cpp heads out there spot anything obviously wrong with the way
I'm trying to get a collection as the first argument to the snippet below.
It's a self-installing plugin, just comes back with zero as the count.I hand
it the selection from Jscript. help appreciated. :--
XSIPLUGINCALLBACK CStatus CGS_Test_Execute( CRef& in_ctxt )
{
Context ctxt( in_ctxt );
CValueArray args = ctxt.GetAttribute(L"Arguments");
CRefArray oObjectCollection = args[0];
for ( long i=0; i<oObjectCollection.GetCount(); i++ ) {
CRef ref( oObjectCollection[i] );
if ( ref.IsA( siSIObjectID ) ) {
Application().LogMessage( L"siSI" );
}
if ( ref.IsA( siX3DObjectID ) ) {
Application().LogMessage( L"siX3SI" );
}
}
<mailto:kim(at)cg-soup.com> kim(at)cg-soup.com
kim(at)aldis.org.uk
<<attachment: winmail.dat>>