forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimationStream.bindings.cs
More file actions
178 lines (141 loc) · 6.31 KB
/
Copy pathAnimationStream.bindings.cs
File metadata and controls
178 lines (141 loc) · 6.31 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
using System.Runtime.InteropServices;
using UnityEngine.Bindings;
using UnityEngine.Scripting;
using UnityEngine.Scripting.APIUpdating;
namespace UnityEngine.Animations
{
internal enum AnimatorBindingsVersion
{
// Invalid.
kInvalidNotNative = 0, // Created in C# (with new)
kInvalidUnresolved = 1, // Created in C++, but still unresolved
// Valid.
kValidMinVersion = 2 // Minimum valid version
}
[MovedFrom("UnityEngine.Experimental.Animations")]
[NativeHeader("Modules/Animation/ScriptBindings/AnimationStream.bindings.h")]
[NativeHeader("Modules/Animation/Director/AnimationStream.h")]
[RequiredByNativeCode]
[StructLayout(LayoutKind.Sequential)]
public struct AnimationStream
{
private UInt32 m_AnimatorBindingsVersion;
private System.IntPtr constant;
private System.IntPtr input;
private System.IntPtr output;
private System.IntPtr workspace;
private System.IntPtr inputStreamAccessor;
private System.IntPtr animationHandleBinder;
internal const int InvalidIndex = ~0;
internal UInt32 animatorBindingsVersion
{
get { return m_AnimatorBindingsVersion; }
}
public bool isValid
{
get
{
return m_AnimatorBindingsVersion >= (UInt32)AnimatorBindingsVersion.kValidMinVersion &&
constant != System.IntPtr.Zero &&
input != System.IntPtr.Zero &&
output != System.IntPtr.Zero &&
workspace != System.IntPtr.Zero &&
animationHandleBinder != System.IntPtr.Zero;
}
}
internal void CheckIsValid()
{
if (!isValid)
throw new InvalidOperationException("The AnimationStream is invalid.");
}
public float deltaTime
{
get { CheckIsValid(); return GetDeltaTime(); }
}
public Vector3 velocity
{
get { CheckIsValid(); return GetVelocity(); }
set { CheckIsValid(); SetVelocity(value); }
}
public Vector3 angularVelocity
{
get { CheckIsValid(); return GetAngularVelocity(); }
set { CheckIsValid(); SetAngularVelocity(value); }
}
public Vector3 rootMotionPosition
{
get { CheckIsValid(); return GetRootMotionPosition(); }
}
public Quaternion rootMotionRotation
{
get { CheckIsValid(); return GetRootMotionRotation(); }
}
public bool isHumanStream
{
get { CheckIsValid(); return GetIsHumanStream(); }
}
public AnimationHumanStream AsHuman()
{
CheckIsValid();
if (!GetIsHumanStream())
throw new InvalidOperationException("Cannot create an AnimationHumanStream for a generic rig.");
return GetHumanStream();
}
public int inputStreamCount
{
get { CheckIsValid(); return GetInputStreamCount(); }
}
public AnimationStream GetInputStream(int index)
{
CheckIsValid();
return InternalGetInputStream(index);
}
public float GetInputWeight(int index)
{
CheckIsValid();
return InternalGetInputWeight(index);
}
public void CopyAnimationStreamMotion(AnimationStream animationStream)
{
CheckIsValid();
animationStream.CheckIsValid();
CopyAnimationStreamMotionInternal(animationStream);
}
private void ReadSceneTransforms() { CheckIsValid(); InternalReadSceneTransforms(); }
private void WriteSceneTransforms() { CheckIsValid(); InternalWriteSceneTransforms(); }
[NativeMethod(Name = "AnimationStreamBindings::CopyAnimationStreamMotion", IsFreeFunction = true, IsThreadSafe = true, HasExplicitThis = true)]
private extern void CopyAnimationStreamMotionInternal(AnimationStream animationStream);
[NativeMethod(IsThreadSafe = true)]
private extern float GetDeltaTime();
[NativeMethod(IsThreadSafe = true)]
private extern bool GetIsHumanStream();
[NativeMethod(Name = "AnimationStreamBindings::GetVelocity", IsFreeFunction = true, IsThreadSafe = true, HasExplicitThis = true)]
private extern Vector3 GetVelocity();
[NativeMethod(Name = "AnimationStreamBindings::SetVelocity", IsFreeFunction = true, IsThreadSafe = true, HasExplicitThis = true)]
private extern void SetVelocity(Vector3 velocity);
[NativeMethod(Name = "AnimationStreamBindings::GetAngularVelocity", IsFreeFunction = true, IsThreadSafe = true, HasExplicitThis = true)]
private extern Vector3 GetAngularVelocity();
[NativeMethod(Name = "AnimationStreamBindings::SetAngularVelocity", IsFreeFunction = true, IsThreadSafe = true, HasExplicitThis = true)]
private extern void SetAngularVelocity(Vector3 velocity);
[NativeMethod(Name = "AnimationStreamBindings::GetRootMotionPosition", IsFreeFunction = true, IsThreadSafe = true, HasExplicitThis = true)]
private extern Vector3 GetRootMotionPosition();
[NativeMethod(Name = "AnimationStreamBindings::GetRootMotionRotation", IsFreeFunction = true, IsThreadSafe = true, HasExplicitThis = true)]
private extern Quaternion GetRootMotionRotation();
[NativeMethod(IsThreadSafe = true)]
private extern int GetInputStreamCount();
[NativeMethod(Name = "GetInputStream", IsThreadSafe = true)]
private extern AnimationStream InternalGetInputStream(int index);
[NativeMethod(Name = "GetInputWeight", IsThreadSafe = true)]
private extern float InternalGetInputWeight(int index);
[NativeMethod(IsThreadSafe = true)]
private extern AnimationHumanStream GetHumanStream();
[NativeMethod(Name = "ReadSceneTransforms", IsThreadSafe = true)]
private extern void InternalReadSceneTransforms();
[NativeMethod(Name = "WriteSceneTransforms", IsThreadSafe = true)]
private extern void InternalWriteSceneTransforms();
}
}