private LiveFeedAnimator GetLiveFeedAnimator(string movementFileName) { VideoAnimationBinding binding = AllVideoBindings.Get(movementFileName); string fullPathToMovementFile = VideoAnimationManager.GetFullPathToMovementFile(movementFileName); VideoFeed[] videoFeeds = AllVideoFeeds.GetAll(binding); return(VideoAnimationManager.LoadLiveAnimation(fullPathToMovementFile, binding, videoFeeds)); }
private void SaveFrames(string movementFileName) { LiveFeedAnimator liveFeedAnimator = GetLiveFeedAnimator(movementFileName); liveFeedAnimator.LiveFeedSequences.Clear(); bool firstTime = true; ObsTransform lastLiveFeedSequence = null; foreach (ObsTransformEdit liveFeedEdit in allFrames) { ObsTransform liveFeedSequence = new ObsTransform() { Camera = liveFeedEdit.Camera, Rotation = liveFeedEdit.GetRotation(), Scale = liveFeedEdit.GetScale(), Opacity = liveFeedEdit.GetOpacity(), Origin = new CommonCore.Point2d(liveFeedEdit.GetX(), liveFeedEdit.GetY()), Flipped = liveFeedEdit.Flipped, Duration = secondsPerFrame }; if (firstTime) { firstTime = false; } else { if (lastLiveFeedSequence.Matches(liveFeedSequence)) // Compress movement... { lastLiveFeedSequence.Duration += secondsPerFrame; continue; } } liveFeedAnimator.LiveFeedSequences.Add(liveFeedSequence); lastLiveFeedSequence = liveFeedSequence; } // Only saves for the active movement file. So if I make changes to two different movement files in // the same edit session, I need to save twice - use the radio buttons to decide what I'm saving. string fullPathToMovementFile = VideoAnimationManager.GetFullPathToMovementFile(movementFileName); string serializedTransforms = Newtonsoft.Json.JsonConvert.SerializeObject(liveFeedAnimator.LiveFeedSequences, Newtonsoft.Json.Formatting.Indented); System.IO.File.WriteAllText(fullPathToMovementFile, serializedTransforms); }