I am currently working on a tool for my production. This tool includes an FBX exporter using two presets, one for a skeletalMesh and one for animation on that skeletalMesh. What this tool will do is allow the animator (or tech-artist) to export their animation using a click of a button rather than have to go into the FBX exporter function inside of Maya. The same can be said for the skeletalMesh.
I currently see there are two options. Either load “preset files” which I have already placed in a special location on PerForce. I can load the script on my computer using the following code:
pm.mel.eval(‘FBXLoadExportPresetFile -f “E:/PerForce/WorkSpace/UE4/HGGame/ArtScripts/Maya/Animation.fbxexportpreset”;’)
As a note, I have tried to make a straight pymel command but am returned with this error:
Error: RuntimeError: file <string> line 2: FBXLoadExportPresetFile: Error bad syntax.
Use syntax: FBXLoadExportPresetFile -f “filepath” #
The issue with the above MEL code is that my team’s file path to PerForce are all different. I want to use $ so that we can replace the E:/ and have Maya automatically locate the file it needs. Replacing any relevant pieces of the filepath returns:
// Error: Preset file not found. //
// Error: $perforce\UE4\HGGame\ArtScripts\Maya\Animation.fbxexportpreset //
Error: MelError: file C:\Program Files\Autodesk\Maya2014\Python\lib\site-packages\pymel\core\language.py line 846: Error during execution of MEL script: Preset file not found.
So obviously it is not looking for the correct location. Does anyone know how I can use a variable so that we can find the file across multiple platforms?
Also, if the above cannot be done, my other option is to find every single line of code that is needed to export the different types of files I am looking for. This would take a lot longer and would be far worse to look at, code wise, as it could theoretically add several hundred lines of code. If needed, I can do this but it would take a lot more time.