Script : Collection freeze selection.

Date : Sun, 2 Oct 2005 21:26:59 +0200
To : XSI(at)Softimage.COM
From : guillaume laforge <guillaume.laforge.3d(at)gmail.com>
Subject : Script : Collection freeze selection.
Hi,
 
I've got a pb in this script with a collection. The script log the correct result in the script editor (and no errors) but it freeze the selection in the scene (explorer or viewport).
I'm sure it's a newbie error because it's not the first time it's happen to me.
 
Here is a sample of the script :
 

//Two collections. First one store the good models and the other one the objects under those models.
var oModelKind = XSIFactory.CreateObject ("XSI.Collection");
var oKind = XSIFactory.CreateObject (" XSI.Collection");

//Run a function who search all the models with a CPset named "Character" and add them to oModelKind.
FindKind("Character",oModelKind)

//Then I want to find all the polymesh under those models stored in the oModelKind collection.
for(var en = new Enumerator( oModelKind ); !en.atEnd(); en.moveNext() )
{
var oModel = en.item();
var oPolies = oModel.findchildren( "", siPolyMeshType, null, true );
oKind.add(oPolies);
}

// It works in the History log but not in the scene. It freeze the selection. Why ?
SelectObj(oKind);


//Function to store models with a specific CPset. The inputs are the name of the CPset and name of the collection to add the models.
function FindKind(Kind,ModelKind)
{
//Find all the models.
var oModels = activesceneroot.findchildren( "", siModelType, null, true );
//Put the models of good "kind" in the collection.
for ( var en = new Enumerator( oModels ); !en.atEnd(); en.moveNext() )
{
var oModel = en.item();
var oPSet = oModel.Properties((Kind));
if (oPSet)
{
oModelKind.add(oModel);
}
}
}

Any idea ?

Cheers,

Guillaume Laforge

PS : Sorry for the bad formatting in the script. I must instal firefox on my laptop someday. IE is not very friendly with Gmail :-/


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.