Parameter.Source

Description

Returns a parameter's DataSource (the object that is driving the parameter's value, such as a Shader or an ActionSource). If no data source is connected then Nothing is returned. If a parameter has both ActionSource and a DataSource, it's the DataSource that is returned. This happens when an animated parameter is connected to a source.

Note: You can Get any type of data source (ActionSource, Constraint, FCurve, ImageClip, Operator, Shader, StaticSource), but you can only Set the shader type of data source. Shader parameters support setting the source to another shader. Note: Shader Compounds and Multi-Output Shaders have multiple output ports that require the Source to be identified by an Output Parameter. In such case, GetSource will return a Parameter and you can access the connected shader by calling Parameter.GetParent.

Tip: In VBScript it is possible to remove a DataSource by assigning "Nothing" to the Source property. In JScript and Python the same effect can be achieved by calling Parameter.Disconnect.

In the case of a ProxyParameter, the source of the master parameter is accessible from this property. For example, if a parameter has an fcurve on it, and there is a proxy parameter to that parameter, then the Source property of both parameter objects will return the same fcurve object.

C# Syntax

// get accessor
DataSource rtn = Parameter.Source;
// set accessor
Parameter.Source = DataSource;

Examples

1. VBScript Example

'
' This example illustrates how to add an FCurve to a parameter and access it afterwards
' using the Parameter.Source property.
'
NewScene , false
dim values
set oCube = Application.ActiveSceneRoot.AddGeometry( "Cube","MeshSurface" )
arrValues = Array( 0.00, 5.00, 1.00, 6.00, 2.00, 7.00, 3.00, 8.00, 4.00, 9.00, 5.00, 10.00 )
oCube.posx.AddFCurve2 arrValues 
set oSource = oCube.posx.Source
Application.LogMessage "The source is : " & TypeName( oSource )
' Remove the animation
set oCube.posx.Source = Nothing
set oSource = oCube.posx.Source
Application.LogMessage "The source is : " & TypeName( oSource )
' Expected result:
'INFO : The source is : FCurve
'INFO : The source is : Nothing

2. JScript Example

/*
	See Shader.GetShaderParameterTargets for an example demonstrating how to traverse 
	a shader tree from left to right using the Source property and right to left using the 
	GetShaderParameterTargets method. 
*/

See Also

Parameter.Sources FCurve Parameter.AddFCurve Parameter.AddFCurve2 Parameter.Disconnect ProxyParameter.MasterParameter Expression Constraint Operator Shader Shader.GetShaderParameterTargets