VBScript Example: Grouping Ports in the Render Tree
 
 
 

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 "RTLayoutEx", 1, 0 			' group 2 out of the 5 parameters in the RTLayout
	
	XSILoadPlugin = true
end function


function LayoutTests_RTLayoutEx_1_0_DefineInfo( in_ctxt )
	in_ctxt.SetAttribute "Category", "Test Shaders/Layout@700"
	LayoutTests_RTLayoutEx_1_0_DefineInfo = true
end function


function LayoutTests_RTLayoutEx_1_0_Define( in_ctxt ) 
	set oShaderDef = in_ctxt.GetAttribute("Definition")
	oShaderDef.AddShaderFamily siShaderFamilyTexture
	
	' Add 3 input parameters as connectable ports
	set oInputParamsContainer = oShaderDef.InputParamDefs
	set oPDefOptions = XSIFactory.CreateShaderParamDefOptions 
	oPDefOptions.SetTexturable true
	oPDefOptions.SetInspectable false
	oInputParamsContainer.AddParamDef "port1", siShaderDataTypeColor4, oPDefOptions
	oInputParamsContainer.AddParamDef "port2", siShaderDataTypeInteger, oPDefOptions
	oInputParamsContainer.AddParamDef "port3", siShaderDataTypeScalar, 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 the output color
	set oOutputParamsContainer = oShaderDef.OutputParamDefs
	oPDefOptions.SetInspectable false
	oOutputParamsContainer.AddParamDef "out", siShaderDataTypeColor4, oPDefOptions
	
	' Fix the RTLayout
	set RTLayout = oShaderDef.RenderTreeLayout
	RTLayout.AddGroup "Solo"
		RTLayout.AddItem "port1"
	RTLayout.EndGroup
	RTLayout.AddGroup "Duo"
		RTLayout.AddItem "port2"
		RTLayout.AddItem "port3"
	RTLayout.EndGroup
	
	' Add renderer info
	
	LayoutTests_RTLayoutEx_1_0_Define = true
end function