JScript Example: No UI for Parameter Definition

 
 
 

This example produces the following UI:

function XSILoadPlugin( in_reg )
{
	in_reg.Author = "SDK Documentation";
	in_reg.Name = "LayoutTests";
	in_reg.Major = 1;
	in_reg.Minor = 0;

	in_reg.RegisterShader("NoLayoutEx", 1, 0);
	return true;
}
function LayoutTests_NoLayoutEx_1_0_DefineInfo( in_ctxt )
{
	in_ctxt.SetAttribute("Category", "Test Shaders/Layout@700");
	return true;
}

function LayoutTests_NoLayoutEx_1_0_Define( in_ctxt ) 
{
	var oShaderDef = in_ctxt.GetAttribute("Definition");
	oShaderDef.AddShaderFamily(siShaderFamilyTexture);
	
	// Add 2 input parameters as connectable ports
	var oInputParamsContainer = oShaderDef.InputParamDefs;
	var oPDefOptions = XSIFactory.CreateShaderParamDefOptions();
	oPDefOptions.SetTexturable(true);
	oPDefOptions.SetInspectable(false);
	oInputParamsContainer.AddParamDef("port1", siShaderDataTypeColor4, oPDefOptions);
	oInputParamsContainer.AddParamDef("port2", siShaderDataTypeInteger, oPDefOptions);

	// Add 2 input parameters on property page
	oPDefOptions.SetTexturable(false);
	oPDefOptions.SetInspectable(true);
	oInputParamsContainer.AddParamDef("param1", siShaderDataTypeString, oPDefOptions);
	oInputParamsContainer.AddParamDef("param2", siShaderDataTypeBoolean, oPDefOptions);

	// Add 1 input parameters that won't appear in UI
	oPDefOptions.SetInspectable(false);
	oInputParamsContainer.AddParamDef("uiless", siShaderDataTypeScalar, oPDefOptions);
	// Add the output color
	var oOutputParamsContainer = oShaderDef.OutputParamDefs;
	oOutputParamsContainer.AddParamDef("out", siShaderDataTypeColor4, oPDefOptions);
	
	// Add renderer info
	
	return true;
}