Re: Getting shader parameter type

Date : Wed, 24 Jan 2007 16:46:22 +0100
To : <XSI(at)Softimage.COM>
From : "Daniel Rind" <daniel.rind(at)chello.at>
Subject : Re: Getting shader parameter type
Yup that did it, thanks a lot. Quite a lot of shader parameter types I've never encountered in there o_O
 
Anyway, rendertree translation is working - now I just have to code Gelato replacement shaders for all XSI shaders. Oh joy.
 
Having Gelato render in one window and mental ray in the other is really cool =)
 
Ciao, Daniel!
----- Original Message -----
Sent: Tuesday, January 23, 2007 11:15 PM
Subject: RE: Getting shader parameter type

Check out siShaderParameterType Shader::GetShaderInputType instead.

 

 - ½

 


From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Daniel Rind
Sent: 23-Jan-07 16:56
To: XSI(at)Softimage.COM
Subject: Getting shader parameter type

 

Hi!

 

I'm currently writing code to walk XSI shader graphs, and I'm having a little problem with shader parameter types:

 

What is the correct way to retrieve the parameter type of a shader's input parameters?

 

I'm currently trying it with something like:

 

Shader current_shader(...);

 

CParameterRefArray shader_params = current_shader.GetParameters();

 

for (int i = 0; i < shader_params.GetCount(); i++)

{

  Parameter current_parameter(shader_params[i]);

 

  switch (current_parameter.GetValueType())

  {

  case siFloat:

    ...

  case siString:

    ...

  }

}

 

which works only sort of...

 

Color and Vector shader parameters are always siEmpty (so I go probing if the parameter contains further parameters, and then check those), but if I connect another shader to a parameter, the GetValueType always returns siRef (who had the idea to assign 666 to that :P), and I can't find out if it's a float or a color or whatever.

 

I'm sure there is some simple GetParameterType() function that I'm missing, that returns if it's a color, a vector, an int, etc... no matter if anything is connected to it or not... or at least I hope there is?

 

Ciao, Daniel!


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.