better stated: certain parameter name, not value, apologies, running behind on sleep, words are challenging.
The slowness is coming from using the Tag() command. Try using the object model to cut out the middle man:
// Jscript
main();
function main()
{
var oItems = ActiveSceneRoot.FindChildren2();
LogMessage( oItems.Count );
for ( var i = oItems.Count - 1; i >= 0; i--) {
var oItem = oItems(i);
var oParameter = oItem.Properties( "Visibility" ).Parameters( "viewvis" );
oParameter.Tags = siTagNone;
}
return;
}
If the parameters you are attempting to modify have a large degree of consistency in name and location, you can use some of Softimage’s wildcards to find them faster:
var oParameters = XSIFactory.CreateActiveXObject( “XSI.Collection” );
oParameters.Unique = true;
// Get viewvis and rendvis parameters of the visibility property on each X3DObject
oParameters.items = “*.visibility.{viewvis,rendvis}”;
LogMessage( oParameters.Count );
If there is a large degree of consistency in the parameter fullname, you can apply values to the parameters en masse very efficiently:
SetValue( “*.visibility.{viewvis,rendvis}", false );
Matt
coll = XSIFactory.CreateObject('XSI.Collection') coll.SetAsText('*.visibility.*') valueDict = dict([(x.FullName,x.Value) for x in coll]) print valueDict
Actually, it'll be faster if we change the [] to a () so it's a generator instead of a full loop. My bad. I need coffee.
coll = XSIFactory.CreateObject('XSI.Collection') coll.SetAsText('*.visibility.*')
valueDict = dict(((x.FullName,x.Value) for x in coll)) print valueDict
Retrieving the value is the same. If you use the object model you’ll have direct access to the parameter whether it’s the tag or the value. Just switch “oParameter.Tags” with “oParameter.value” in my example and you have your answer.
If you’re looking to retrieve a specific value, or parameters with a common value, then you have no choice but to loop through all of them and do comparisons to find what you’re looking for. In your case using the other notation with wildcards is only useful if you’re setting a set of parameters to a common value.
coll = XSIFactory.CreateObject('XSI.Collection') coll.SetAsText('*.visibility.*') valueDict = dict(((x.FullName,x.Value) for x in coll)) print valueDict
Interesting how much choice of language affects performance.
In your tests the Object model has the same runtime as calling commands. On my computer using Jscript, the object model is at least 4x faster than calling Tag() command.