Skip to content

Commit

Permalink
Merge pull request #58 from mousedoc/feature/legacy-animation-creator
Browse files Browse the repository at this point in the history
Add legacy animation creator
  • Loading branch information
unitycoder authored Jun 23, 2022
2 parents f1a9afa + 8aaf227 commit 9254b83
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Assets/Scripts/Editor/Animation.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Scripts/Editor/Animation/LegacyAnimationCreator.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.IO;
using UnityEditor;
using UnityEngine;

public class LegacyAnimationCreator
{
[MenuItem("Assets/Create/Legacy Animation", priority = 402)]
public static void CompressSelectedAnimationClips()
{
var clip = new AnimationClip();
clip.legacy = true;
clip.name = "New Legacy Animation";

string path;
var selection = Selection.activeObject;
if (selection == null)
path = "Assets";
else
path = AssetDatabase.GetAssetPath(selection.GetInstanceID());

path = Path.GetDirectoryName(path);
path += $"/{clip.name}.anim";

ProjectWindowUtil.CreateAsset(clip, path);
Selection.activeObject = clip;
EditorUtility.SetDirty(clip);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9254b83

Please sign in to comment.