IRiFileIOItem Interface Reference

Inherits IDispatch.

List of all members.

Public Member Functions

HRESULT SaveObject ([in] VARIANT szFileName,[in] VARIANT szObjName)
HRESULT SaveObjectEx ([in] VARIANT szFileName,[in] VARIANT szAuthor,[in] VARIANT szDescr,[in] VARIANT vThumbnail,[in] VARIANT szObjName)
HRESULT LoadObject ([in] BSTR bszFileName,[in] BSTR bszOwnerName,[out, retval] BSTR *pVal)
HRESULT LoadPreobject ([in] BSTR bszFileName,[in] BSTR bszOwnerName,[out, retval] BSTR *pVal)
HRESULT CreateRsFileHandle ([in] BSTR bszFileName,[in] RtDWORD dwFlags,[out, retval] VARIANT *pvRsFileHandle)
HRESULT SaveSystem ([in] VARIANT szFileName,[in] VARIANT szAuthor,[in] VARIANT szDescr,[in] VARIANT vThumbnail)
HRESULT SaveHistory ([in] VARIANT szFileName,[in] VARIANT szAuthor,[in] VARIANT szDescr,[in] VARIANT vThumbnail)
HRESULT LoadHistory ([in] VARIANT szFileName)
HRESULT GenericLoad ([in] VARIANT szFileName,[in] VARIANT szTargetName,[in] VARIANT dwFlags,[out, retval] VARIANT *pvObject)

Properties

VARIANT * LoadSystem ([in] VARIANT szFileName) [get]


Detailed Description

The IRiFileIOItem interface provides basic methods for import/export.

Root-level name in the scripting engine's name space: RsFileIO

Member Function Documentation

HRESULT IRiFileIOItem::SaveObject ( [in] VARIANT  szFileName,
[in] VARIANT  szObjName 
)

Save object to file. The whole subgraph will be saved if the object contains sub-objects.

Parameters:
szFileName [in] Name of the file.
szObjName [in] Identification of the object in the graph, its full name, empty string indicates the selected object.
Use following syntax if you want to save object to file:
    //save object MyCube from Space 3D  to the file myObject.RsObj
    RsFileIO.SaveObject('c:\\myObject.RsObj', 'Project/Space 3D/MyCube')
    //save the selected object to the file mySelectdObject.RsObj
    RsFileIO.SaveObject('c:\\mySelectedObject.RsObj', '')

HRESULT IRiFileIOItem::SaveObjectEx ( [in] VARIANT  szFileName,
[in] VARIANT  szAuthor,
[in] VARIANT  szDescr,
[in] VARIANT  vThumbnail,
[in] VARIANT  szObjName 
)

Save object to the file. The whole subgraph will be saved if the object contains sub-objects.

Parameters:
szFileName [in] Name of the file.
szAuthor [in] Author of the file.
szDescr [in] File description.
vThumbnail [in] IRdBitmap object as file thumbnail.
szObjName [in] Identification of the object in the graph, its full name, empty string indicates the selected object.
Use following syntax if you want to save object to file:
    //save object MyCube from Space 3D  to the file myObject.RsObj.
    Thumbnail = System.CreateDO("Common Data Package/Bitmap Data");
    Thumbnail.LoadFromFile('c:\\myObjThumbnail');
    RsFileIO.SaveObject('c:\\myObject.RsObj', 'Mike', 'this is the first draft', Thumbnail, 'Project/Space 3D/MyCube')
    //save the selected object to the file mySelectdObject.RsObj without thumbnail.
    RsFileIO.SaveObject('c:\\mySelectedObject.RsObj', 'Mike', 'Currently selected object', 0, '')

HRESULT IRiFileIOItem::LoadObject ( [in] BSTR  bszFileName,
[in] BSTR  bszOwnerName,
[out, retval] BSTR *  pVal 
)

Load object from the file and add it to graph, including its subgraph.

Parameters:
bszFileName [in] Name of the file.
bszOwnerName [in] Identification of the object in the graph, where loaded objects will be added.
Returns:
pVal [out, retval] Full name identification of loaded object in the graph.
Use following syntax if you want to load object from the file:
    // load object from the file 'myObject.RsObj' and add it to the current scene.
    RsFileIO.LoadObject('c:\\myObject.RsObj', Space.CurrentScene())
    // load object from the file 'mySelectedObject.RsObj',
    // add it to space 3D object and store name of loaded object in szLoadedObj variable.
    szLoadedObj = RsFileIO.LoadObject('c:\\mySelectedObject.RsObj', 'Project/Space 3D/')

HRESULT IRiFileIOItem::LoadPreobject ( [in] BSTR  bszFileName,
[in] BSTR  bszOwnerName,
[out, retval] BSTR *  pVal 
)

Load object from file and add it to graph including its subgraph.
The file is located in pre-objects directory which is:

  • ./tS/Scripts/PreObjects directory for truSpace and in
  • ./Scripts/PreObjects directory as default for other runners (truePlay, Run)
Parameters:
bszFileName [in] Name of the file.
bszOwnerName [in] Identification of the object in the graph, where loaded objects will be added.
Returns:
pVal [out, retval] Full name identification of loaded object in the graph.
Use following syntax if you want to load object from the pre-objects directory:
    // load object from file 'myPreObject.RsObj' located in pre-objects directory and add it to the current scene
    RsFileIO.LoadObject('myPreObject.RsObj' , Space.CurrentScene())

HRESULT IRiFileIOItem::CreateRsFileHandle ( [in] BSTR  bszFileName,
[in] RtDWORD  dwFlags,
[out, retval] VARIANT *  pvRsFileHandle 
)

