void UpdateFrameUI() { if (FramesAreNotGood()) { return; } ObsTransformEdit liveFeedEdit = allFrames[frameIndex]; changingInternally = true; try { UpdateFrameIndex(liveFeedEdit); //tbxDeltaOpacity.Text = liveFeedEdit.Opacity; tbxDeltaX.Text = liveFeedEdit.DeltaX.ToString(); tbxDeltaY.Text = liveFeedEdit.DeltaY.ToString(); sldDeltaX.Value = liveFeedEdit.DeltaX; sldDeltaY.Value = liveFeedEdit.DeltaY; tbxDeltaRotation.Text = liveFeedEdit.DeltaRotation.ToString(); sldDeltaRotation.Value = liveFeedEdit.DeltaRotation; tbxDeltaScale.Text = liveFeedEdit.DeltaScale.ToString(); sldDeltaScale.Value = liveFeedEdit.DeltaScale; tbxDeltaOpacity.Text = liveFeedEdit.DeltaOpacity.ToString(); sldDeltaOpacity.Value = liveFeedEdit.DeltaOpacity; UpdateLights(); UpdateValuePreviews(liveFeedEdit); } finally { changingInternally = false; } }
void Change(Attribute attribute, double value) { if (initializing || allFrames == null || frameIndex >= allFrames.Count) { return; } ObsTransformEdit liveFeedEdit = allFrames[frameIndex]; switch (attribute) { case Attribute.X: liveFeedEdit.DeltaX = (int)value; break; case Attribute.Y: liveFeedEdit.DeltaY = (int)value; break; case Attribute.Scale: liveFeedEdit.DeltaScale = value; break; case Attribute.Rotation: liveFeedEdit.DeltaRotation = value; break; case Attribute.Opacity: liveFeedEdit.DeltaOpacity = value; break; } DrawActiveFrame(); }
private static bool FramesAreClose(ObsTransformEdit currentFrame, ObsTransformEdit frame) { return(AreClose(frame.Origin.X, currentFrame.Origin.X, 1) && AreClose(frame.Origin.Y, currentFrame.Origin.Y, 1) && AreClose(frame.Rotation, currentFrame.Rotation, 0.1) && AreClose(currentFrame.Scale, frame.Scale, 0.01) && AreClose(frame.Opacity, currentFrame.Opacity, 0.01)); }
private void UpdateValuePreviews(ObsTransformEdit liveFeedEdit = null) { if (liveFeedEdit == null) { if (FramesAreNotGood()) { return; } liveFeedEdit = allFrames[frameIndex]; } tbCurrentX.Text = liveFeedEdit.Origin.X.ToString(); tbNewX.Text = liveFeedEdit.GetX().ToString(); tbCurrentY.Text = liveFeedEdit.Origin.Y.ToString(); tbNewY.Text = liveFeedEdit.GetY().ToString(); tbCurrentOpacity.Text = liveFeedEdit.Opacity.ToString(); tbNewOpacity.Text = liveFeedEdit.GetOpacity().ToString(); tbCurrentRotation.Text = liveFeedEdit.Rotation.ToString(); tbNewRotation.Text = liveFeedEdit.GetRotation().ToString(); tbCurrentScale.Text = liveFeedEdit.Scale.ToString(); tbNewScale.Text = liveFeedEdit.GetScale().ToString(); }
void CopyForward(Attribute attribute) { if (frameIndex < 0) { return; } if (frameIndex >= allFrames.Count) { return; } ObsTransformEdit currentFrame = allFrames[frameIndex]; int indexToChange = frameIndex + 1; while (indexToChange < allFrames.Count) { ObsTransformEdit frame = allFrames[indexToChange]; switch (attribute) { case Attribute.X: if (AreClose(frame.Origin.X, currentFrame.Origin.X, 1)) { frame.DeltaX = currentFrame.DeltaX; break; } else { return; } case Attribute.Y: if (AreClose(frame.Origin.Y, currentFrame.Origin.Y, 1)) { frame.DeltaY = currentFrame.DeltaY; break; } else { return; } case Attribute.Rotation: if (AreClose(frame.Rotation, currentFrame.Rotation, 0.1)) { frame.DeltaRotation = currentFrame.DeltaRotation; break; } else { return; } case Attribute.Scale: if (AreClose(currentFrame.Scale, frame.Scale, 0.01)) { frame.DeltaScale = currentFrame.DeltaScale; break; } else { return; } case Attribute.Opacity: if (AreClose(frame.Opacity, currentFrame.Opacity, 0.01)) { frame.DeltaOpacity = currentFrame.DeltaOpacity; break; } else { return; } } indexToChange++; } }
void UpdateFrameIndex(ObsTransformEdit liveFeedEdit) { tbFrameIndexFromMovementFile.Text = FormatFrameIndex(liveFeedEdit.FrameIndex); tbFrameIndexFromMemory.Text = FormatFrameIndex(FrameIndex); }