IRiLibrary2 Interface Reference

Inherits IDispatch.

List of all members.

Public Member Functions

HRESULT OpenLibraryPlace ([in] BSTR szContainerNodePath,[in] BSTR szLibraryPlacePath,[in] BSTR szNodeName)
HRESULT ShowStandardLibraryWindow ([in] BSTR szLibraryPlaceNodePath)
HRESULT ShowLibraryBrowserWindow ()
HRESULT CreateMainLibrary ([in] BSTR bszMainLibraryPath)
HRESULT AddLibraryWindowIntoTools ([in] BSTR szLibraryPlaceNodePath)
HRESULT AddComponentsToLibPlace ([in] BSTR szLibraryPlacePath)
HRESULT DlgGenericLoad ([in] VARIANT szFileName,[in] VARIANT szTargetName,[in] VARIANT dwFlags,[out, retval] VARIANT *pvObject)
HRESULT DlgGenericSave ([in] VARIANT szFileName,[in] VARIANT szTargetName,[in] VARIANT dwFlags)
HRESULT DlgSaveScene ([in] BSTR bszFileName)
HRESULT Generate3DThumbnail ([in] BSTR bszObject,[in] RtDWORD dwWidth,[in] RtDWORD dwHeight,[out, retval] VARIANT *pvRdBitmap)
HRESULT GenerateSceneThumbnail ([in] RtBOOL bWholeScrn,[in] RtDWORD dwWidth,[in] RtDWORD dwHeight,[out, retval] VARIANT *pvRdBitmap)
HRESULT GetObjThumbnail ([in] BSTR bszObject,[out, retval] VARIANT *pvRdBitmap)


Detailed Description

The IRiLibrary2 interface provides basic methods for libraries.
Root-level name in the scripting engine's name space: Library2

Member Function Documentation

HRESULT IRiLibrary2::OpenLibraryPlace ( [in] BSTR  szContainerNodePath,
[in] BSTR  szLibraryPlacePath,
[in] BSTR  szNodeName 
)

Open/Create library place.

Parameters:
szContainerNodePath [in] Specify place in Dependency Graph in which should be the place node is created.
  • Usual value is '/Libraries'.
szLibraryPlacePath [in] Specify the library place directory.
szNodeName [in] Name of the libraries place object.
Usage:

    var nodePath = '/Libraries';
    var libPath = System.GetMainDir() + '\\Rs Main Library Place';
    var nodeName = 'Main Library Place';
    Library2.OpenLibraryPlace(nodePath, libPath, nodeName);

HRESULT IRiLibrary2::ShowStandardLibraryWindow ( [in] BSTR  szLibraryPlaceNodePath  ) 

Call to open a standard library window in default position (usually in Stack View).

Parameters:
szLibraryPlaceNodePath [in] Specify the library path.
  • The library name must be separated by ":" from the library path.
Usage:
    Library2.ShowStandardLibraryWindow('Libraries/Main Library Place:Activity - Simulation');

HRESULT IRiLibrary2::ShowLibraryBrowserWindow (  ) 

Opens the standard Library Browser window.

Returns:
Opens browser window.
    Library2.ShowLibraryBrowserWindow();

HRESULT IRiLibrary2::CreateMainLibrary ( [in] BSTR  bszMainLibraryPath  ) 

Create main library space object if it doesn't already exist.

  • The object will be placed into System/Libraries encapsulator in Link Editor.
  • Name of the object will always be Main Library Place.
Parameters:
bszMainLibraryPath [in] Specify the root directory for the library place.
    var mDir = System.GetMainDir();
    var libMainDir = mDir + '\\Rs Main Libraries';
    Library2.CreateMainLibrary(libMainDir); 

HRESULT IRiLibrary2::AddLibraryWindowIntoTools ( [in] BSTR  szLibraryPlaceNodePath  ) 

Call to open a standard library window as non-docked window.

Parameters:
szLibraryPlaceNodePath [in] Specify the library path.
  • The library path and the library name must be separated by a ":".
Usage:
    Library2.AddLibraryWindowIntoTools('Libraries/Main Library Place:Activity - Simulation');

HRESULT IRiLibrary2::AddComponentsToLibPlace ( [in] BSTR  szLibraryPlacePath  ) 

Method enumerate all your packages and save all the objects into specified location.

Parameters:
szLibraryPlacePath [in] Library Place (full filepath) where to save the objects.
  • If the path is not specified, you will be asked for it via a dialog.
    // You will be asked for the location where to save the objects.
    Library2.AddComponentsToLibPlace(''); 
    // Save the objects into root \myTestRoot directory.
    var root = System.GetMainDir();
    Library2.AddComponentsToLibPlace(root + '\\myTestRoot');

