//called when data for any output pin is requested public void Evaluate(int SpreadMax) { if (FFileNameIn.IsChanged) { if (FFileNameIn[0].EndsWith(".bvh")) { FSkeleton = null; //load BVH file if (FBVHLoader.Load(FFileNameIn[0])) { //set frame count and second per frame FFramesOut.SliceCount = 1; FFrameTimeOut.SliceCount = 1; FFramesOut[0] = FBVHLoader.FrameCount; FFrameTimeOut[0] = FBVHLoader.FrameTime; //set Skeleton Output FSkeleton = FBVHLoader.Skeleton; FSkeletonOutput.SliceCount = 1; FSkeletonOutput.SetInterface(FSkeleton); FSkeletonOutput.MarkPinAsChanged(); } else { //reset frame count and second per frame FFramesOut.SliceCount = 0; FFrameTimeOut.SliceCount = 0; //reset Skeleton Output FSkeletonOutput.SliceCount = 0; FSkeletonOutput.MarkPinAsChanged(); FLogger.Log(LogType.Debug, "BVH load error"); } } else { FSkeleton = null; FBVHLoader.Unload(); //reset frame count and second per frame FFramesOut.SliceCount = 0; FFrameTimeOut.SliceCount = 0; //reset Skeleton Output FSkeletonOutput.SliceCount = 0; FSkeletonOutput.MarkPinAsChanged(); } } if (FFrameIn.IsChanged) { if (FSkeleton != null) { //update Skeleton (be sure frame ID <= frame count) FBVHLoader.UpdateSkeleton(FFrameIn[0] % FBVHLoader.FrameCount); //set Skeleton Output FSkeleton = FBVHLoader.Skeleton; FSkeletonOutput.SetInterface(FSkeleton); FSkeletonOutput.MarkPinAsChanged(); } } //FLogger.Log(LogType.Debug, "Logging to Renderer (TTY)"); }