ParameterCollection.1.js Example

Applies To

ParameterCollection object

Description

This example demonstrates how to use the ParameterCollection object.

Code

/*
	This example demonstrates how to access a shader's parameter collection 
*/
NewScene(null, false);
// Set up a cylinder with a Color Ramp shader 
CreatePrim("Cylinder", "MeshSurface");
var sh = CreateShaderFromProgID("MetaSL.Generator_color_ramp.1.0", "Sources.Materials.DefaultLib.Scene_Material");
SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.Color_Ramp.result", 
	"Sources.Materials.DefaultLib.Scene_Material.Phong.ambient", false);
// Check the class of each parameter in the collection
for (var i=0; i<sh.Parameters.Count; i++) {
	var param = sh.Parameters.Item(i);
	Application.LogMessage( param.ScriptName + " is a(n) " + Application.ClassName(param) );
}

// Expected output:
// INFO : Name is a(n) Parameter
// INFO : location is a(n) ShaderParameter
// INFO : inputs is a(n) ShaderArrayParameter
// INFO : interpolation_style is a(n) ShaderParameter
// INFO : result is a(n) ShaderParameter

Related Examples

ParameterCollection.2.vbs

Keywords

ParameterCollection Filter Find GetAsText Count Item


Autodesk Softimage 2011