## DeleteUnusedImageSources

### Introduced

v2.0

### Description

Deletes all the image sources that are not used in the scene. When an image source is not used, you can see (Not Used) beside the name of the source.
This command can be used to clean up your scene.

### Scripting Syntax

    DeleteUnusedImageSources();

### Examples

#### VBScript Example

    '

    ' This example demonstrates how DeleteUnusedImageSources works by connecting

    ' an image clip to a cylinder (so it's protected from DeleteUnusedImageSources).

    ' Then it deletes the image clip (so it's unused) and then runs the

    ' DeleteUnusedImageSources command again, which removes the image clip and its

    ' source from the scene.

    '

    ' Tip: To see the difference between running DeleteUnusedImageSources before

    ' deleting the clip and after, first run the example up to the PART TWO

    ' comment. Then run the rest of the example to see the difference.

    '

    ' PART ONE

    NewScene , false

    CreatePrim "Cylinder", "MeshSurface"

    ' 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" )

    SIConnectShaderToCnxPoint oClipObj, "Sources.Materials.DefaultLib.Scene_Material.Phong.ambient"

    ' Running this will have no effect

    DeleteUnusedImageSources

    ' PART TWO

    ' Now delete the image clip, so the source will become un-used.

    DeleteObj "Clips.XSIlogo_Clip"

    ' Running this will remove the image source since it un-used now.

    DeleteUnusedImageSources

### See Also

DeleteUnusedImageClips