[script] Nested XSICollections
| Date : Wed, 9 May 2007 16:09:29 -0400 |
| To : XSI(at)Softimage.COM |
| From : "Bernard Lebel" <3dbernard(at)gmail.com> |
| Subject : [script] Nested XSICollections |
Anyone ever had troubles with nested XSICollections?
I have this piece of code:
var oModels = XSIFactory.createobject( "XSI.Collection" );
var oObject, sObjectName, oModel, sModelName, oModelColl, oObjectColl, eModelColls, bNew, oGroup, sGroupName, i, iCount;
// Enumerate selected objects
for( var eSel = new Enumerator( selection ); !eSel.atEnd(); eSel.moveNext() )
{
oObject = eSel.item();
sObjectName = oObject.name;
// Check if object is a model
if( oObject.type == siModelType )
{
//logmessages( '< ts_CreateCTRLGroup > :: Object "' + oObject.fullname + '" is a model, skipped.', siWarning );
}
else
{
oModel = oObject.model;
sModelName = oModel.fullname;
bExists = false;
// Check if this model has been collected
iCount = oModels.count;
if( iCount < 1 )
{
// Create a new collection for this model
oModelColl = XSIFactory.createobject( "XSI.Collection" );
// Create collection where only the current object will be put
oObjectColl = XSIFactory.createobject( "XSI.Collection" );
oModelColl.items = oModel;
oObjectColl.items = oObject;
// Add the object collection after the model object, in the model collection
oModelColl.add( oObjectColl );
// Store this entire model collection in the main collection
oModels.add( oModelColl );
}
else
{
bNew = true;
// Enumerate the model collections
for( eModelColls = new Enumerator( oModels ); !eModelColls.atEnd(); eModelColls.moveNext () )
{
// Get single model collection
oModelColl = eModelColls.item();
logmessage( oModelColl.items );
if( oModelColl(0).fullname == sModelName )
{
}
}
if( bNew == true )
{
// Create a new collection for this model
oModelColl = XSIFactory.createobject( "XSI.Collection" );
// Create collection where only the current object will be put
oObjectColl = XSIFactory.createobject( "XSI.Collection" );
oModelColl.items = oModel;
oObjectColl.items = oObject;
// Add the object collection after the model object, in the model collection
oModelColl.add( oObjectColl );
// Store this entire model collection in the main collection
oModels.add( oModelColl );
}
}
}
}
The problematic lines are marked with a // BIG PROBLEMS notation.
The first one, logmessage( oModelColl.items ); prints an empty string.
The second raises an error: //ERROR : Object not a collection - [line 78]
I would expect the line oModelColl = eModelColls.item() to return a XSICollection, but it seem not....
Any suggestion?
Thanks
Bernard
- Follow-Ups:
- RE: [script] Nested XSICollections
- From: "Stephen Blair" <Stephen_Blair(at)Softimage.COM>
- RE: [script] Nested XSICollections
- From: "Serguei Kalentchouk" <serguei.kalentchouk(at)ubisoft.com>
- RE: [script] Nested XSICollections
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: SSS-split 6.01
- Next by Date: SSS-split 6.01
- Previous by Thread: SSS-split 6.01
- Next by Thread: SSS-split 6.01
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |