How do I duplicate an fbx animation clip via script?

Hi all, I hope you can help me with this problem…

I’m writing an animation system and need to be able to duplicate an animation clip that is within an fbx file. This can be done via the project view by selecting the clip within the fbx asset and duplicating normally, but for the life of me I can’t work out how to do it in script. I can duplicate the whole fbx file, but not the clip within it.

Can anyone help? Much appreciated if so!

Thanks

Adrian

Welcome dude… glad you finally jumped in :slight_smile:

Hi, welcome to the forum!

Are you doing this with an editor script? Is there any chance you could give a bit more detail about what you are doing?

Hi andeeee, thanks for the welcome…

Yes, I’m using an editor script. I’m writing a node based animation blending system with it’s own ui inside Unity3d. I’d like to be able to import animation clips from fbx files but then duplicate it in order to get access to the AnimationEvents as well as be able to create new animation f-curves inside the animation clips. I can do all this already, but it means manually duplicating the clip rather than it all being within the ui I’ve created. I’ve had a pretty close look at the AssetDatabase class but have only managed to duplicate a whole fbx file, not an animation clip within it.

Thanks for any thoughts.

Adrian

Have you checked out the AnimationUtility class?

Re: AnimationUtility class… I’ve had a look and as far as I can see, there is no way to duplicate a clip, I suppose I could find a clip, get all the curves and copy them all… I was hoping for an easier way.

cheers,

Adrian

Since this appears in Google i figured I might as well answer it. I had the same problem and just found out a solution to it. I posted it here.
http://answers.unity3d.com/questions/813960/extract-animations-from-fbx-model-per-script.html?sort=newest