private void SetControls()//This sets the controls to the value of the selected key frame { if (!CameraAnimation.ContainsKey((int)SelectedFrame.X)) { KeyFrameTypeLbl.Text = "Select a key frame"; SetControlsEnabled(false);//Disable the controls when no key frame is selected return; } else { SetControlsEnabled(true); } LookAtFromPair SelectedKF = CameraAnimation[(int)SelectedFrame.X]; Vector3 SelectedPos; if (SelectedFrame.Y == 0) { SelectedPos = CameraAnimation[(int)SelectedFrame.X].LookAt; KeyFrameTypeLbl.Text = "'Look at' key frame"; } else { SelectedPos = CameraAnimation[(int)SelectedFrame.X].LookFrom; KeyFrameTypeLbl.Text = "'Look from' key frame"; } XUpDn.Value = (decimal)SelectedPos.X; YUpDn.Value = (decimal)SelectedPos.Y; ZUpDn.Value = (decimal)SelectedPos.Z; TimeUpDn.Value = (int)SelectedFrame.X; }
private void TimeUpDn_ValueChanged(object sender, EventArgs e) { if (CameraAnimation.ContainsKey((int)TimeUpDn.Value) || SelectedFrame.X == 0 || (int)TimeUpDn.Value + 1 > DurationUpDn.Value) { TimeUpDn.Value = (int)SelectedFrame.X; return; } LookAtFromPair KFCopy = CameraAnimation[(int)SelectedFrame.X];//We can't change the key of an existing entry so we have to cut and paste to the new time CameraAnimation.Add((int)TimeUpDn.Value, KFCopy); CameraAnimation.Remove((int)SelectedFrame.X); SelectedFrame.X = (float)TimeUpDn.Value; RefreshTimeLine(); }