导入角色动画,和增加角色控制

This commit is contained in:
2025-12-11 19:30:20 +08:00
parent a60a92e7ba
commit 7775fa30bb
1452 changed files with 592217 additions and 42573 deletions

View File

@@ -0,0 +1,63 @@
// Designed by KINEMATION, 2025.
using KINEMATION.MagicBlend.Runtime;
using UnityEditor;
using UnityEngine;
namespace KINEMATION.MagicBlend.Editor
{
public class MagicDragAndDrop
{
private static DragAndDropVisualMode OnHierarchyDrop(int dropTargetInstanceID, HierarchyDropFlags dropMode,
Transform parentForDraggedObjects, bool perform)
{
var asset = DragAndDrop.objectReferences[0] as MagicBlendAsset;
if (asset == null)
{
return DragAndDropVisualMode.None;
}
if (perform)
{
var selection = Selection.activeGameObject;
if (selection != null)
{
var component = selection.GetComponent<MagicBlending>();
if (component == null) component = selection.AddComponent<MagicBlending>();
component.SetMagicBlendAsset(asset);
}
}
return DragAndDropVisualMode.Copy;
}
private static DragAndDropVisualMode OnInspectorDrop(UnityEngine.Object[] targets, bool perform)
{
var asset = DragAndDrop.objectReferences[0] as MagicBlendAsset;
if (asset == null)
{
return DragAndDropVisualMode.None;
}
if (perform)
{
var selection = Selection.activeGameObject;
if (selection != null)
{
var component = selection.GetComponent<MagicBlending>();
if (component == null) component = selection.AddComponent<MagicBlending>();
component.SetMagicBlendAsset(asset);
}
}
return DragAndDropVisualMode.Copy;
}
[InitializeOnLoadMethod]
private static void OnLoad()
{
DragAndDrop.AddDropHandler(OnInspectorDrop);
DragAndDrop.AddDropHandler(OnHierarchyDrop);
}
}
}