Scene.ExternalFiles

Introduced

v5.0

Description

Returns a FileReferenceCollection, a collection of FileReference objects containing all external files related to this scene. Only input files are added to this list (for example graphics files, audio files, referenced model files, etc.).

Examples

JScript Example

/*
        This example demonstrates how to get the list 
        of external files associated with the scene.
*/ 
NewScene (0, false);
// First import a model so we have some external files to find
var FPath = InstallationPath( siFactoryPath );
ImportModel( FPath + "\\Data\\XSI_SAMPLES\\Models\\Man_Face.emdl", null, true );
// Enumerate all files related to the current (active) scene
var l_extFileList = Application.ActiveProject.ActiveScene.ExternalFiles;
for ( var i=0; i<l_extFileList.Count; i++ ) {
        printFileInfo( l_extFileList(i) );
}
// ---------------------------------------------------------------------------
//      CONVENIENCE FUNCTION
//
function printFileInfo( in_file ) {
        LogMessage( in_file.FileType );
        LogMessage( in_file.FileExists() );
        // Get the original path 
        var o_path = in_file;
        // Get the resolved path
        var r_path = o_path.ResolvedPath;
        // Get the UNC path
        var u_path = o_path.UNCPath;
        // Print all three results
        LogMessage( "ORIGINAL: " + o_path );
        LogMessage( "RESOLVED: " + r_path ); 
        LogMessage( "UNC     : " + u_path );
}
// Expected result:
//INFO : Models
//INFO : 1
//INFO : ORIGINAL: <factory_location>\Data\XSI_SAMPLES\Models\Man_Face.emdl
//INFO : RESOLVED: <factory_location>\Data\XSI_SAMPLES\Models\Man_Face.emdl
//INFO : UNC     : <factory_location>\Data\XSI_SAMPLES\Models\Man_Face.emdl
//INFO : Pictures
//INFO : 1
//INFO : ORIGINAL: <factory_location>\Application\rsrc\noIcon.pic
//INFO : RESOLVED: <factory_location>\Application\rsrc\noIcon.pic
//INFO : UNC     : <factory_location>\Application\rsrc\noIcon.pic

See Also

Scene.GetExternalFile Model.ExternalFiles FileReference FileReferenceCollection CopyExtFilesIntoProject