Parameter.ConnectFromProgID

Introduced

v2.0

Description

Creates a DataSource object from a ProgID string and connects it to the parameter.

Note: This method uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference. Normally for scripting you can get the output arguments via the ISIVTCollection, but this method already returns a value (C# cannot use this workaround because it does not have access to the ISIVTCollection).

The only available workaround in this case is to create a VBScript custom command which returns both the output arguments and the return value in one array. For details, see What Happens when the Function Already Returns a Value?.

C# Syntax

DataSource Parameter.ConnectFromProgID( String in_ProgID, Object& out_pvPrevDataSource );

Scripting Syntax

oDataSource = Parameter.ConnectFromProgID( ProgID, [PrevDataSource] );

Return Value

Newly created DataSource object, such as a Shader or an ImageClip.

Parameters

Parameter Type Description
ProgID String The ProgID is a string name that can be used to look up a data source type. Data sources that support ProgIDs implement a ProgID property (for example, Shader.ProgID).
PrevDataSource DataSource object (for example, Shader, ImageClip) The previously connected data source if any. The method returns "Nothing" if there is no previously connected data source.

Examples

VBScript Example

'
' This example illustrates how to add a material to an object and connect
' the material's shadow to a Phong shader
'
NewScene , false
set grid = Application.ActiveSceneRoot.AddGeometry( "Cube", "MeshSurface" )
set mat = grid.AddMaterial
set param = mat.Parameters("Shadow")
set shader = param.ConnectFromProgID( "Softimage.material-phong.1" )

See Also

Shader.ProgID Parameter.Connect Parameter.ConnectFromPreset Parameter.ConnectFromFile SceneItem.AddMaterial Parameter.Disconnect Shader Presets