|
@@ -0,0 +1,31 @@
|
|
|
+using UnityEngine;
|
|
|
+using UnityEditor;
|
|
|
+using System.IO;
|
|
|
+
|
|
|
+public class AnimationClipTool
|
|
|
+{
|
|
|
+ [MenuItem("Tools/ClipAnimToResFolder &1", true)]
|
|
|
+ static bool NotGetFiltered()
|
|
|
+ {
|
|
|
+ return Selection.activeObject;
|
|
|
+ }
|
|
|
+
|
|
|
+ [MenuItem("Tools/ClipAnimToResFolder &1")]
|
|
|
+ static void GetFiltered()
|
|
|
+ {
|
|
|
+ string targetPath = Application.dataPath + "/Res/Animation";
|
|
|
+ if (!Directory.Exists(targetPath))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(targetPath);
|
|
|
+ }
|
|
|
+ Object[] SelectionAsset = Selection.GetFiltered(typeof(Object), SelectionMode.Unfiltered);
|
|
|
+ foreach (Object Asset in SelectionAsset)
|
|
|
+ {
|
|
|
+ AnimationClip newClip = new AnimationClip();
|
|
|
+ EditorUtility.CopySerialized(Asset, newClip);
|
|
|
+ AssetDatabase.CreateAsset(newClip, "Assets/Res/Animation/" + Asset.name + ".anim");
|
|
|
+ Debug.Log($"Clip anim to : Assets/Res/Animation/{Asset.name}.anim");
|
|
|
+ }
|
|
|
+ AssetDatabase.Refresh();
|
|
|
+ }
|
|
|
+}
|