IRiSpaceCommand Interface Reference

Inherits IDispatch.

List of all members.

Public Member Functions

HRESULT NewScene (void)
HRESULT Select (BSTR name)
HRESULT Unselect (void)
HRESULT DisplayAll (void)
HRESULT ConnectOCTreeToSpace (BSTR bstrSpaceName)
HRESULT AdjustMatManager ([in] BSTR bstrObjName,[in] RtDWORD dwNumCons)
HRESULT SaveScene ([in] BSTR bszSceneFileName)
HRESULT LoadScene ([in] BSTR bszSceneFileName)
HRESULT RemEulerTrans ([in] BSTR bstrName)
HRESULT ConvertToMatList ([in] BSTR bstrEncapsName,[in] BSTR bstrActiveClass)
HRESULT AutoRunActivities ()
HRESULT EnableCollision ([in] BSTR bstrObjName,[in] BOOL bEnable)
HRESULT GetVolume ([in] BSTR bstrName,[out, retval] float *fVolume)
HRESULT GetCenter ([in] BSTR bstrName,[in] RtBool bWorld,[out, retval] VARIANT *pvCentre)
HRESULT GetBoundingBox ([in] BSTR bstrName,[out, retval] VARIANT *pvBox)
HRESULT CreateMeshFnSet ([in] VARIANT vtMesh,[out, retval] VARIANT *ppMeshSet)

Properties

BSTR * Sphere ([in] RtDouble dRadius,[in] RtUlong latitude,[in] RtUlong longitude) [get]
BSTR * Torus ([in] RtDouble dRadius,[in] RtUlong latitude,[in] RtUlong longitude) [get]
BSTR * Cube ([in] VARIANT cx,[in] VARIANT cy,[in] VARIANT cz,[in] VARIANT rcx,[in] VARIANT rcy,[in] VARIANT rcz) [get]
BSTR * Polygon3D ([in] VARIANT size,[in] VARIANT res) [get]
BSTR * CurrentScene [get]
BSTR * ApplyDeform ([in] VARIANT ObjName,[in] BSTR deformType) [get]
BSTR * NURBSCube ([in] VARIANT cx,[in] VARIANT cy,[in] VARIANT cz,[in] VARIANT sx,[in] VARIANT sy,[in] VARIANT sz) [get]
BSTR * NURBSSphere ([in] VARIANT radius) [get]
BSTR * NURBSTorus ([in] VARIANT radius1,[in] VARIANT radius2) [get]
BSTR * NURBSCone ([in] VARIANT radius1,[in] VARIANT radius2,[in] VARIANT height) [get]
VARIANT * NodeMatrixElement ([in] BSTR szNodeName,[in] BSTR szElemName) [get]
VARIANT NodeMatrixElement ([in] BSTR szNodeName,[in] BSTR szElemName) [set]


Detailed Description

The IRiSpaceCommand interface provides methods for scene and scene objects-related operations. It can clear the scene, save/load the scene, create primitive objects etc.

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

Member Function Documentation

HRESULT IRiSpaceCommand::NewScene ( void   ) 

Creates new scene (erasing the current one, so be carrefull).

 Space.NewScene(); 

HRESULT IRiSpaceCommand::Select ( BSTR  name  ) 

Selects the given object.

Parameters:
name [in] Full name of object to be selected.
 var owner = Space.CurrentScene();
 var target = owner + '/cylinder';
 Space.Select(target); 

HRESULT IRiSpaceCommand::Unselect ( void   ) 

Deselect everything.

 Space.Unselect(); 

HRESULT IRiSpaceCommand::DisplayAll ( void   ) 

Displays basic information about all objects on the scene to the output console.

 Space.DisplayAll(); 

HRESULT IRiSpaceCommand::ConnectOCTreeToSpace ( BSTR  bstrSpaceName  ) 

Parameters:
bstrSpaceName [in] Space.CurrentScene()
    var owner = Space.CurrentScene();
    Space.ConnectOCTreeToSpace(owner); 

