public AnimTrack LoadAnimationTrack(FbxNode node, AnimationTrackInfo animationTrack) { double[] times = LoadKeyTimes(node, animationTrack); var ret = new AnimTrack(); ret.Layers = new AnimationLayer[animationTrack.GetLayerCount()]; for (int i = 0; i < ret.Layers.Length; i++) { ret.Layers[i] = LoadLayer(node, animationTrack.GetLayer(i), times); } return(ret); }
//ToDo : ??? Только для одного Layer грузить? Хотя у Layers должны быть одинаковые отсчеты времени, если они должны смешиваться? static void LoadKeyFrames(AnimationTrackInfo animationTrack, FbxPropertyTFbxDouble3 transformProperty, HashSet <double> keyFrames, string xChannelName, string yChannelName, string zChannelName) { for (int i = 0; i < animationTrack.GetLayerCount(); i++) { FbxAnimLayer pAnimLayer = animationTrack.GetLayer(i); FbxAnimCurve pAnimCurve = null; pAnimCurve = transformProperty.GetCurve(pAnimLayer, xChannelName); if (pAnimCurve != null) { for (int j = 0; j < pAnimCurve.KeyGetCount(); j++) { FbxAnimCurveKey key = pAnimCurve.KeyGet(j); //ToDo :? Учитывать key.GetInterpolation(); double time = key.GetTime().GetSecondDouble(); keyFrames.Add(time); } } pAnimCurve = transformProperty.GetCurve(pAnimLayer, yChannelName); if (pAnimCurve != null) { for (int j = 0; j < pAnimCurve.KeyGetCount(); j++) { FbxAnimCurveKey key = pAnimCurve.KeyGet(j); double time = key.GetTime().GetSecondDouble(); keyFrames.Add(time); } } pAnimCurve = transformProperty.GetCurve(pAnimLayer, zChannelName); if (pAnimCurve != null) { for (int j = 0; j < pAnimCurve.KeyGetCount(); j++) { FbxAnimCurveKey key = pAnimCurve.KeyGet(j); double time = key.GetTime().GetSecondDouble(); keyFrames.Add(time); } } } }