RE: [script] Nested XSICollections
| Date : Wed, 9 May 2007 16:30:14 -0400 |
| To : <XSI(at)Softimage.COM> |
| From : "Stephen Blair" <Stephen_Blair(at)Softimage.COM> |
| Subject : RE: [script] Nested XSICollections |
I would
expect the line oModelColl = eModelColls.item() to return a XSICollection, but
it seem not....
Probably returning a CollectionItem.
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Bernard Lebel
Sent: Wed 09 May 2007 4:09 PM
To: XSI(at)Softimage.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: "Bernard Lebel" <3dbernard(at)gmail.com>
- Re: [script] Nested XSICollections
- References:
- [script] Nested XSICollections
- From: "Bernard Lebel" <3dbernard(at)gmail.com>
- [script] Nested XSICollections
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: RE: [script] Nested XSICollections
- Next by Date: RE: [script] Nested XSICollections
- Previous by Thread: RE: [script] Nested XSICollections
- Next by Thread: RE: [script] Nested XSICollections
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |