- Home /
Editor script to dump curves of animation clip to text file
I am looking for an editor script which can read all the curves from animation clip attached to the gameobject and log the keyframe / curve values to a text file.
After that, I can create AnimationClip runtime by reading the keyframe/curve data from the same text file. (This way I can modify any necessary property values if needed).
Is there a editor script available ? If not, kindly help me how I can write my own editor script to do this. Perhaps I have to use AnimationUtilty class for this.
I did something of a curve reader for animation curves, I don't know how to access animation clip information sorry. Here is my answer on animation curves, the reader part may help when you find how to access the Animation Clip information : http://answers.unity3d.com/questions/320689/derive-an-equation-from-a-graph.html
Edit : After a quick search, it seems the Animation Clip curves are not that accessible. The best 2 answers point to AnimationUtility :
http://docs.unity3d.com/Documentation/ScriptReference/AnimationUtility.html
http://answers.unity3d.com/questions/33388/accessing-keyframes-from-an-animation.html
http://forum.unity3d.com/threads/29080-How-to-get-a-curve-inside-an-AnimationClip
Sorry, have no knowledge on animation clips, but am upvoting this question. Good Luck =]
You are right. Using AnimationUtility class clips can be opened and curves and keyframe data/values can be read. Using this technique we can dump the keyframe values to a text file (I like to dump it to a JSON file).
Is there any Editor Script available on internet which does such dumping ?
Answer by appearance · Jan 30, 2013 at 09:17 AM
I wrote such a script myself. It can be found here
In my next post, I will write a script which will use this JSON file to create animation clip at run-time and use it with game object(s).