I'm about done creating all the lip-sync animations for our project and now I wish to export my work. However I have about 200 animations in total. I also need them to have a few specific settings.
Now I know this should be possible via console commands, however I am a bit lost when it comes to this sort of thing.
Would it be possible to export all animations in the Default group to .fbx files with these settings?
-reducekeys "false"
-fps "30"
-format "-1"
Sure, but you'll need to use Python. You can export a single .fbx first to see the actual command Studio is using (look in the Console tab, or look up the command syntax in the documentation if you want to customize it). Then you just need to loop through all animations and issue the command you want.
We don't have a -reducekeys argument, but you can pass a negative number for -keypreceision which will turn off key reduction. (You can type %fbx? at the Python shell to get extended help on the fbx command)
For example: I exported Default/welcome to my desktop from the Slade sample that ships with FaceFX 2013 and Studio issued the following command:
fbx -keyprecision "0.001000" -format "0" -starttime "-0.382667" -endtime "6.486031" -fullskeleton "true" -outfile "C:\Users\Jamie Redmond\Desktop\Slade@Default_welcome.fbx" -infile "C:\Program Files (x86)\FaceFX\FaceFX Studio Professional 2013\Samples\Src\Slade.fbx" -group "Default" -anim "welcome";
Let's say I wanted to do that for all of the animations in all groups in Slade. I'm also going to ignore the keyprecision and start/end time arguments to use the defaults for simplicity here. I would execute the following Python code (you can type it into the Python shell or put it into a .py file via notepad and just drag it onto the Studio render window to execute it -- but be very careful with indentation with Python, though! In the following code, indentation is with TABS, and the FxStudio.issueCommand is one single line):
import FxStudio
import FxAnimation
anim_names = FxStudio.getAnimationNames()
for group in anim_names:
for anim in group[1]:
FxStudio.issueCommand('fbx -format "0" -fullskeleton "true" -outfile "C:\Users\Jamie Redmond\Desktop\{0}@{1}_{2}.fbx" -infile "C:\Program Files (x86)\FaceFX\FaceFX Studio Professional 2013\Samples\Src\Slade.fbx" -group "{1}" -anim "{2}"'.format(FxStudio.getActorName(), group[0], anim))
Just to add to what Jamie said, the reducekeys option was available in FaceFX 2012 and prior versions. There were significant changes in the FBX command for FaceFX 2013, and going from a boolean "reducekeys" to a float "keyprecision" variable was one of the improvements.
Hey guys, thanks for the reply!
I am using FaceFX 2012 and I cannot seem to get the script to work at all over here.
I have to change it until it looks like this:
%fbx -reducekeys "false" -format "0" -starttime "0" -file "C:\test\test.fbx" -group "Default" -anim "pcp_120";
And that seems to work for one file. Then I clumsily attempt to put that into the multiple export script(I obviously have no idea what I am doing).
import FxStudio
import FxAnimation
anim_names = FxStudio.getAnimationNames()
for group in anim_names:
for anim in group[1]:
FxStudio.issueCommand('%fbx -reducekeys "false" -format "0" -starttime "0" -file "C:\Test\{0}@{1}_{2}.fbx" -group "{1}" -anim "{2}"'.format(FxStudio.getActorName(), group[0], anim))
And nothing happens, not even an error. Any idea on what I am doing wrong here?
The %fbx is when running the "fbx" command directly from the Python shell prompt. When inside of issueCommand(), you need to run it as if it were in an .fxl file or if you typed it into the command panel at the bottom of the application. Change your issueCommand('%fbx to issueCommand('fbx exactly like in my example.
Thanks Jamie, I removed the % now. I am still getting the same response when trying to run it though. Nothing happens, no errors or such either.
command-panel.png
python-shell.png
bulk-export-fbx.py.png
Thanks for the screenshots, they help a lot! It seems I have made two mistakes(that we know of) thus far:
1) I did not know that the directories are not created automatically. I've now made a folder for it.
2) I attempted to paste the script directly into the Python Shell before. I have now made it into a .py file instead. and put it here: C:\FaceFX Scripts\exportAll.py
Now I get an error when trying to run the script via the exec command (Looks like this: %exec -f "C:\FaceFX Scripts\exportAll.py").
Out[1]: ---------------------------------------------------------------------------
IndentationError Traceback (most recent call last)
IndentationError: expected an indented block (, line 7)
And here is how the script looks like:
import FxStudio
import FxAnimation
anim_names = FxStudio.getAnimationNames()
for group in anim_names:
for anim in group[1]:
FxStudio.issueCommand('fbx -reducekeys "false" -format "0" -fps "30" -starttime "0" -file "C:\Test\{0}@{1}_{2}.fbx" -group "{1}" -anim "{2}"'.format(FxStudio.getActorName(), group[0], anim))
I guess I might have broken something in there...
Like I mentioned, Python is *very* sensitive to indentation. That's how it delimits code blocks.
Make sure it's like this (<tab> means press tab, and you can see how it should look in the screenshot of the script above):
for group in anim_names:
<tab>for anim in group[1]:
<tab><tab>FxStudio.isssueCommand
Alternatively, you can type the script into the Python shell one line at a time and it will automatically indent.
And there's my third mistake!
I have put in the tabs now and the script runs just fine.
Thank you very much for the help Jamie! This is going to save me a ton of time.