  | | | Getting partitions from passes | Getting partitions from passes 2004-06-16 - By Felix Gebhardt
Back Hehe, you're welcome. As I said there is a shorter way. I'm not shure if one can trust on the existance of the Partitions parameter, therefore the try-catch. Error checking does look much neater in JScript than in VBS. I envy that a bit.
Meaner, leaner:
try { var oParts = EnumElements( GetCurrentPass()+".Partitions" ); for(p=0; p<oParts.count; p++) { LogMessage(oParts(p)); } } catch(e) { LogMessage("For some weired reason there is no Partitions parameter"); }
Cheers, Felix
Bernard Lebel wrote: > Ahhh once again Felix saves the day. > > Code to check all passes (wich is what I needed to do): > // Get passes > var oPasses = EnumElements( "Passes.List" ); > > // Enumerate through passes > for( var oPassEnum = new Enumerator( oPasses ); !oPassEnum.atEnd(); > oPassEnum.moveNext() ) > { > // Get pass > var oPass = getvalue( oPassEnum.item() ); > > // Get pass elements > var oPassElems = EnumElements( oPass ) > > // Enumerate through pass elements > for( var oPassElemEnum = new Enumerator( oPassElems ); > !oPassElemEnum.atEnd(); oPassElemEnum.moveNext() ) > { > // Check if pass element is named "Partitions" (wich is the > partition collection) > if( oPassElemEnum.item().name == "Partitions" ) > { > // Get partition collection elements > var oPartitions = EnumElements( oPassElemEnum.item() ); > > // Enumerate through partition collection elements > for( var oPartsEnum = new Enumerator( oPartitions ); > !oPartsEnum.atEnd(); oPartsEnum.moveNext() ) > { > logmessage( oPartsEnum.item() ); > } > } > } > } > > Thanks > Bernard > > > > -- -- Original Message -- -- > From: "Felix Gebhardt" <gebhardt@(protected)> > To: <XSI@(protected)> > Sent: Wednesday, June 16, 2004 10:13 AM > Subject: Re: [Script -3511] Getting partitions from passes > > >> >> >> There is probably a more direct way to get to the Partitions parameter >> containing the actual Partitioncollection but this might get you going. >> >> var oPassstuff = EnumElements( GetCurrentPass() ) >> for(i=0; i<oPassstuff .count; i++) >> { >> if (oPassstuff(i).name == "Partitions") >> { >> var oParts = EnumElements( oPassstuff(i) ); >> for(p=0; p<oParts.count; p++) >> { >> LogMessage(oParts(p)); >> } >> } >> } >> >> Cheers, >> Felix >> >> >> Bernard Lebel wrote: >>> Hello, >>> >>> Sorry for the resend, but didn't get any answer. Is there a way to get >>> ALL the partitions from the pass? So far my code can collect the >>> backgroup partitions, but not additional ones under a pass. >>> >>> >>> // Get all passes >>> var oPasses = EnumElements( "Passes.List" ); >>> >>> // Enumerate through passes >>> for( var oPassEnum = new Enumerator( oPasses ); !oPassEnum.atEnd(); >>> oPassEnum.moveNext() ) >>> { >>> // Get pass >>> var oPass = getvalue( oPassEnum.item() ); >>> >>> // Get pass elements, returns collection >>> var oPassKids = EnumElements( oPass ); >>> >>> // Enumerate through children to find partitions >>> for( var oPassKidsEnum = new Enumerator( oPassKids ); >>> !oPassKidsEnum.atEnd(); oPassKidsEnum.moveNext() ) >>> { >>> // Big problem: only the background partitions seem to be >>> accessible. There is no way to get other partitions. >>> logmessage( oPassKidsEnum.item().fullname ); >>> } >>> } >>> >>> When I run this, I get this, even though I have additional partitions: >>> >>> //INFO : "Passes.Default_Pass.Partitions" >>> //INFO : "Passes.Default_Pass.Background_Objects_Partition" >>> //INFO : "Passes.Default_Pass.Background_Lights_Partition" >>> //INFO : "Passes.Default_Pass.RenderOptions" >>> //INFO : "Camera" >>> //INFO : "Passes.Default_Pass.EnvironmentShaderStack" >>> //INFO : "Passes.Default_Pass.OutputShaderStack" >>> //INFO : "Passes.Default_Pass.VolumeShaderStack" >>> //INFO : "Passes.Default_Pass.Name" >>> >>> >>> >>> I'm wondering what the heck is that Partitions object. I've run some >>> tests to find what it is, and seems to be a parameter. >>> >>> var oPartitions = dictionary.getobject( "Passes.Default_Pass.Partitions" >>> ); >>> logmessage( oPartitions.type ); >>> logmessage( classname(oPartitions) ); >>> logmessage( oPartitions.value ); >>> >>> Logs >>> >>> //INFO : "Partitions" >>> //INFO : "Parameter" >>> //INFO : "" >>> >>> >>> >>> Any suggestion to reliably get all partitions under a pass would be a >>> godsend. >>> >>> Thanks >>> Bernard >> >> --- >> Unsubscribe? Mail Majordomo@(protected) with the following text in >> body: unsubscribe xsi >> > --- > Unsubscribe? Mail Majordomo@(protected) with the following text in body: > unsubscribe xsi
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|
 |