Re: Eliptical filtering for all textures?

Date : Fri, 16 Feb 2007 15:48:35 +0100
To : XSI(at)Softimage.COM
From : André Adam <a_adam(at)49games.de>
Subject : Re: Eliptical filtering for all textures?
Oh my god, you took that comment thing serious! ;)

No, really, I think the find objects / collection approach is a very elegant solution. It's just that I'm running with scripts through character hierachies all day, therefore my first idea always ends up to be traversing the scene graph...

Cheers!

   -André


Bernard Lebel wrote:
Yeah sorry, I slapped this together quickly before going to work this morning.
Here is a commented version:


// Create collection to store Image shaders as well as Bumpmap_generators
var oColl = XSIFactory.CreateObject( "XSI.Collection" );

// Use the AddItems method to populate the collection.
// The nice thing with AddItems is that even if the the return value
of FindObjects is null,
// no error is raised. Nothing gets added to the collection, simply.

// Run FindObjects to get Image shaders by their ClassID, and add them
to the collection
oColl.additems( findobjects( null, "{1C500B61-023C-11D3-8C03-00A0243E3672}" ) );


// Run FindObjects to get Bumpmap_generator shaders by their ClassID,
and add them to the collection
oColl.additems( findobjects( null, "{B6B3EE80-FAAE-11D3-AE5D-00A0C96E63E1}" ) );


// Enumerate found shaders
for( var e = new Enumerator( oColl ); !e.atEnd(); e.moveNext() )
{
// Enable the bump_filtered parameter, which both types of shader have
e.item().parameters( "bump_filtered" ).value = 1;
// Check if the shader has a filtered parameter, Bumpmap_generator does not
// If found, then enable the parameter
if( e.item().parameters( "filtered" ) != null )
e.item().parameters( "filtered" ).value = 1;
}



You can find the classID of a shader by looking at its SPDL, the top line "reference" is what you want. Btw I'm not aware that you can find parameters with FindObjects. In this case I look for shader objects.



Cheers
Bernard



On 2/16/07, André Adam <a_adam(at)49games.de> wrote:
Parameter GUIDs! Certainly faster, perhaps a little bit too cryptic for
my personaly taste -hmm- nahh, that's what comments are for... ;)

Cheers!

    -André


Bernard Lebel wrote:
> Another approach (perhaps faster):
>
> var oColl = XSIFactory.CreateObject( "XSI.Collection" );
> oColl.additems( findobjects( null,
> "{1C500B61-023C-11D3-8C03-00A0243E3672}" ) );
> oColl.additems( findobjects( null,
> "{B6B3EE80-FAAE-11D3-AE5D-00A0C96E63E1}" ) );
>
> for( var e = new Enumerator( oColl ); !e.atEnd(); e.moveNext() )
> {
> e.item().parameters( "bump_filtered" ).value = 1;
> if( e.item().parameters( "filtered" ) != null )
> e.item().parameters( "filtered" ).value = 1;
> }
>
>
>
> Cheers
> Bernard
>
>
>
> On 2/16/07, Alexander Hemery <vortex(at)fhw.gr> wrote:
>> Yeah this will do! thanks alot André ;)
>>
>> Alex.
>>
>>
>> ----- Original Message -----
>> From: "André Adam" <a_adam(at)49games.de>
>> To: <XSI(at)Softimage.COM>
>> Sent: Friday, February 16, 2007 1:04 PM
>> Subject: Re: Eliptical filtering for all textures?
>>
>>
>> > Hi Alexander,
>> >
>> > this works for me, though I'm a little bit unsure if the ProgID is a
>> > foolprove way of identifiying Image nodes. Anyone knows if this is
>> always
>> > unique for a certain type of shader? Especially the *.1 at the end
>> of the
>> > string looks somewhat suspicious to me, though it works for my
>> quick test
>> > setup.
>> >
>> > Hope that helps...
>> >
>> > -André
>> >
>> >
>> > var eLibs = new
>> Enumerator(ActiveProject.ActiveScene.MaterialLibraries);
>> > while(!eLibs.atEnd()){
>> > var eMats = new Enumerator(eLibs.item().Items);
>> > while(!eMats.atEnd()){
>> > var eShaders = new
>> > Enumerator(eMats.item().FindShaders(siShaderFilter));
>> > while(!eShaders.atEnd()){
>> > if(eShaders.item().ProgID == "Softimage.txt2d-image-explicit.1"){
>> > //LogMessage(eShaders.item());
>> > eShaders.item().Parameters("filtered").Value = true;
>> > eShaders.item().Parameters("bump_filtered").Value = true;
>> > }
>> > eShaders.moveNext();
>> > }
>> > eMats.moveNext();
>> > }
>> > eLibs.moveNext();
>> > }
>> >
>> >
>> > Alexander Hemery wrote:
>> >> morning everyone..
>> >> Is there a quick way to switch eliptical filtering ON for all
>> textures
>> >> in a scene?
>> >> I'm looking at x3dObject.FindChildren and
>> siTextureShaderFamily...but I
>> >> can't make it work..
>> >> I want to access and change the values of *.Image.filtered &
>> >> *.Image.bump_filtered with a for each loop.
>> >> Cheers!
>> >> Alex.

--- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi


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.