mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-28 10:15:06 +08:00
feat: Added BlendTree to right click create asset menu. (#555)
* Added BlendTree to right click create asset menu. Not sure where to put it, so into the root editor folder it goes. * Update CreateBlendTree.cs * chore: add missing .meta file --------- Co-authored-by: bd_ <bd_@nadena.dev>
This commit is contained in:
parent
d297cf1cad
commit
63043cb4ec
32
Editor/CreateBlendTree.cs
Normal file
32
Editor/CreateBlendTree.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Animations;
|
||||
using UnityEditor.ProjectWindowCallback;
|
||||
using UnityEngine;
|
||||
|
||||
namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
internal static class CreateBlendTree
|
||||
{
|
||||
[MenuItem("Assets/Create/BlendTree", priority = 411)]
|
||||
static void CreateNewBlendTree()
|
||||
{
|
||||
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(
|
||||
0,
|
||||
Editor.CreateInstance<DoCreateBlendTree>(),
|
||||
"New BlendTree.asset",
|
||||
EditorGUIUtility.IconContent("BlendTree Icon").image as Texture2D,
|
||||
null);
|
||||
}
|
||||
|
||||
class DoCreateBlendTree : EndNameEditAction
|
||||
{
|
||||
public override void Action(int instanceId, string pathName, string resourceFile)
|
||||
{
|
||||
BlendTree blendTree = new BlendTree { name = Path.GetFileNameWithoutExtension(pathName) };
|
||||
AssetDatabase.CreateAsset(blendTree, pathName);
|
||||
Selection.activeObject = blendTree;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Editor/CreateBlendTree.cs.meta
Normal file
11
Editor/CreateBlendTree.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e608a27c3d14edf43858004513948da1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user