AddImageClip

Introduced

1.0

Description

Creates and adds a new image clip to the Clips container from an image source. To perform this command you need an image source in the Sources container. You can create an image source with the AddImageSource command. This command is similar in syntax and behavior to the SIAddImageClip command, except that it returns a value from the function call, instead of through a parameter.

Tip: You can also use CreateImageClip as a shortcut to go straight from a filename to a clip (does the same as a combination of AddImageSource and AddImageClip).

Scripting Syntax

    AddImageClip( Source, [Name] )

Parameters

Parameter | Type | Description
Source | String | Source to use to create the clip.
Name | String | The name to use for the new clip.

Return Value

Returns the new ImageClip

Examples

VBScript Example

    '------------------------------------------------------------------
    ' This example shows how to add an image clip from an image source.
    '------------------------------------------------------------------
    option explicit

    ' First, add an image source.
    Dim oSourceObj, ImageFile
    ImageFile = Application.InstallationPath( siFactoryPath ) & "/Data/XSI_SAMPLES/Pictures/xsilogo.jpg"
    SIAddImageSource ImageFile, "XSIlogo", oSourceObj

    ' Now create an image clip from the image source.
    Dim oClipObj
    set oClipObj = AddImageClip( oSourceObj, "XSIlogo_Clip" )

    ' Now output some information about the clip, and its source.
    Dim SourceName, SourceFile, XRes, YRes
    SourceName = GetValue( oClipObj & ".Source.Name" )
    logmessage oClipObj & " Source       : " & CStr(SourceName)
    SourceFile = GetValue( oClipObj & ".SourceFileName" )
    logmessage oClipObj & " Source File  : " & CStr(SourceFile)
    XRes = GetValue( "Sources." & SourceName & ".XRes" )
    logmessage oClipObj & " X Resolution : " & CInt(XRes)
    YRes = GetValue( "Sources." & SourceName & ".YRes" )
    logmessage oClipObj & " Y Resolution : " & CInt(YRes)

    '---------------------------------------------------------
    ' Output from this script:
    'INFO : "Clips.XSIlogo_Clip Source       : XSIlogo"
    'INFO : "Clips.XSIlogo_Clip Source File  : <FactoryPath>\Data\XSI_SAMPLES\Pictures\xsilogo.jpg"
    'INFO : "Clips.XSIlogo_Clip X Resolution : 500"
    'INFO : "Clips.XSIlogo_Clip Y Resolution : 513"
    '---------------------------------------------------------

See Also

SIAddImageClip | CreateImageClip | AddImageSource | SIAddImageSource

Autodesk Softimage v7.5