forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlendTree.cs
More file actions
149 lines (149 loc) · 4.19 KB
/
Copy pathBlendTree.cs
File metadata and controls
149 lines (149 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
namespace UnityEditor.Animations
{
public sealed class BlendTree : Motion
{
public extern string blendParameter
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
set;
}
public extern string blendParameterY
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
set;
}
public extern BlendTreeType blendType
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
set;
}
public extern ChildMotion[] children
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
set;
}
internal extern int recursiveBlendParameterCount
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public BlendTree()
{
BlendTree.Internal_Create(this);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_Create(BlendTree mono);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
internal extern void SortChildren();
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
internal extern string GetRecursiveBlendParameter(int index);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
internal extern float GetRecursiveBlendParameterMin(int index);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
internal extern float GetRecursiveBlendParameterMax(int index);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
internal extern void SetInputBlendValue(string blendValueName, float value);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
internal extern float GetInputBlendValue(string blendValueName);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
internal extern AnimationClip[] GetAnimationClipsFlattened();
public void AddChild(Motion motion)
{
this.AddChild(motion, Vector2.zero, 0f);
}
public void AddChild(Motion motion, Vector2 position)
{
this.AddChild(motion, position, 0f);
}
public void AddChild(Motion motion, float threshold)
{
this.AddChild(motion, Vector2.zero, threshold);
}
public void RemoveChild(int index)
{
ChildMotion[] children = this.children;
ArrayUtility.RemoveAt<ChildMotion>(ref children, index);
this.children = children;
}
internal void AddChild(Motion motion, Vector2 position, float threshold)
{
Undo.RecordObject(this, "Added BlendTree Child");
ChildMotion[] children = this.children;
ArrayUtility.Add<ChildMotion>(ref children, new ChildMotion
{
timeScale = 1f,
motion = motion,
position = position,
threshold = threshold,
directBlendParameter = "Blend"
});
this.children = children;
}
public BlendTree CreateBlendTreeChild(float threshold)
{
return this.CreateBlendTreeChild(Vector2.zero, threshold);
}
public BlendTree CreateBlendTreeChild(Vector2 position)
{
return this.CreateBlendTreeChild(position, 0f);
}
internal bool HasChild(BlendTree childTree, bool recursive)
{
ChildMotion[] children = this.children;
for (int i = 0; i < children.Length; i++)
{
ChildMotion childMotion = children[i];
if (childMotion.motion == childTree)
{
return true;
}
if (recursive && childMotion.motion is BlendTree && (childMotion.motion as BlendTree).HasChild(childTree, true))
{
return true;
}
}
return false;
}
internal BlendTree CreateBlendTreeChild(Vector2 position, float threshold)
{
Undo.RecordObject(this, "Created BlendTree Child");
BlendTree blendTree = new BlendTree();
blendTree.name = "BlendTree";
blendTree.hideFlags = HideFlags.HideInHierarchy;
if (AssetDatabase.GetAssetPath(this) != string.Empty)
{
AssetDatabase.AddObjectToAsset(blendTree, AssetDatabase.GetAssetPath(this));
}
this.AddChild(blendTree, position, threshold);
return blendTree;
}
}
}