HRESULT IRiSpaceCommand::AdjustMatManager ( [in] BSTR  bstrObjName,
[in] RtDWORD  dwNumCons 
)

Adjusts number of input material chunks for given material list or chunk manager object.

Remarks:
Look for "Material Flavor Manager" within the material levels of object.
Parameters:
bstrObjName [in] Full name of material list or chunk manager object.
dwNumCons [in] New number of input connectors for manager object.
    var owner = System.ThisOwner();
    var target = owner + '/Cube/Material List, 1/Material 0/Material Flavor Manager';
    Space.AdjustMatManager(target,2);

HRESULT IRiSpaceCommand::SaveScene ( [in] BSTR  bszSceneFileName  ) 

Saves scene to file. Can be reloaded with the LoadScene method.

Parameters:
bszSceneFileName [in] Full path and filename. ie: 'c:\SaveScenefromScript'.
    var target = 'c:\\SaveSceneScript';
    Space.SaveScene(target);

HRESULT IRiSpaceCommand::LoadScene ( [in] BSTR  bszSceneFileName  ) 

Loads scene from file, created previously with the SaveScene method.

Parameters:
bszSceneFileName [in] Full path and filename. ie: 'c:\SaveScenefromScript'
    var target = 'c:\\SaveSceneScript';
    Space.LoadScene(target);

HRESULT IRiSpaceCommand::RemEulerTrans ( [in] BSTR  bstrName  ) 

Replaces EulerTransform object by Transform object for specified object and its sub-objects. All the existing values and connections are maintained.

Remarks:
This method intended for use when old style objects are imported and the EulerTransform is in use within.

May be useful to create a script to parse all the scene objects for 'EulerTransform' objects.

Parameters:
bstrName [in] Full Link Editor path and name of object to be transformed.
Remarks:
(if none, current selected object will be used)
    var target = '\full Link Editor path to object with EulerTranform in use';
    Space.RemEulerTrans(target);

HRESULT IRiSpaceCommand::ConvertToMatList ( [in] BSTR  bstrEncapsName,
[in] BSTR  bstrActiveClass 
)

Converts object with single DX material to material list. Also allows to specify active class info for the Bridge

