v5.0
Returns a FileReferenceCollection containing all external files related to this model. Only input files are added to this list (for example graphics files, audio files, referenced model files, etc.).
/* This example demonstrates how to get the list of external files on a specific model. */ NewScene ("", false); // First import a model so we have some external files to find var FPath = XSIUtils.BuildPath( Application.InstallationPath( siFactoryPath ), "Data", "XSI_SAMPLES", "Models", "Man_Face.emdl" ); var refModels = ImportRefModels( FPath ); // Enumerate all files related to this model var oModel = refModels(0); var l_extFileList = oModel.ExternalFiles; for ( var i=0; i<l_extFileList.Count; i++ ) { printFileInfo( l_extFileList(i) ); } // Expected results: // INFO : Models // INFO : ORIGINAL: <factory_path>\Data\XSI_SAMPLES\Models\Man_Face.emdl // INFO : RESOLVED: <factory_path>\Data\XSI_SAMPLES\Models\Man_Face.emdl // INFO : UNC : <factory_path>\Data\XSI_SAMPLES\Models\Man_Face.emdl // INFO : Models // INFO : Skipping non-existent file // --------------------------------------------------------------------------- // CONVENIENCE FUNCTION // function printFileInfo( in_file ) { Application.LogMessage( in_file.FileType ); if ( 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 Application.LogMessage( "ORIGINAL: " + o_path ); Application.LogMessage( "RESOLVED: " + r_path ); Application.LogMessage( "UNC : " + u_path ); } else { Application.LogMessage( "Skipping non-existent file" ); } } |