Question by
apapineni · Oct 29, 2019 at 02:11 AM ·
animationeditoreditor-scriptingprogramminganimation events
How to copy and paste animation events from one clip to another if those clips are included in FBXs?
I made a little editor extension to copy and paste animation events between clips but it only seems to work for clips that are not part of an FBX. For whatever reason if it is part of an FBX the meta file just doesn't change. Is there anything additional I need to do to get this working with those other anim clips?
private static AnimationEvent[] clipboard;
[MenuItem("Assets/Copy Events")]
private static void Copy()
{
clipboard = AnimationUtility.GetAnimationEvents((AnimationClip) (Selection.activeObject));
}
[MenuItem("Assets/Copy Events", true)]
private static bool CopyValidation()
{
return Selection.activeObject.GetType() == typeof(AnimationClip);
}
[MenuItem("Assets/Paste Events")]
private static void Paste()
{
AnimationClip clip = ((AnimationClip) (Selection.activeObject));
AnimationUtility.SetAnimationEvents(clip, clipboard);
EditorUtility.SetDirty(clip);
AssetDatabase.SaveAssets();
}
[MenuItem("Assets/Paste Events", true)]
private static bool PasteValidation()
{
return Selection.activeObject.GetType() == typeof(AnimationClip);
}
Comment
Your answer
Follow this Question
Related Questions
Any easy way to rearrange scene names 1 Answer
Applying values from an animationClip to bones of a skinnedMesh via code? 0 Answers
How to draw a model in the preview window of my custom editor using OnPreviewGUI? 0 Answers
Controlling animation editor programatically 0 Answers
OnValidate For Other Components? 0 Answers