glmSimulationCacheTool

The glmSimulationCacheTool command allows to fetch values of Simulation Cache Files (.gscf):
various glmSimulationCacheTool [-crowdField string] [-cacheName string] [-cacheDir string] [-getAttr string] [-entityIdx int] [-atIdx int] [-frame int]

This command relies on the Golaem Simulation Cache API and offers the same controls.

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
-layoutName (-ln) string   Name of the Simulation Cache Layout file
-layoutDir (-cd) string   Directory where the Simulation Cache Layout file has been exported
-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, entityTypeBlendShapeCount, bonePosition, blindDataValue (can be used either for Blind Data or Blend Shape value), ppAttributeCount, ppAttributeName, ppAttributeValue, characterFileId, meshId, shaderAttributeValue
-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 getAttr is set to bonePosition, it corresponds to the bone index (between 0 and entityTypeBoneCount)
  • if getAttr is set to blendShapeValue, it corresponds to the blendshape index (between 0 and entityTypeBlendShapeCount)
  • if getAttr is set to ppAttributeValue, it corresponds to the PPAttribute index (between 0 and ppAttributeCount)

If this index is out of bounds, 0 is returned

-frame (-fr) int   Frame to return

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 for each entity

for (int $iE=0; $iE < $entityCount; $iE++)
{

   int $entityBoneCount = $boneCount[ $typeIdx[ $iE ] ];
   for (int $iB=0; $iB < $entityBoneCount; $iB++)
   {

      float $bonePosition[] = `glmSimulationCacheTool -cf "field1" -cn "myCache" -cd "C:/" -getAttr "bonePosition" -frame 5 -entityIdx $iE -atIdx $iB`;
   }
}
// For each bone, of each entity, returns something like: Result: -0.18 -0.06 -1.53 //

// If some Simulation Cache Layout modifications have been applied and save in a gscl file

float $bonePosition[] = ` glmSimulationCacheTool -cf "field1" -cn "myCache" -cd "C:/" -ln "layout" -ld "C:/" -getAttr "bonePosition" -frame 5 -entityIdx 0 -atIdx `;
// Result: -2.18 -0.06 -1.53 //