SOLVED
CComAPIHandler
objСollection;
// create Automation handler (ow: C++ ActiveX object
representation)
objСollection.CreateInstance( L"XSI.Collection");
// create via this handler empty instance of
"Collection" object from "XSI" application
objСollection.PutProperty(L"Items", CValue(L".[obj]."));
// <!> put to this collection a tricky property
".[obj]."
// this property do the trick. it get active objects even if
there is no comps selected.
LONG
objСollectionCount( objСollection.GetProperty(L"Count") );
// get number of objects in created Collection
Application().LogMessage(L"objСobjСollectionCount: " +
CValue(objСollectionCount).GetAsText());
for ( LONG j=0;
j<objСollectionCount; j++ )
{
CValue
rtn; // output from the Item property
CValueArray
idx; idx.Add(j); // set the index to use
objСollection.Invoke( L"Item", CComAPIHandler::PropertyGet, rtn, idx );
// From the
CRef class, we can convert it to the actual class
CRef itm(rtn);
LONG clasID =
itm.GetClassID();
Application().LogMessage( L"clasID: " + CValue(clasID).GetAsText() );
// printout classID index of item in collection
// if its an
object
if (
itm.GetClassID() == siX3DObjectID )
{
X3DObject
curObj = X3DObject(itm); // reconstruct Object instance
Application().LogMessage( L"Found active obj: " + curObj.GetFullName()
); // pintout obj name
}
}
------
Softimage Mailing List.
To unsubscribe, send a mail to [email protected] with
"unsubscribe" in the subject, and reply to confirm.