void FbxsdkLoadAnimations(FBXScene scene, AnimationClipCreateInfo[] clips) { const double FRAMES_PER_SECOND = 30; if (clips == null) return; List<FBXNode> fbxNodeList = new List<FBXNode>(); FbxsdkFindAllAnimatedNodes(scene, scene.GetRootNode(), fbxNodeList); if (fbxNodeList.Count == 0) { Debug.Log("Don't have animation data"); return; } foreach (var clipCreateInfo in clips) { var start = clipCreateInfo.Start; var frameCount = clipCreateInfo.End - start + 1; var clip = new AnimationClip(); clip.Name = clipCreateInfo.Name; clip.SecondsPerFrame = 1 / FRAMES_PER_SECOND; clip.Duration = frameCount / FRAMES_PER_SECOND; foreach (var fbxNode in fbxNodeList) { var channel = new AnimationNodeChannel(frameCount); channel.Clip = clip; for (int i = 0; i < frameCount; ++i) { channel.Frames[i] = FbxsdkConvertMatrix(fbxNode.EvaluateLocalTransform(start + i)); } clip.Channels[fbxNode.GetName()] = channel; } AnimationClips[clip.Name] = clip; } }
public AnimationBlendNode(AnimationNodeChannel channel) { Channel = channel; }