// Create a scene with an object lit by a spotlight
var root = Application.ActiveProject.ActiveScene.Root;
var grid = root.AddGeometry( "Grid", "MeshSurface" );
scale( grid, 2, 2, 2, siAbsolute );
var cone = root.AddGeometry( "Cone", "MeshSurface" );
translate(cone, 0, 1.3, 0 );
var light = root.AddLight( "LightSpot", true, "SpotLight" );
ApplyCns( "Position", light.interest, cone );
ApplyCns( "Orientation", light.interest, cone );
translate( light, 4, 6, 4);
// List the names and input types of all parameters that support shader connections
var eParams = new Enumerator(light.parameters);
for ( ; !eParams.atEnd(); eParams.moveNext() )
{
var param = eParams.item();
if (param.capabilities & siTexturable)
{
var inputtype = light.GetShaderInputType(param.scriptname);
// This parameter supports a shader connection
logmessage( param.fullname + " has shader inputtype = " + ShaderParameterTypeAsText(type) );
}
}
function ShaderParameterTypeAsText(type)
{
switch (type)
{
case siUnknownParameterType : return "siUnknownParameterType";
case siBooleanParameterType : return "siBooleanParameterType";
case siColorParameterType : return "siColorParameterType";
case siDataParameterType : return "siDataParameterType";
case siIntegerParameterType : return "siIntegerParameterType";
case siLensParameterType : return "siLensParameterType";
case siLightParameterType : return "siLightParameterType";
case siMaterialParameterType : return "siMaterialParameterType";
case siMatrixParameterType : return "siMatrixParameterType";
case siModelParameterType : return "siModelParameterType";
case siRealTimeParameterType : return "siRealTimeParameterType";
case siReferenceParameterType : return "siReferenceParameterType";
case siScalarParameterType : return "siScalarParameterType";
case siShaderParameterType : return "siShaderParameterType";
case siStringParameterType : return "siStringParameterType";
case siStructParameterType : return "siStructParameterType";
case siTextureParameterType : return "siTextureParameterType";
case siTextureSpaceParameterType : return "siTextureSpaceParameterType";
case siVectorParameterType : return "siVectorParameterType";
default: return inputtype;
}
}
//INFO : SpotLight.light.LightShader has shader inputtype = siColorParameterType
//INFO : SpotLight.light.PhotonShader has shader inputtype = siColorParameterType
//
|