HRESULT IRiLibrary2::DlgGenericLoad ( [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 content as well.
  • If filename is not specified, a file Dialog is opened and name must be entered manually through dialog.
Parameters:
szFileName [in] Full path of the file you want to load.
  • If not specified, a file dialog will appear for file name to be entered.
szTargetName [in] Target object.
  • Specify empty string, variant or an object into which you want load the object.
  • If empty string is used, current scene will be used as target to load the object into.
dwFlags [in] Load flags (type of RsPckFileIOGenLoadFlags)
  • FIO_GEN_LOAD_SYNC (0x00000001) - Allow synchronous load.
  • If filename is not specified, a file Dialog is opened.
  • 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 is used 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 in addition to being loaded.
Returns:
pvObject [out, retval] Returns loaded object if synchronous operation was executed and the object successfully loaded.
  • The value is the string id when the object was placed into the Dependency Graph,
    or interface if it has no string identification in the Dependency Graph.
    var root = System.GetMainDir();
    var objName = root + '\\Rs Main Libraries\\Activities -Base\\Speak.RsObj';
    var objLoad = Library2.DlgGenericLoad(objName,1,8);

HRESULT IRiLibrary2::DlgGenericSave ( [in] VARIANT  szFileName,
[in] VARIANT  szTargetName,
[in] VARIANT  dwFlags 
)

Save specified object into a specified file.

Parameters:
szFileName Object File name.
  • Specify the required filename or full file path.
  • If not specified, a dialog will appear for file name to be entered.
szTargetName [in] Specify the object that should be saved.
  • If not specified, the current selection or a file-type default action will be used.
dwFlags [in] Save flags (type of RsPckFileIOGenSaveFlags).
  • FIO_GEN_SAVE_SYNC (0x00000001) - Allow synchronous save.
  • FIO_GEN_SAVE_ASYNC (0x00000002) - Allow asynchronous save.
  • FIO_GEN_SAVE_PREFER_ASYNC_LOAD (0x00000004) - If set, then asynchronous save will be preferred.
  • This flag is used with FIO_GEN_SAVE_ASYNC and FIO_GEN_SAVE_SYNC flags.
Returns:
  • S_OK - if the object was serialized successfully.
  • ERROR_IO_PENDING - if the file is saving asynchronously.
  • E_INVALIDARG - if the object cannot be serialized in desired format.
  • or other standard error.
 //need to have Vladimir go over this one 

HRESULT IRiLibrary2::DlgSaveScene ( [in] BSTR  bszFileName  ) 

Save the current scene to the file specified in a file dialog, clear 'scene changed' flag.

Parameters:
bszFileName [in] Initial file name displayed in the dialog.
 Library2.DlgSaveScene('myTestScene'); 

HRESULT IRiLibrary2::Generate3DThumbnail ( [in] BSTR  bszObject,
[in] RtDWORD  dwWidth,
[in] RtDWORD  dwHeight,
[out, retval] VARIANT *  pvRdBitmap 
)

Try to generate 3D thumbnail for the object.

  • This method require you have loaded View3D package.
Parameters:
bszObject [in] Specify full string ID of the object you want to render.
dwWidth [in] Specify required width of the thumbnail.
dwHeight [in] Specify required height of the thumbnail.
Returns:
pvRdBitmap [out, retval] If successfull, returns IRdBitmap with the thumbnail.
    var tNail = System.CreateDO('Common Data Package/Bitmap Data');
    tNail = Library2.Generate3DThumbnail(Node.FirstSelected(),60,60 );
    params.ConValue('tNail') = tNail; 

HRESULT IRiLibrary2::GenerateSceneThumbnail ( [in] RtBOOL  bWholeScrn,
[in] RtDWORD  dwWidth,
[in] RtDWORD  dwHeight,
[out, retval] VARIANT *  pvRdBitmap 
)

Generate thumbnail from the current screen.

Parameters:
bWholeScrn [in] If true, then the whole screen shot will be used.
  • If false, then only the selected view will be grabbed.
  • If none of the views are selected, then the whole screen shot will be grabbed.
dwWidth [in] Specify required width of the thumbnail.
dwHeight [in] Specify required height of the thumbnail.
Returns:
pvRdBitmap [out, retval] If successfull, returns IRdBitmap with the thumbnail.
    var SceneTNail = System.CreateDO('Common Data Package/Bitmap Data');
    SceneTNail = Library2.GenerateSceneThumbnail(false, 60, 60);
    params.ConValue('SceneTNail') = SceneTNail;

HRESULT IRiLibrary2::GetObjThumbnail ( [in] BSTR  bszObject,
[out, retval] VARIANT *  pvRdBitmap 
)

Most objects implement their own thumbnail. Call this method to get it.

Parameters:
bszObject [in] Specify full string ID of the object you want to render.
Returns:
pvRdBitmap [out, retval] If successfull, returns IRdBitmap with the thumbnail.
    var tNail = System.CreateDO('Common Data Package/Bitmap Data');
    tNail = Library2.GetObjThumbnail(Node.FirstSelected());
    params.ConValue('tNail') = tNail; 


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