forked from izrik/FbxSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFbxPose.cs
79 lines (63 loc) · 1.87 KB
/
FbxPose.cs
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
using System;
using System.Collections.Generic;
namespace FbxSharp
{
public class FbxPose : FbxObject
{
public FbxPose(String name="")
: base(name)
{
PoseInfos = new CollectionView<FbxPoseInfo, FbxPoseInfo>(poseInfos, eh => poseInfos.CollectionChanged += eh);
}
#region Public Member Functions
readonly ChangeNotifyList<FbxPoseInfo> poseInfos = new ChangeNotifyList<FbxPoseInfo>();
public readonly CollectionView<FbxPoseInfo, FbxPoseInfo> PoseInfos;
public void SetIsBindPose(bool pIsBindPose)
{
isBindPose = pIsBindPose;
}
bool isBindPose;
public bool IsBindPose()
{
return isBindPose;
}
public bool IsRestPose()
{
return !IsBindPose();
}
public int GetCount()
{
return poseInfos.Count;
}
public int Add(FbxNode pNode, FbxMatrix pMatrix, bool pLocalMatrix=false/*, bool pMultipleBindPose=true*/)
{
var match = poseInfos.FindIndex(pi => pi.Node == pNode);
if (match >= 0)
{
if (poseInfos[match].Matrix != pMatrix)
return -1;
return match;
}
var p = new FbxPoseInfo(pNode, pMatrix, pLocalMatrix);
poseInfos.Add(p);
return poseInfos.IndexOf(p);
}
public void Remove(int pIndex)
{
poseInfos.RemoveAt(pIndex);
}
public FbxNode GetNode(int pIndex)
{
return poseInfos[pIndex].Node;
}
public FbxMatrix GetMatrix(int pIndex)
{
return poseInfos[pIndex].Matrix;
}
public bool IsLocalMatrix(int pIndex)
{
return poseInfos[pIndex].MatrixIsLocal;
}
#endregion
}
}