Parameters:
bstrEncapsName [in] Full Link Editor path and name of object to be converted. Note: all sub-objects will be processed.
bstrActiveClass [in] GUID of active class to be set (to force material origin, either DX or LW)
Remarks:
Example: use this command to transform all objects in the scene to material lists and sets DX material as a original.
(so the Bridge will convert all materials when switching over to the Modeler. This can sometimes fix corrupted Modeler-materials.
See also:
RtMatClsId
 Space.ConvertToMatList('/Project/Space 3D','{328915F2-9B2F-43c1-9168-CBA26A9B8F43}') 

HRESULT IRiSpaceCommand::AutoRunActivities (  ) 

Activities in the scene are automatically run when scene loads.

Remarks:
(usefull for truePlay).
 Space.AutoRunActivities(); 

HRESULT IRiSpaceCommand::EnableCollision ( [in] BSTR  bstrObjName,
[in] BOOL  bEnable 
)

Enables or disables physical collisions for object.

Parameters:
bstrObjName [in] Full Link Editor path and name of object (if none, current selected object will be used).
bEnable [in] TRUE for enabed collisions, FALSE for disabled collisions.
    var target = Node.FirstSelected();
    Space.EnableCollision(target, true); 

HRESULT IRiSpaceCommand::GetVolume ( [in] BSTR  bstrName,
[out, retval] float *  fVolume 
)

Get volume of given object.

Parameters:
bstrName [in] Full Link Editor path and name of object.
Returns:
fVolume [out, retval] Returns volume of object.
 var tVolume = Space.GetVolume(target); 

HRESULT IRiSpaceCommand::GetCenter ( [in] BSTR  bstrName,
[in] RtBool  bWorld,
[out, retval] VARIANT *  pvCentre 
)

Get mesh center of given object.

Parameters:
bstrName [in] Full Link Editor path and name of object.
bWorld [in] If TRUE center is world coordinate system, otherwise in other coordinate system.
Returns:
pvCentre [out, retval] Returns center of object.
    var coo = Space.GetCenter(target, true);
    System.Alert(coo.x); 

HRESULT IRiSpaceCommand::GetBoundingBox ( [in] BSTR  bstrName,
[out, retval] VARIANT *  pvBox 
)

Get bounding box of given object.

Parameters:
bstrName [in] Full Link Editor path and name of object.
Returns:
pvBox [out, retval] Returns bounding box of object as array [xmin, xmax, ymin, ymax, zmin, zmax].
    var target = Node.FirstSelected();
    var tBBox = Space.GetBoundingBox(target);
    var minX = tBBox.GetAt(0);

HRESULT IRiSpaceCommand::CreateMeshFnSet ( [in] VARIANT  vtMesh,
[out, retval] VARIANT *  ppMeshSet 
)

Create initialized mesh helper function set.

Parameters:
vtMesh [in] Mesh to attach to helper set.
Returns:
ppMeshSet [out, retval] Returned initialized scriptable interface for mesh function set.
 // Tomas, please comment on this one. 


Property Documentation

BSTR* IRiSpaceCommand::Sphere([in] RtDouble dRadius, [in] RtUlong latitude, [in] RtUlong longitude) [get]

obsolete method: MartinK. Creates Sphere primitive

Parameters:
dRadius [in] Radius of the sphere (float value).
latitude [in] Latitude of the sphere (integer value).
longitude [in] Longitude of the sphere (integer value).
Returns:
pVal [out, retval] Returns full name of sphere object created.
Remarks:
Note: object will be created in current scene.
Example:
    var sphereName = Space.Sphere(1.5, 6, 6);
    System.Alert(sphereName); 

BSTR* IRiSpaceCommand::Torus([in] RtDouble dRadius, [in] RtUlong latitude, [in] RtUlong longitude) [get]

Creates Torus primitive:

Parameters:
dRadius [in]Radius of the torus (float value).
latitude [in] Latitude of the torus (integer value).
longitude [in] Longitude of the torus (integer value).
Returns:
pVal [out, retval] Returns full name of torus object created.
Remarks:
Note: object will be created in current scene.
Example:
    var torusName = Space.Torus(2.0, 10, 10);
    System.Alert(torusName); 

BSTR* IRiSpaceCommand::Cube([in] VARIANT cx, [in] VARIANT cy, [in] VARIANT cz, [in] VARIANT rcx, [in] VARIANT rcy, [in] VARIANT rcz) [get]

Creates Cube primitive.

Parameters:
cx [in] X size of cube (float value).
cy [in] Y size of cube (float value).
cz [in] Z size of cube (float value).
rcx [in] X resolution (number of components) (integer value).
rcy [in] Y resolution (number of components) (integer value).
rcy [in] Z resolution (number of components) (integer value).
Returns:
pVal [out,retval] Returns full name of cube object created. Note – object will be created in current scene.
Remarks:
Note: Number of vertices of cube created will be 2 * (rcx * rcy + rcy * rcz + rcz * rcx + 1).
Example:
 Space.Cube(2.0, 2.0, 2.0, 1, 1, 1) 

BSTR* IRiSpaceCommand::Polygon3D([in] VARIANT size, [in] VARIANT res) [get]

Creates a 3D Polygon.

Parameters:
size [in] Sets size of polygon.
res [in] Sets resolution of polygon.
Returns:
pVal [out,retval] Returns full name of polygon.
    var PolyName = Space.Polygon3D(.1,1);
    System.Alert(PolyName); 

BSTR * IRiSpaceCommand::CurrentScene [get]

Returns full name of current scene.

Returns:
pVal [out,retval] Full name of current scene.
    var sceneName = Space.CurrentScene(); 
    System.Alert(sceneName);

BSTR* IRiSpaceCommand::ApplyDeform([in] VARIANT ObjName, [in] BSTR deformType) [get]

Apply deform to given object.

Parameters:
ObjName [in] Full name of object
deformType [in] Deformation type ('twist' or 'taper')
Returns:
pVal [out,retval] Returns full name of final deform object.
    var owner = Space.CurrentScene();
    var target = Node.FirstSelected();
    var applyDeform = Space.ApplyDeform(target, 'taper');
    Node.Value(applyDeform, 'Scaling') = 1; 

or

    var owner = Space.CurrentScene();
    var target = Node.FirstSelected();
    var applyDeform = Space.ApplyDeform(target, 'twist');
    Node.Value(applyDeform, 'Angle') = 1; 

BSTR* IRiSpaceCommand::NURBSCube([in] VARIANT cx, [in] VARIANT cy, [in] VARIANT cz, [in] VARIANT sx, [in] VARIANT sy, [in] VARIANT sz) [get]

Creates NURBS Cube.

Parameters:
cx [in] X center of cube (float value)
cy [in] Y center of cube (float value)
cz [in] Z center of cube (float value)
sx [in] X size of cube. (float value)
sy [in] Y size of cube. (float value)
sz [in] Z size of cube. (float value)
Returns:
pVal [out,retval] Returns full name of created object.
    var nCubeName = Space.NURBSCube(.25,2.5,1,.5,.5,.5);
    System.Alert(nCubeName);

BSTR* IRiSpaceCommand::NURBSSphere([in] VARIANT radius) [get]

Creates NURBS Sphere.

Parameters:
radius [in] Radius of the sphere.
Returns:
pVal [out,retval] Returns full name of created object.
    var nSphereName = Space.NURBSSphere(1.5);
    System.Alert(nSphereName);

BSTR* IRiSpaceCommand::NURBSTorus([in] VARIANT radius1, [in] VARIANT radius2) [get]

Creates NURBS Torus.

Parameters:
radius1 [in] Radius of inner ring for the torus.
radius2 [in] Radius of outer ring for the torus.
Returns:
pVal [out,retval] Returns full name of created object.
    var nTorusName = Space.NURBSTorus(1, 2);
    System.Alert(nTorusName);

BSTR* IRiSpaceCommand::NURBSCone([in] VARIANT radius1, [in] VARIANT radius2, [in] VARIANT height) [get]

Creates NURBS Cone.

Parameters:
radius1 [in] Radius of base of the cone.
radius2 [in] Radius of top of the cone.
height [in] Height of the cone.
Returns:
pVal [out,retval] Returns full name of created object.
    var nConeName = Space.NURBSCone(.5, 1, 3);
    System.Alert(nConeName);

VARIANT * IRiSpaceCommand::NodeMatrixElement([in] BSTR szNodeName, [in] BSTR szElemName) [get]

Gets transform matrix element for given object. It works properly for objects with Transform sub-object, Expanded Matrix or Euler Transform as well.

Parameters:
szNodeName [in] Full Link Editor path and name of object.
szElemName [in] Transform element name (e.g. 'sx', 'tx', 'roll').
Returns:
pVal [out,retval] Returned value of given transform element.
    var target = Node.FirstSelected();
    var tRoll = Space.NodeMatrixElement(target,'roll');

VARIANT IRiSpaceCommand::NodeMatrixElement([in] BSTR szNodeName, [in] BSTR szElemName) [set]

Sets transform matrix element for given object. It works properly for objects with Transform sub-object, Expanded Matrix or Euler Transform as well.

Parameters:
szNodeName [in] Full Link Editor path and name of object.
szElemName [in] Transform element name (e.g. 'sx', 'tx', 'roll').
newVal [in] Value of transform element to be set.
    var target = Node.FirstSelected();
    Space.NodeMatrixElement(target,'roll') += 10;


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