Looking for SaveActor callback

Hi, we're using FaceFX 2010. To automate generating animations from sound and text files, we would like to keep track of which animations have been freshly generated and which ones have been further modified.

The documentation lists the python callbacks 'postanalysis' (new animation) and 'newanimationdataavailable' (for whenever an animation is modified) that seem like they could be used for this. What's still missing is some kind of callback when the analysis actor is getting saved. Am I missing something obvious, or do I have to modify the C++ source code for this?

Thanks in advance,

jpeg

Permalink

I'm not sure I follow. You say you need to know when an animation has been created via analysis, and you can do that with the postanalysis Python signal. You can't use newanimationdataavailable for detecting animation modified, though. It's true that the signal is fired when you edit the animation, but it is also fired just by scrubbing the timeline (technically that is modifying the animation since Studio remembers the current time in the editor only data, but that's not the type of modification you're looking for). The purpose of newanimationdataavailable is so that you can hook up an external renderer (say a running copy of your game on another machine) and update the character with new bone transform data and / or morph target / material parameter values to sync up the character in the external system with how it looks in FaceFX Studio.

Can you explain why you need to know each time the .facefx file is saved? If you're trying to keep some external file updated with which animations have been touched, I'd suggest using FaceFX 2012 where you can embed python data directly in an animation via the animation's python dictionary. In that case you wouldn't need to know when the file is saved because if it is saved the python data will be saved and embedded in the file itself.

Permalink

About 'newanimationdataavailable', that was what I was worried about. Thanks for explaining how it is used.

Yes, it's exactly that I want to have a log of which animations are no longer safe to overwrite by an auto-analysis.

I'm afraid we won't be able to upgrade any time soon. I guess that means back to the drawing board, trying to find an alternative solution.

Thanks.

Permalink

You could get this behavior strictly using Python. One approach would be to cache what the animation state is immediately after the analysis. If you look into the Python classes provided in FaceFX (FxAnimation, for example), you can get a Python representation of any animation in the actor. This includes all curves and keys, all phonemes and words, etc. So after a batch analysis, you could loop through the animations, grab the Python representation, pickle it, hash those bytes, and store that hash in a file. When determining which animations are safe to overwrite later, you could compare the animation's current hash with its original hash in that file. If the animations are the same, it's safe to overwrite; if they are different something has modified the animation from its original state and it's not safe to overwrite.

In 2010 you'll have to store the original animation hash as a post process of the entire batch, rather than after each individual analysis because there is a bug in 2010 where the animation has not been fully created when the postanalysis signal is fired (this has been fixed in 2012).

I'll add a feature request for 2013 to keep track internally of which animations have been hand edited and expose it via Python so it is easier to make these kinds of decisions in future versions.

When you reanalyze everything, why are you doing that and overwriting previous analysis results? Is it because the audio or text change, or are the audio and text the same as the prior analysis? What would you do if the audio or text changed for an animation that had already been hand edited, for example?

We've also toyed with the idea of storing hashes of the audio and text so FaceFX can automatically detect audio and text changes. Would that also be helpful?

Permalink

Thanks, that sounds like a good way to go about it.

As for why re-analysis might become necessary, the sound files are very unlikely to have changed but the text files could end up being modified several times (mostly involving tag modifications) and it would be a shame if the scripted batch processing became impossible once the animations already exist. If an animation is not safe for auto-overwrite, we could issue a warning or write it into a log, and let the person running the process decide whether to allow overwriting the animations or not.

Yes, autodetection of audio/text changes sounds like it could be really useful.

Thank you!