Example: Custom Command Workaround for Both Output Arguments and Return Values

 
 
 

This example contains a command plug-in that you can call from languages that do not support output arguments. It allows those languages to get at the GetSkeleton command's output argument (Index) as well as the returned skeleton objects.

' Load MyGetSkeleton command
function XSILoadPlugin( in_reg )
	in_reg.Name = "MyGetSkeletonPlugin"
	in_reg.Major = 1
	in_reg.Minor = 0

	in_reg.RegisterCommand "MyGetSkeleton","MyGetSkeleton"

	XSILoadPlugin = true
end function

' Define MyGetSkeleton command
function MyGetSkeleton_Init( in_ctxt )
	dim oCmd
	set oCmd = in_ctxt.Source
	oCmd.Description = "Version of GetSkeleton with no output arguments"
	oCmd.Tooltip = "Version of GetSkeleton with no output arguments"
	oCmd.ReturnValue = true

	dim oArgs
	set oArgs = oCmd.Arguments
	oArgs.Add "InputObj",siArgumentInput
	MyGetSkeleton_Init = true
end function

' Execute callback for the custom command
function MyGetSkeleton_Execute( InputObj )
	' Call the GetSkeleton command and pack the output 
	' argument and the return value in an array 
	set oSkel = GetSkeleton( InputObj, lIndex )
	aReturn = Array( lIndex, oSkel )

	' Return the array
	MyGetSkeleton_Execute = aReturn 
end function