SIAddImageSource

Introduced

v1.0

Description

Creates and adds a new image source in the Sources container. To execute this command you must have an image source file on disk. Image sources are used by ImageClip objects in order to perform image compositing effects, such as texturing.

This command is similar in syntax and behavior to the AddImageClip command, except that it returns a value through a parameter, instead of from the function directly.

It is accessed from the main menu under Render->Get - Clip->Create Source From File, and then choosing an image source file.

This command supports the downloading of files off the internet. If the filename specified is a URL then the file will be downloaded locally before the command is executed.

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference so you need to use the best workaround for your situation:

For scripting languages this command returns an ISIVTCollection which you can use to get the output arguments.

For C# you can use the XSIApplication.ExecuteCommand method to call this command. ExecuteCommand packs the output arguments into a C# System.Object containing an Array of the output arguments (see Calling Commands from C#).

Scripting Syntax

SIAddImageSource( [FileName], [Name], [Source] );

Parameters

Parameter Type Description
FileName String Full path of the new image source.

Default Value: User is prompted to select a file

Name String The name to use for the new source.
Source Source Returns the source

Examples

VBScript Example

'---------------------------------------------------------

' VBScript example : Adding image sources. This script 

' demonstrates the use of SIAddImageSource to add image sources

' to the scene.

'---------------------------------------------------------

' Get the filenames of some image sources.

Dim Source1, Source2, Source3

Source1 = Application.InstallationPath( siFactoryPath ) & "\Data\XSI_SAMPLES\Pictures\xsilogo.jpg"

Source2 = Application.InstallationPath( siFactoryPath ) & "\Data\XSI_SAMPLES\Pictures\top_teeth.jpg"

Source3 = Application.InstallationPath( siFactoryPath ) & "\Data\XSI_SAMPLES\Pictures\jio.jpg"

' Now create image sources from the filenames.

Dim XSIsrc, Teethsrc, Jiosrc

SIAddImageSource Source1, "XSI", XSIsrc

SIAddImageSource Source2, "Teeth", Teethsrc

SIAddImageSource Source3, "Jio", Jiosrc

logmessage XSIsrc & " created with source file : " & Source1

logmessage Teethsrc & " created with source file : " & Source2

logmessage Jiosrc & " created with source file : " & Source3

'---------------------------------------------------------

' Output from this script:

'INFO : "Sources.XSI created with source file : <FactoryPath>\Data\XSI_SAMPLES\Pictures\xsilogo.jpg"

'INFO : "Sources.Teeth created with source file : <FactoryPath>\Data\XSI_SAMPLES\Pictures\top_teeth.jpg"

'INFO : "Sources.Jio created with source file : <FactoryPath>\Data\XSI_SAMPLES\Pictures\jio.jpg"

'---------------------------------------------------------

See Also

AddImageSource AddImageClip CreateImageClip