forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimationLayerMixerPlayable.bindings.cs
More file actions
105 lines (85 loc) · 4.25 KB
/
Copy pathAnimationLayerMixerPlayable.bindings.cs
File metadata and controls
105 lines (85 loc) · 4.25 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
// 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 UnityEngine.Bindings;
using UnityEngine.Scripting;
using UnityEngine.Playables;
using UnityObject = UnityEngine.Object;
namespace UnityEngine.Animations
{
[NativeHeader("Runtime/Animation/ScriptBindings/AnimationLayerMixerPlayable.bindings.h")]
[NativeHeader("Runtime/Animation/Director/AnimationLayerMixerPlayable.h")]
[NativeHeader("Runtime/Director/Core/HPlayable.h")]
[StaticAccessor("AnimationLayerMixerPlayableBindings", StaticAccessorType.DoubleColon)]
[RequiredByNativeCode]
public struct AnimationLayerMixerPlayable : IPlayable, IEquatable<AnimationLayerMixerPlayable>
{
PlayableHandle m_Handle;
static readonly AnimationLayerMixerPlayable m_NullPlayable = new AnimationLayerMixerPlayable(PlayableHandle.Null);
public static AnimationLayerMixerPlayable Null { get { return m_NullPlayable; } }
public static AnimationLayerMixerPlayable Create(PlayableGraph graph, int inputCount = 0)
{
var handle = CreateHandle(graph, inputCount);
return new AnimationLayerMixerPlayable(handle);
}
private static PlayableHandle CreateHandle(PlayableGraph graph, int inputCount = 0)
{
PlayableHandle handle = PlayableHandle.Null;
if (!CreateHandleInternal(graph, ref handle))
return PlayableHandle.Null;
handle.SetInputCount(inputCount);
return handle;
}
internal AnimationLayerMixerPlayable(PlayableHandle handle)
{
if (handle.IsValid())
{
if (!handle.IsPlayableOfType<AnimationLayerMixerPlayable>())
throw new InvalidCastException("Can't set handle: the playable is not an AnimationLayerMixerPlayable.");
}
m_Handle = handle;
}
public PlayableHandle GetHandle()
{
return m_Handle;
}
public static implicit operator Playable(AnimationLayerMixerPlayable playable)
{
return new Playable(playable.GetHandle());
}
public static explicit operator AnimationLayerMixerPlayable(Playable playable)
{
return new AnimationLayerMixerPlayable(playable.GetHandle());
}
public bool Equals(AnimationLayerMixerPlayable other)
{
return GetHandle() == other.GetHandle();
}
public bool IsLayerAdditive(uint layerIndex)
{
if (layerIndex >= m_Handle.GetInputCount())
throw new ArgumentOutOfRangeException("layerIndex", String.Format("layerIndex {0} must be in the range of 0 to {1}.", layerIndex, m_Handle.GetInputCount() - 1));
return IsLayerAdditiveInternal(ref m_Handle, layerIndex);
}
public void SetLayerAdditive(uint layerIndex, bool value)
{
if (layerIndex >= m_Handle.GetInputCount())
throw new ArgumentOutOfRangeException("layerIndex", String.Format("layerIndex {0} must be in the range of 0 to {1}.", layerIndex, m_Handle.GetInputCount() - 1));
SetLayerAdditiveInternal(ref m_Handle, layerIndex, value);
}
public void SetLayerMaskFromAvatarMask(uint layerIndex, AvatarMask mask)
{
if (layerIndex >= m_Handle.GetInputCount())
throw new ArgumentOutOfRangeException("layerIndex", String.Format("layerIndex {0} must be in the range of 0 to {1}.", layerIndex, m_Handle.GetInputCount() - 1));
if (mask == null)
throw new System.ArgumentNullException("mask");
SetLayerMaskFromAvatarMaskInternal(ref m_Handle, layerIndex, mask);
}
// Bindings methods.
extern private static bool CreateHandleInternal(PlayableGraph graph, ref PlayableHandle handle);
extern private static bool IsLayerAdditiveInternal(ref PlayableHandle handle, uint layerIndex);
extern private static void SetLayerAdditiveInternal(ref PlayableHandle handle, uint layerIndex, bool value);
extern private static void SetLayerMaskFromAvatarMaskInternal(ref PlayableHandle handle, uint layerIndex, AvatarMask mask);
}
}