NewScene( null, false );
// ---------------------------------------------------------------------------
// SETUP
//
// 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"
);
ImportModel( FPath, null, true );
// ---------------------------------------------------------------------------
// USING THE FileReference OBJECT
//
// Get the collection of all external files on the scene
var oScene = Application.ActiveProject.ActiveScene;
var l_extFileList = oScene.ExternalFiles;
var oNewFile;
var oFile = l_extFileList(0);
// Get the index from the file object
var sGUID = oFile.GUID;
Application.LogMessage ("The Guid index is " + sGUID);
// Now get the file object from the guid
try
{
oNewFile = oScene.GetExternalFile( sGUID );
// oNewFile is equal to oFile
Application.LogMessage( oFile.Path + " is equal to " + oNewFile.Path);
}
catch(error)
{
Application.LogMessage ("the file object cannot be found",error);
}
|