Object Hierarchy | Related C++ Class: ShaderParameter
ShaderParameter
v9.0 (2011)
This object is a specialization of the Parameter interface on a Shader. This interface also has its own
specialization for shader array parameters: ShaderArrayParameter.
Users should use ShaderParameter.DataType to
retrieve the parameter data type.
# # This example demonstrates how to access each shader parameter instantiated # on the specified shader and report its shader parameter type # from win32com.client import constants as si app = Application app.NewScene("", False) # Set up a dictionary to return nice shader parameter type names shaderparamtypes = { "-1":"siShaderDataTypeUnknown", "0":"siShaderDataTypeBoolean", "1":"siShaderDataTypeInteger", "2":"siShaderDataTypeScalar", "3":"siShaderDataTypeVector2", "4":"siShaderDataTypeVector3", "5":"siShaderDataTypeVector4", "6":"siShaderDataTypeQuaternion", "7":"siShaderDataTypeMatrix33", "8":"siShaderDataTypeMatrix44", "9":"siShaderDataTypeColor3", "10":"siShaderDataTypeColor4", "11":"siShaderDataTypeString", "16":"siShaderDataTypeProperty", "17":"siShaderDataTypeProfileCurve", "18":"siShaderDataTypeGradient", "32":"siShaderDataTypeReference", "33":"siShaderDataTypeImage", "48":"siShaderDataTypeCustom", "64":"siShaderDataTypeStructure", "65":"siShaderDataTypeArray" } # Set up a cube with a SimpleSSS shader compound app.CreatePrim("Cube", "MeshSurface") sh = app.CreateShaderFromProgID("XSIRTCOMPOUND.SimpleSSS.1.2", "Sources.Materials.DefaultLib.Scene_Material", "") app.SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.SimpleSSS.Surface", "Sources.Materials.DefaultLib.Scene_Material.Phong.ambient", False) # Now we can see what kind of parameters are instantiated on this shader for param in sh.Parameters : if (param.IsClassOf(si.siShaderParameterID)) : app.LogMessage("'" + param.ScriptName + "' == " + shaderparamtypes[str(param.DataType)]) # Expected output: # INFO : 'bump' == siShaderDataTypeVector3 # INFO : 'ambient' == siShaderDataTypeColor4 # INFO : 'overall_color' == siShaderDataTypeColor4 # INFO : 'diffuse_color' == siShaderDataTypeColor4 # INFO : 'diffuse_weight' == siShaderDataTypeScalar # INFO : 'front_sss_color' == siShaderDataTypeColor4 # INFO : 'front_sss_weight' == siShaderDataTypeScalar # INFO : 'front_sss_radius' == siShaderDataTypeScalar # INFO : 'back_sss_color' == siShaderDataTypeColor4 # INFO : 'back_sss_weight' == siShaderDataTypeScalar # INFO : 'back_sss_radius' == siShaderDataTypeScalar # INFO : 'back_sss_depth' == siShaderDataTypeScalar # INFO : 'specular' == siShaderDataTypeColor4 # INFO : 'exponent' == siShaderDataTypeScalar # INFO : 'radiance' == siShaderDataTypeColor4 # INFO : 'light' == siShaderDataTypeImage # INFO : 'screen_composit' == siShaderDataTypeBoolean # INFO : 'scale_conversion' == siShaderDataTypeScalar # INFO : 'falloff' == siShaderDataTypeScalar # INFO : 'samples' == siShaderDataTypeInteger # INFO : 'lightmap_gamma' == siShaderDataTypeScalar # INFO : 'scatter_bias' == siShaderDataTypeScalar # INFO : 'Surface' == siShaderDataTypeColor4 # INFO : 'Lightmap' == siShaderDataTypeCustom |