glmCharacterFileTool

The glmCharacterFileTool command allows to get / set attributes of a Character File (.gcha):
various glmCharacterFileTool [-characterFile string] [-getAttr string] [-setAttr string] [-value string]

Flags

Long name (short name) Argument types Properties Description
-characterFile (-gch) string mandatory File path to the Character File to get / set.
-getAttr (-gat) string   Attribute to get. Available attributes are: shaders, shaderGroups, shaderAttributes, missingShaders, missingShaderGroups, boundingBoxes, renderingTypes, geoFilePaths, clothFilePaths, furFilePaths, meshAssets, pelvis (for pelvis name), pelvisPosition, bones (for all bone names), sortedBones (for all bone names sorted in the same order than in the Simulation Cache), bonePositions, physicalizedBones, limbs, effectors, blindDataGroups, blindData (will return both Blind Data and Blend Shapes), blindDataInfo, groundHeight
-setAttr (-sat) string   Attribute to set. Available attributes are: geoFilePaths, clothFilePaths, furFilePaths
-value (-v) string mandatory when setAttr is set Value of the attribute to set

Return Value

This command returns either:
  • a string array if -getAttr is set with the value of shaders, shaderGroups, shaderAttributes, missingShaders, missingShaderGroups, renderingTypes, geoFilePaths, clothFilePaths, furFilePaths 
  • a float array if -getAttr is set with the value of boundingBoxes (first 3 returned values correspond to the bounding box of the first Geometry Group defined in the Character File...)
  • a boolean value if -setAttr is set

MEL Examples

string $shaders[] = `glmCharacterFileTool -characterFile "C:/CMO-man.gcha" -getAttr "shaders"`;
// Result: MAN_MD_top_hair MAN_MD_torso_tshirt MAN_MD_body MAN_MD_torso_sweatshirt MAN_MD_legs_pants MAN_MD_legs_shoes_sport MAN_MD_flag_stickFlag MAN_MD_flag_clothFlag //
float $bboxes[] = `glmCharacterFileTool -characterFile "C:/CMO-man.gcha" -getAttr "boundingBoxes"`;
// Result: 6 8 6 //
string $geos[] = `glmCharacterFileTool -characterFile "C:/CMO-man.gcha" -getAttr "geoFilePaths"`;
// Result: 0;0;0;C:/CMO-man.gcg //

glmCharacterFileTool -characterFile "C:/CMO-man.gcha" -setAttr "geoFilePaths" -value "D:/CMO-man.gcg";
// NB: for files with multiple .gcg files, just use all file paths separated by ";". E.g : "pathToGcgFile01.gcg;pathToGcgFile02.gcg"
// Result: 1 //

Python Examples

import maya.cmds as cmds
cmds.glmCharacterFileTool(characterFile="C:/CMO-man.gcha", getAttr="shaders")
# Result: [u'MAN_MD_top_hair', u'MAN_MD_torso_tshirt', u'MAN_MD_body', u'MAN_MD_torso_sweatshirt', u'MAN_MD_legs_pants', u'MAN_MD_legs_shoes_sport', u'MAN_MD_flag_stickFlag', u'MAN_MD_flag_clothFlag'] #
cmds.glmCharacterFileTool(characterFile="C:/CMO-man.gcha", getAttr="boundingBoxes")
# Result: [6.0, 8.0, 6.0] #
cmds.glmCharacterFileTool(characterFile="C:/CMO-man.gcha", getAttr="geoFilePaths")
# Result: [u'0;0;0;CMO-man.gcg'] # 

cmds.glmCharacterFileTool(characterFile="C:/CMO-man.gcha", setAttr="geoFilePaths", value="D:/CMO-man.gcg")
# NB: for files with multiple .gcg files, just use all file paths separated by ";". E.g : "pathToGcgFile01.gcg;pathToGcgFile02.gcg"

# Result: True #