glmSimulationCacheTool
The glmSimulationCacheTool command allows to fetch values of Simulation Cache Files (.gscf):
various glmSimulationCacheTool [-crowdField string] [-cacheName string] [-cacheDir string] [-layoutFiles string] [-getAttr string] [-entityIdx int] [-atIdx int] [-frame int]
This command relies on the Golaem Simulation Cache API and offers the same controls. The attributes are the same than the one specified in a Simulation Cache Proxy or Crowd Render Proxy node.
Beware, this command will only take into account layout changes that has been SAVED. Before launching it you should then make sure to save your layout file from the Layout Tool
Flags
Long name (short name) | Argument types | Properties | Description |
-crowdField (-cf) | string | mandatory | Name of the exported CrowdField |
-cacheName (-cn) | string | mandatory | Name of the exported cache |
-cacheDir (-cd) | string | mandatory | Directory where the Simulation Cache files have been exported |
-characterFiles (-gch) | string | Complete file paths of the Golaem Character files (.gcha) used by the Simulation Caches (separated with ;). This attribute is only required for fetching geometry data or frustum culling | |
-layoutFiles (-lfs) | string | Complete file paths of the Simulation Cache Layout files (.gscl) to apply to the Simulation Caches (separated with ;) | |
-terrainFile (-tf) | string | File path to the terrain geometry on which the Entities will be adapted when using the Simulation Cache Layout Tool. If none is specified, Entities will be adapted to the Source Terrain file. | |
-getAttr (-gat) | string | mandatory | Attribute to get. Available attributes are: entityCount, entityId, entityTypeIdx, entityScale, entityRadius, entityHeight, entityKilled, entityTypeCount, entityTypeBoneCount, entityTypeBlindDataCount, bonePosition, boneOrientation, blindDataValue (can be used either for Blind Data or Blend Shape value), ppFloatAttributeCount, ppFloatAttributeName, ppVectorAttributeCount, ppVectorAttributeName, ppFloatAttributeValue, ppVectorAttributeValue, characterFileId, meshId, renderingTypeId, shaderAttributeValue, inCameraFrustum, cameraDistance |
-entityIdx (-eix) | int | Entity index (between 0 and entityCount). If none is set, the values of all entities in the cache is returned | |
-atIdx (-aix) | int |
Index of the attribute value to return:
If this index is out of bounds, 0 is returned |
|
-frame (-fr) | int | Frame to return | |
-cameraName (-cam) | string | Name of the camera to evaluate. Only valid if getAttr is set to inCameraFrustum or cameraDistance. When set to inCameraFrustum, the frustum and the camera margin can be specified using this syntax: "cameraName;frustumMargin;cameraMargin" |
Return Value
This command returns either:
- a float value corresponding to the specified attribute if -entityIdx is set
- a float array corresponding to the specified attribute if -entityIdx is not set
MEL Examples
int $entityCount = `glmSimulationCacheTool -cf "field1" -cn "myCache" -cd "C:/" -getAttr "entityCount"`;
// Result: 10 //
int $typeIdx[] = `glmSimulationCacheTool -cf "field1" -cn "myCache" -cd "C:/" -getAttr "entityTypeIdx"`;
// Result: 0 0 0 0 0 1 1 1 1 1 //
int $boneCount[] = `glmSimulationCacheTool -cf "field1" -cn "myCache" -cd "C:/" -getAttr "entityTypeBoneCount"`;
// Result: 5 1 //
// Get bone position / orientation for each entity
for (int $iE=0; $iE < $entityCount; ++$iE)
{
int $entityBoneCount = $boneCount[ $typeIdx[ $iE ] ];
for (int $iB=0; $iB < $entityBoneCount; ++$iB)
{
float $bonePos[] = `glmSimulationCacheTool -cf "field1" -cn "myCache" -cd "C:/" -getAttr "bonePosition" -frame 5 -entityIdx $iE -atIdx $iB`;
float $boneOri[] = `glmSimulationCacheTool -cf "field1" -cn "myCache" -cd "C:/" -getAttr "boneOrientation" -frame 5 -entityIdx $iE -atIdx $iB`;
}
}
// For each bone position, of each entity, returns something like: Result: -0.18 -0.06 -1.53 //
// For each bone orientation, of each entity, returns something like: Result: 0 45 0 //
// If some Simulation Cache Layout modifications have been applied and save in a gscl file
float $bonePos[] = ` glmSimulationCacheTool -cf "field1" -cn "myCache" -cd "C:/" -lf "C:/layoutFile.gscl" -getAttr "bonePosition" -frame 5 -entityIdx 0 -atIdx 0`;
// Result: -2.18 -0.06 -1.53 //
Python Examples
import maya.cmds as cmds
entityCount = cmds.glmSimulationCacheTool(cf="field1", cn="myCache", cd="C:/", getAttr="entityCount")
// Result: 10 //
typeIndices = cmds.glmSimulationCacheTool(cf="field1", cn="myCache", cd="C:/", getAttr="entityTypeIdx")
// Result: 0 0 0 0 0 1 1 1 1 1 //
boneCount = cmds.glmSimulationCacheTool(cf="field1", cn="myCache", cd="C:/", getAttr="entityTypeBoneCount")
// Result: 5 1 //