-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from mousedoc/feature/legacy-animation-creator
Add legacy animation creator
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
Assets/Scripts/Editor/Animation/LegacyAnimationCreator/LegacyAnimationCreator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Scripts/Editor/Animation/LegacyAnimationCreator/LegacyAnimationCreator.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.