public void UpdateAnimation(string guid, string animationName, string configString, int timestamp) { var entity = World.Instance.FindEntity(guid); //if (!updateskeletons.ContainsKey(animationName)) //{ // BVHSkeleton skeleton = new BVHSkeleton(animationName); // skeleton.LoadBVHFile(); // updateskeletons.Add(animationName, skeleton); //} //updateskeletons[animationName].configUpdateParameter(configString); //string bvhHeaderString = ":" + updateskeletons[animationName].GenerateBVHHeaderString() + ":"; //string frame = updateskeletons[animationName].GenerateCurrentBVHAnimationFrames(); //string sendString = bvhHeaderString + frame; BVHSkeleton skeleton = new BVHSkeleton(animationName); skeleton.LoadBVHFile(); skeleton.configUpdateParameter(configString); string bvhHeaderString = ":" + skeleton.GenerateBVHHeaderString() + ":"; string frame = skeleton.GenerateCurrentBVHAnimationFrames(); string sendString = bvhHeaderString + frame; entity["BVHAnimation"]["bvhframe"].Suggest(sendString); //BVHAnimationManager.Instance.StartAnimation(guid, skeleton.getAnimationName(), skeleton); }
public void StartAnimation(string guid, string aniName, BVHSkeleton skeleton) { //Clear the stop information if (this.isStoppedEntity.Equals(guid)) { this.isStoppedEntity = ""; } //recover the pause information, and resume if (this.isPausedEntity.Equals(guid)) { //recover if (PausedAnimationsForEntities.ContainsKey(guid)) { //add the animation to running animation lock (RunningAnimationsForEntities) { if (RunningAnimationsForEntities.ContainsKey(guid)) { //Means user start a new animation, clear the paused frame //PausedFrameForEntities.Remove(guid); } else { //else resume the old animation RunningAnimationsForEntities.Add(guid, PausedAnimationsForEntities[guid]); //and remove the old animation //PausedAnimationsForEntities.Remove(guid); } } } else { Console.WriteLine("No such entity has been paused!"); } return; } AnimationInfo info = new AnimationInfo(); //get frame time info.frameTime = skeleton.getFrameTime(); //get frame motion data info.bvhAnimationString = skeleton.GenerateBVHAnimationFrames(); //get frame action info.bvhActionString = skeleton.GenerateBVHAnimationAction(); lock (RunningAnimationsForEntities) { if (!RunningAnimationsForEntities.ContainsKey(guid)) RunningAnimationsForEntities[guid] = new AnimationInfo(); //FIXME: maybe we need to check the animation name to prevent potenial double "start" click RunningAnimationsForEntities[guid] = info; } }
public void StartAnimation(string guid, string animationName, string configString, int timestamp) { var entity = World.Instance.FindEntity(guid); if (!animationskeletons.ContainsKey(animationName)) { Console.WriteLine("Try to load bvh file " + animationName); BVHSkeleton skeleton = new BVHSkeleton(animationName); skeleton.LoadBVHFile(); Console.WriteLine("Finished reading the file"); animationskeletons.Add(animationName, skeleton); } //Console.WriteLine("added animation to ist"); animationskeletons[animationName].configAnimationParameter(configString); //Console.WriteLine("Finished reading the config string"); //Console.WriteLine("Get in here!"); BVHAnimationManager.Instance.StartAnimation(guid, animationName, animationskeletons[animationName]); }