Method creates File Handle object for specified Rosetta file and opens the file.
You can use the handle for:

  • Detailed object's scanning.
  • Get file's header.
  • Get the file's thumbnail.
  • Load only selected file's parts.
  • Get other info. You can also modify only selected file's parts.
File is closed automatically as "force close" when File Handle object is released.

To control the close action call Close method before you release the handle.

Parameters:
bszFileName [in] filename for which the handle will be created.
dwFlags [in] IRsFileHandle::ReFileHandleOpenFlags Possible values:
  • RSFHNDO_READ [0x00000001] - If set, it means you can read from opened file.
  • RSFHNDO_WRITE [0x00000002] - Specify if you want to modify the file.
    Note: If only RSFHNDO_WRITE is specified, you can only write into the file.
    If the file exists, it will be replaced.
  • RSFHNDO_NO_CHNK_LIST [0x00000004] - Don't add chunks list or remove it if the file was created or modified.
Returns:
pvRsFileHandle [out, retval] returns created handle object.

Standard HRESULT processing can be applied to the result.

Remarks:
If you modify the file, all the changes are not saved immediately but only when the FileHandle object is closed.
To do it manually call Close method.
Example:
    hFile = RsFileIO.CreateRsFileHandle('c:\\myObject.RsObj', 1);  // Open file for reading.
    indThumbnail = hFile.FindChunk('RdChunk Thumbnail', -1); // Find thumbnail chunk.
    if (indThumbnail != -1)
    {
        objThumnail = hFile.GetChunk(indThumbnail, 0); // If it is found, get it.
        objRdBitmap = objThumnail.GetAsRdBitmap();  // Get the thumbnail as RdBitmap object.
        [...]
    }

HRESULT IRiFileIOItem::SaveSystem ( [in] VARIANT  szFileName,
[in] VARIANT  szAuthor,
[in] VARIANT  szDescr,
[in] VARIANT  vThumbnail 
)

Save system content to .ctx file.

Parameters:
szFileName [in] .ctx file name for save.
szAuthor [in] Author of the file.
szDescr [in] File description.
vThumbnail [in] IRdBitmap object as file thumbnail.
    var mainDir = System.GetMainDir();
    var fileName = "myCTX.ctx";
    var author = "My name here";
    var desc = "my file description";
    var thumb = System.CreateDO('Common Data Package/Bitmap Data');
    thumb.LoadFromFile(mainDir + '\\textures\\COLOR6.BMP');
    RsFileIO.SaveSystem(fileName, author, desc, thumb);

HRESULT IRiFileIOItem::SaveHistory ( [in] VARIANT  szFileName,
[in] VARIANT  szAuthor,
[in] VARIANT  szDescr,
[in] VARIANT  vThumbnail 
)

Save command history to .RsHst file.

Parameters:
szFileName [in] .RsHst file name for save
szAuthor [in] Author of the file.
szDescr [in] File description.
vThumbnail [in] IRdBitmap object as file thumbnail.
    var mainDir = System.GetMainDir();
    var fileName = "myHist.RsHst";
    var author = "My name here";
    var desc = "my file description";
    var thumb = System.CreateDO('Common Data Package/Bitmap Data');
    thumb.LoadFromFile(mainDir + '\\textures\\COLOR6.BMP');
    RsFileIO.SaveHistory(fileName, author, desc, thumb);

HRESULT IRiFileIOItem::LoadHistory ( [in] VARIANT  szFileName  ) 

Loads command history from .RsHst file.

Parameters:
szFileName [in] .RsHst file name for load.
    var mainDir = System.GetMainDir();
    var fileName = "myHist.RsHst";
    var combo = mainDir + '\\' + fileName;
    RsFileIO.LoadHistory(combo);

HRESULT IRiFileIOItem::GenericLoad ( [in] VARIANT  szFileName,
[in] VARIANT  szTargetName,
[in] VARIANT  dwFlags,
[out, retval] VARIANT *  pvObject 
)

Function loads any known Rosetta file type object.
The file type is detected not only from the file extension, but from the contents too.

Parameters:
szFileName [in] Full path of the file you want to load
szTargetName [in] Target object. In case you are loading material, you can specify here object on which it should be applied.
dwFlags [in] Load flags (type of IRsPackageFileIOReg::RePckFileIOGenLoadFlags)
  • FIO_GEN_LOAD_SYNC (0x00000001) Allow synchronous load
  • FIO_GEN_LOAD_ASYNC (0x00000002) Allow asynchronous load
  • FIO_GEN_LOAD_PREFER_ASYNC_LOAD (0x00000004) If set, then asynchronous load will be preferred.
    This flag has sense only with FIO_GEN_LOAD_ASYNC and FIO_GEN_LOAD_SYNC flags.
  • FIO_GEN_LOAD_FORCE_APPLY (0x00000008) If set, the object will be applied rather than only loaded.
Returns:
pvObject [out, retval] Returns loaded object if synchronous operation was executed and the object successfully loaded.
  • The value is string id when the object was placed into Dependency Graph, or interface if it hasn't string identification in Dependency Graph.


Property Documentation

VARIANT* IRiFileIOItem::LoadSystem([in] VARIANT szFileName) [get]

Loads system content file (stored e.g. during latest system shutdown).

Parameters:
szFileName [in] .ctx file name to load.
Returns:
pVal [out, retval] Returns TRUE if load succeeded, FALSE otherwise.
    var mainDir = System.GetMainDir();
    var fileName = "myCTX.ctx";
    var combo = mainDir + '\\' + fileName;
    RsFileIO.LoadSystem(combo);


Generated on Wed May 20 21:32:15 2009 for trueSpace7.6 SDK by  doxygen 1.5.5