FileReference.GUID

Description

Returns the GUID of a path object as a String. The GUID is a unique identifier for the dynamic life of a path. It should be used to retrieve a handle on the path object when dealing with the external file list.

Note: The GUID may change if the filename changes or when reloading the scene.

Examples

JScript Example

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);
}

See Also

FileReference.ResolvedPath FileReference.Path Scene.ExternalFiles Scene.GetExternalFile