glmConvertFbxToGcg

The functions glmConvertFbxToGcg allows to convert an existing Character File (.gcha) linked to a Fbx Geometry File to the new Gcg Geometry File format available since Golaem 5.3.
glmConvertFbxToGcg -in aGchaFile.gcha [-out outputFile.gcg] [-mg true/false] [-og true/false];

Flags

Long name (short name) Argument types Properties Description
-inputGCHAFile (-in) string mandatory File path to the gcha File to convert
-outputGCGFile(-out) string   name of the converted gcg (by default, the same name as the FBX file)
-modifyGCHA(-mg) boolean   Indicates if the gcha must be saved with gcg file as geometry, once gcg has been produced
-overwriteGCG(-og) boolean   If true, and the GCG already exists, the converter looks for a FBX with the same name and try to convert it again, and overwrite existing gcg with the new conversion if found.

Return Value

The command returns true if the conversion went well, else false

Mel Example

glmConvertFbxToGcg -in "C:\temp\horse.gcha" -mg true -og true;;
// [GolaemCrowd]: Converting mesh 0 / 5 of C:\temp\horse.fbx to gcg // 
// [GolaemCrowd]: Converting mesh 1 / 5 of C:\temp\horse.fbx to gcg // 
// [GolaemCrowd]: Converting mesh 2 / 5 of C:\temp\horse.fbx to gcg // 
// [GolaemCrowd]: Converting mesh 3 / 5 of C:\temp\horse.fbx to gcg // 
// [GolaemCrowd]: Converting mesh 4 / 5 of C:\temp\horse.fbx to gcg // 
// Warning: [GolaemCrowd]: The GCHA file 'c:/temp/horse.gcha' geometry file was converted to GCG file 'C:\temp\horse.gcg'
 

Recursive mel example

One could be interested in converting a whole folder of gcha files to gcg at once. Here are some helpers to achieve that :

global proc convertFile(string $filename, int $modifyGCHA, int $overwrite)
{
   glmConvertFbxToGcg -in $filename -modifyGCHA ($modifyGCHA==true) -overwriteGCG ($overwrite==true);
}

global proc glmConvertFolderToGcgRecursive(string $folder, int $modifyGCHA, int $overwrite )
{
   if (! `pluginInfo -q -loaded "glmCrowd"` && ! `pluginInfo -q -loaded "glmCrowd_d"`)  
   {
      print ("Crowd plugin not loaded, cannot convert to gcg.\n");
      return;
   }
    
   // search for files in given folder
   string $searchFolder = ($folder + "/");
    
   // if file, check for extension
   string $gchaFiles[] = glmGetFilesOfExtension($folder, "gcha", true);
   int $gchaCount = size($gchaFiles);
    
   print("Found " + $gchaCount +" gcha to convert in "+$folder+".\n");
    
   int $iGCHA = 0;
   for( $gchafile in $gchaFiles )
   {
      print("Converting gcha " + ($iGCHA+1) + " / " + $gchaCount + " - " + $gchafile+".\n");
      convertFile($gchafile, $modifyGCHA, $overwrite);
      $iGCHA = $iGCHA + 1;
   }
    
   print("End of GCHAs conversion.\n");
}