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.

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
-layoutFileName (-lfn) string   Complete file path of the Simulation Cache Layout file
-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, blindDataValue (can be used either for Blind Data or Blend Shape value), ppFloatAttributeCount, ppFloatAttributeName, ppVectorAttributeCount, ppVectorAttributeName, 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). The bone order can be queried using the -sortedBones flag of the glmCharacterFileTool command.
  • if getAttr is set to blendShapeValue, it corresponds to the blendshape index (between 0 and entityTypeBlendShapeCount). The bone order can be queried using the -blindData flag of the glmCharacterFileTool command.
  • if getAttr is set to ppAttributeValue, it corresponds to the PPAttribute index (between 0 and ppAttributeCount). The bone order can be queried using the -ppAttributeName flag of this command.

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:/" -lfn "C:/layoutFile.gscl" -getAttr "bonePosition" -frame 5 -entityIdx 0 -atIdx 0`;
// Result: -2.18 -0.06 -1.53 //