パスオブジェクトのGUID をStringとして戻します。GUIDは、パスの動的な寿命を表す一意の識別子です。外部ファイルリストを扱うときに、パスオブジェクトのハンドルを取得するために使用されます。
注:ファイル名を変更した時や、シーンをリロードする時、GUID は変ります。
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);
}
|