// Photon Code: // Write/Read from data stream void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { // write time & position to stream stream.SendNext(PhotonNetwork.time); stream.SendNext(transform.position); } else { // receive keyframe double time = (double)stream.ReceiveNext(); Vector3 position = (Vector3)stream.ReceiveNext(); if (m_PositionKeyFrames == null) { m_PositionKeyFrames = new KeyframeList <Vector3>(); } m_PositionKeyFrames.Add(time, position); if (m_PositionKeyFrames.Count > 2) { //Debug.Log("removing old keyframes"); // remove old keyframes ( let's say 5 seconds old? ) m_PositionKeyFrames.RemoveAllBefore(time - 5); } } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { // write time & position to stream stream.SendNext(PhotonNetwork.time); // send orientation stream.SendNext((double)transform.rotation.eulerAngles.y); // get Y-rotation } else { // receive keyframe double time = (double)stream.ReceiveNext(); double orientation = (double)stream.ReceiveNext(); if (m_OrientationKeyframesList == null) { m_OrientationKeyframesList = new KeyframeList <double>(); } m_OrientationKeyframesList.Add(time, orientation); if (m_OrientationKeyframesList.Count > 2) { //Debug.Log("removing old keyframes"); // remove old keyframes ( let's say 5 seconds old? ) m_OrientationKeyframesList.RemoveAllBefore(time - 5); } } }
public TimedKeyframeList ToTimedKeyframeList(List <InstructionSet> instructionSetList) { InstructionSet targetInstructionSet = null; foreach (InstructionSet instructionSet in instructionSetList) { if (instructionSet.Name == this.Target) { targetInstructionSet = instructionSet; break; } } // Now that we know which InstructionSet we're working with, find the keyframe with the // matching name KeyframeList targetKeyframeList = null; foreach (KeyframeList keyframeList in targetInstructionSet) { if (keyframeList.Name == this.NameOfReferencedKeyframeList) { targetKeyframeList = keyframeList; break; } } TimedKeyframeList timedKeyframeList = new TimedKeyframeList(targetKeyframeList, Target); timedKeyframeList.TimeToExecute = Time; return(timedKeyframeList); }
public InstructionSet ToInstructionSet(IInstructable instructable) { InstructionSet instructionSet = new InstructionSet(); instructionSet.Name = this.Target; //INameable nameable = null; foreach (KeyframeListSave keyframeList in Instructions) { KeyframeList keyframes = new KeyframeList(); keyframes.Name = keyframeList.Name; instructionSet.Add(keyframes); foreach (KeyframeSave keyframe in keyframeList.SceneKeyframes) { InstructionList list = new InstructionList(); list.Name = keyframe.Name; keyframes.Add(list); foreach (InstructionSave instructionSave in keyframe.InstructionSaves) { list.Add(instructionSave.ToInstruction(instructable)); } } } return(instructionSet); }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { // write time & position to stream stream.SendNext(PhotonNetwork.time); // send orientation stream.SendNext( (double)transform.rotation.eulerAngles.y); // get Y-rotation } else { // receive keyframe double time = (double)stream.ReceiveNext(); double orientation = (double)stream.ReceiveNext(); if (m_OrientationKeyframesList == null) m_OrientationKeyframesList = new KeyframeList<double>(); m_OrientationKeyframesList.Add(time, orientation); if (m_OrientationKeyframesList.Count > 2) { //Debug.Log("removing old keyframes"); // remove old keyframes ( let's say 5 seconds old? ) m_OrientationKeyframesList.RemoveAllBefore(time - 5); } } }
// Use this for initialization void Start() { m_PositionKeyFrames = new KeyframeList<Vector3>(); m_PlayerController = GetComponent<PlayerController>(); }
public virtual double solve(KeyframeList framesToAdjust, CloudPointVector mapToAdjust, Matrix3x3f K, Vector5f D, IntVector selectKeyframes, Transform3DfList poseAdjusted, CloudPointVector mapAdjusted, Matrix3x3f KAdjusted, Vector5f DAdjusted) { double ret = solar_api_solver_mapPINVOKE.IBundler_solve(swigCPtr, KeyframeList.getCPtr(framesToAdjust), CloudPointVector.getCPtr(mapToAdjust), Matrix3x3f.getCPtr(K), Vector5f.getCPtr(D), IntVector.getCPtr(selectKeyframes), Transform3DfList.getCPtr(poseAdjusted), CloudPointVector.getCPtr(mapAdjusted), Matrix3x3f.getCPtr(KAdjusted), Vector5f.getCPtr(DAdjusted)); if (solar_api_solver_mapPINVOKE.SWIGPendingException.Pending) { throw solar_api_solver_mapPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual FrameworkReturnCode retrieve(Frame frame, KeyframeList keyframes) { FrameworkReturnCode ret = (FrameworkReturnCode)solar_api_relocPINVOKE.IKeyframeRetriever_retrieve__SWIG_0(swigCPtr, Frame.getCPtr(frame), KeyframeList.getCPtr(keyframes)); if (solar_api_relocPINVOKE.SWIGPendingException.Pending) { throw solar_api_relocPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual KeyframeList getKeyframes() { KeyframeList ret = new KeyframeList(solar_api_solver_mapPINVOKE.IMapper_getKeyframes(swigCPtr), false); if (solar_api_solver_mapPINVOKE.SWIGPendingException.Pending) { throw solar_api_solver_mapPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public KeyframeList <T> Range(int index, int count) { KeyframeList <T> newRange = new KeyframeList <T>(); //List<KeyValuePair<double, T>> range = new List<KeyValuePair<double, T>>(); for (int i = index; i < index + count; i++) { newRange.Add(m_KeyframeList[(int)i].KeyTime, m_KeyframeList[(int)i].KeyData); // range.Add( ( KeyValuePair<double, T>) this[i] ); } return(newRange); //return range; }
public KeyframeList <T> FindAll(T data) { KeyframeList <T> result = new KeyframeList <T>(); for (int i = 0; i < m_KeyframeList.Count; i++) { if (m_KeyframeList[i].KeyData.Equals(data)) { result.Add((KeyValuePair <double, T>)m_KeyframeList[i]); } } return(result); }
public KeyframeList <T> FindAll(double time) { KeyframeList <T> result = new KeyframeList <T>(); for (int i = 0; i < m_KeyframeList.Count; i++) { if (m_KeyframeList[i].KeyTime.CompareTo(time) == 0) { result.Add((KeyValuePair <double, T>)m_KeyframeList[i]); } } return(result); }
public static void AddKeyframeToGlobalInstrutionSet(Window callingWindow) { KeyframeList keyframeList = ((KeyframeListSelectionWindow)callingWindow).SelectedKeyframeList; INameable targetNameable = ((KeyframeListSelectionWindow)callingWindow).SelectedNameable; TimedKeyframeList timedKeyframeList = new TimedKeyframeList(keyframeList, targetNameable.Name); timedKeyframeList.TimeToExecute = GuiData.TimeLineWindow.CurrentValue; // Add the selected KeyframeList to the Global InstructionSet EditorData.EditorLogic.CurrentAnimationSequence.Add(timedKeyframeList); }
public InstructionSet ToInstructionSet(FlatRedBall.Scene scene) { InstructionSet instructionSet = new InstructionSet(); instructionSet.Name = this.Target; INameable nameable = null; foreach (KeyframeListSave keyframeList in Instructions) { KeyframeList keyframes = new KeyframeList(); keyframes.Name = keyframeList.Name; instructionSet.Add(keyframes); foreach (KeyframeSave keyframe in keyframeList.SceneKeyframes) { InstructionList list = new InstructionList(); list.Name = keyframe.Name; keyframes.Add(list); foreach (InstructionSave instructionSave in keyframe.InstructionSaves) { if (nameable == null || nameable.Name != instructionSave.TargetName) { // We don't have a nameable yet, or the current instruction is // not modifying the one referenced by nameable. nameable = scene.Sprites.FindByName(instructionSave.TargetName); if (nameable == null) { nameable = scene.SpriteFrames.FindByName(instructionSave.TargetName); } } if (nameable == null) { throw new NullReferenceException("Could not find an object of instance " + instructionSave.Type + " with the name " + instructionSave.TargetName); } list.Add(instructionSave.ToInstruction(nameable)); } } } return(instructionSet); }
private void AddKeyframeListOk(Window callingWindow) { string name = ((TextInputWindow)callingWindow).Text; if (GuiData.TimeLineWindow.InstructionMode == InstructionMode.All) { AnimationSequence newSequence = new AnimationSequence(); newSequence.Name = name; EditorData.GlobalInstructionSets.Add(newSequence); } else { KeyframeList keyframeList = new KeyframeList(); EditorData.EditorLogic.CurrentInstructionSet.Add(keyframeList); keyframeList.Name = name; //GuiData.ListBoxWindow.InstructionSetListBox.HighlightItem(item); } GuiData.ListBoxWindow.UpdateLists(); }
public virtual FrameworkReturnCode retrieve(Frame frame, SWIGTYPE_p_std__setT_unsigned_int_t idxKfCandidates, KeyframeList keyframes) { FrameworkReturnCode ret = (FrameworkReturnCode)solar_api_relocPINVOKE.IKeyframeRetriever_retrieve__SWIG_1(swigCPtr, Frame.getCPtr(frame), SWIGTYPE_p_std__setT_unsigned_int_t.getCPtr(idxKfCandidates), KeyframeList.getCPtr(keyframes)); if (solar_api_relocPINVOKE.SWIGPendingException.Pending) { throw solar_api_relocPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
// Use this for initialization void Start() { m_OrientationKeyframesList = new KeyframeList<double>(); m_PlayerController = GetComponent<PlayerController>(); }
private void SelectKeyframe(Window callingWindow) { KeyframeList keyframeList = mKeyframeListSelectionComboBox.SelectedObject as KeyframeList; mOkButton.Enabled = keyframeList != null; }
// Use this for initialization void Start() { m_OrientationKeyframesList = new KeyframeList <double>(); m_PlayerController = GetComponent <PlayerController>(); }
// Use this for initialization void Start () { m_OrientationKeyframesList = new KeyframeList<double>(); isFrozen = false; }
// Use this for initialization void Start() { //isFrozen = false; m_PositionKeyFrames = new KeyframeList<Vector3>(); #region testCode /* // testing out my new Keyframelist class // KeyframeList<Vector3> m_AutoSortedList = new KeyframeList<Vector3>(); KeyframeList<Vector3> m_NonAutosortedList = new KeyframeList<Vector3>(); m_NonAutosortedList.Autosort = false; // add some test data m_AutoSortedList.Add( 1d, Vector3.forward * 1); m_AutoSortedList.Add(2d, Vector3.right * 2); m_AutoSortedList.Add(3d, Vector3.up * 3); m_AutoSortedList.Add(0d, Vector3.left * 4); m_NonAutosortedList.Add(1d, Vector3.forward * 1); m_NonAutosortedList.Add(2d, Vector3.right * 2); m_NonAutosortedList.Add(3d, Vector3.up *3); m_NonAutosortedList.Add(0d, Vector3.left * 4); // Debug.Log("m_AutoSortedList after adding data"); Debug.Log(m_AutoSortedList.ToString()); Debug.Log("m_NonAutosortedList after adding data"); Debug.Log(m_NonAutosortedList.ToString()); Debug.Log("Getting values by Index retreival"); Debug.Log("index 0: " + m_AutoSortedList[0].ToString()); Debug.Log("index 1: " + m_AutoSortedList[1].ToString()); Debug.Log("index 2: " + m_AutoSortedList[2].ToString()); Debug.Log("index 3: " + m_AutoSortedList[3].ToString()); Debug.Log("m_AutoSortedList range 1-2"); KeyframeList<Vector3> autoSortedRange = m_AutoSortedList.Range(1, 2); Debug.Log(autoSortedRange.ToString()); Debug.Log("m_AutoSortedList range 1-2"); KeyframeList<Vector3> non_autoSortedRange = m_NonAutosortedList.Range(1, 2); Debug.Log(non_autoSortedRange.ToString()); Debug.Log("Getting values by DOUBLE retreival"); Debug.Log("index 1d: " + m_AutoSortedList[1d].ToString()); Debug.Log("FINDING INDICES-"); Debug.Log("FINDING First Before 2 =" + m_AutoSortedList.GetIndexFirstBefore( 2d )); Debug.Log("FINDING First Before 2.5 =" + m_AutoSortedList.GetIndexFirstBefore(2.5d)); Debug.Log("FINDING First Before 0 =" + m_AutoSortedList.GetIndexFirstBefore(0)); Debug.Log("FINDING First After 0 =" + m_AutoSortedList.GetIndexFirstAfter(0)); Debug.Log("FINDING First After 1 =" + m_AutoSortedList.GetIndexFirstAfter(1)); Debug.Log("FINDING First After 1.5 =" + m_AutoSortedList.GetIndexFirstAfter(1.5)); Debug.Log("FINDING First After 5 =" + m_AutoSortedList.GetIndexFirstAfter(5)); Debug.Log("FINDING Closest to 5 =" + m_AutoSortedList.GetIndexClosestTo(5)); Debug.Log("FINDING Closest to -10 =" + m_AutoSortedList.GetIndexClosestTo(-10)); Debug.Log("FINDING Closest to 2 =" + m_AutoSortedList.GetIndexClosestTo(2)); Debug.Log("FINDING Closest to 2.3 =" + m_AutoSortedList.GetIndexClosestTo(2.3)); Debug.Log("FINDING Closest to 2.5 =" + m_AutoSortedList.GetIndexClosestTo(2.5)); Debug.Log("FINDING Closest to 2.6 =" + m_AutoSortedList.GetIndexClosestTo(2.6)); // Debug.Log("REMOVING Stuff"); Debug.Log("index 1: " + m_AutoSortedList[1].ToString()); m_AutoSortedList.Remove(m_AutoSortedList[1].Key, m_AutoSortedList[1].Value); Debug.Log("index 1: " + m_AutoSortedList[1].ToString()); Debug.Log("Overwriting Stuff"); Debug.Log("index 1: " + m_AutoSortedList[1].ToString()); m_AutoSortedList[1] = new KeyValuePair<double, Vector3>(11, Vector3.zero); Debug.Log("index 1: " + m_AutoSortedList[1].ToString()); m_AutoSortedList.Sort(); Debug.Log("Overwriting Sorting"); Debug.Log("index 1: " + m_AutoSortedList[1].ToString()); m_AutoSortedList[11d] = Vector3.down; int indexoff11d = m_AutoSortedList.GetIndexClosestTo(9); Debug.Log("index of 11d: " + indexoff11d); Debug.Log("value of 11d: " + m_AutoSortedList[ indexoff11d ]); // Notes: /* Add() -> Keyvaluepair */ #endregion }
public InstructionSet ToInstructionSet(FlatRedBall.Scene scene) { InstructionSet instructionSet = new InstructionSet(); instructionSet.Name = this.Target; INameable nameable = null; foreach (KeyframeListSave keyframeList in Instructions) { KeyframeList keyframes = new KeyframeList(); keyframes.Name = keyframeList.Name; instructionSet.Add(keyframes); foreach (KeyframeSave keyframe in keyframeList.SceneKeyframes) { InstructionList list = new InstructionList(); list.Name = keyframe.Name; keyframes.Add(list); foreach (InstructionSave instructionSave in keyframe.InstructionSaves) { if (nameable == null || nameable.Name != instructionSave.TargetName) { // We don't have a nameable yet, or the current instruction is // not modifying the one referenced by nameable. nameable = scene.Sprites.FindByName(instructionSave.TargetName); if (nameable == null) { nameable = scene.SpriteFrames.FindByName(instructionSave.TargetName); } } if (nameable == null) { throw new NullReferenceException("Could not find an object of instance " + instructionSave.Type + " with the name " + instructionSave.TargetName); } list.Add(instructionSave.ToInstruction(nameable)); } } } return instructionSet; }
public InstructionSet ToInstructionSet(IInstructable instructable) { InstructionSet instructionSet = new InstructionSet(); instructionSet.Name = this.Target; //INameable nameable = null; foreach (KeyframeListSave keyframeList in Instructions) { KeyframeList keyframes = new KeyframeList(); keyframes.Name = keyframeList.Name; instructionSet.Add(keyframes); foreach (KeyframeSave keyframe in keyframeList.SceneKeyframes) { InstructionList list = new InstructionList(); list.Name = keyframe.Name; keyframes.Add(list); foreach (InstructionSave instructionSave in keyframe.InstructionSaves) { list.Add(instructionSave.ToInstruction(instructable)); } } } return instructionSet; }
public void UpdateLists() { #region Update List window visibility mInstructionSetListBox.Visible = GuiData.TimeLineWindow.InstructionMode == InstructionMode.Current; mAnimationSequenceListBox.Visible = GuiData.TimeLineWindow.InstructionMode == InstructionMode.All; #endregion #region Update the Global InstructionSets ListDisplayWindow mAnimationSequenceListBox.ListShowing = EditorData.GlobalInstructionSets; #endregion #region If there is not a CurrentInstructionSet if (EditorData.EditorLogic.CurrentInstructionSet == null) { mInstructionSetListBox.Clear(); } #endregion #region Else, there is else { #region See if there are any KeyframeLists that aren't shown in the list for (int i = 0; i < EditorData.EditorLogic.CurrentInstructionSet.Count; i++) { if (mInstructionSetListBox.ContainsObject( EditorData.EditorLogic.CurrentInstructionSet[i]) == false) { CollapseItem item = mInstructionSetListBox.AddItem( EditorData.EditorLogic.CurrentInstructionSet[i].Name, EditorData.EditorLogic.CurrentInstructionSet[i]); } else { mInstructionSetListBox.GetItem(EditorData.EditorLogic.CurrentInstructionSet[i]).Text = EditorData.EditorLogic.CurrentInstructionSet[i].Name; } } #endregion #region See if there are any Keyframes that aren't in the ListBox foreach (KeyframeList keyframeList in EditorData.EditorLogic.CurrentInstructionSet) { CollapseItem itemForKeyframe = mInstructionSetListBox.GetItem(keyframeList); for (int i = 0; i < keyframeList.Count; i++) { InstructionList list = keyframeList[i]; string listName = ""; if (list.Count != 0) { string numberString = list[0].TimeToExecute.ToString("00.000"); listName = numberString + " " + list.Name; } else { listName = list.Name; } if (itemForKeyframe.Contains(list) == false) { itemForKeyframe.InsertItem(i, listName, list); } else { itemForKeyframe.GetItem(list).Text = listName; } } } #endregion #region See if there are any KeyframeLists or Keyframes in the ListBox that aren't in the List for (int itemNumber = 0; itemNumber < mInstructionSetListBox.Items.Count; itemNumber++) { CollapseItem item = mInstructionSetListBox.Items[itemNumber]; KeyframeList keyframeList = item.ReferenceObject as KeyframeList; if (EditorData.EditorLogic.CurrentInstructionSet.Contains(keyframeList) == false) { mInstructionSetListBox.RemoveCollapseItem(item); } else { for (int i = item.Count - 1; i > -1; i--) { CollapseItem subItem = item[i]; InstructionList keyframe = subItem.ReferenceObject as InstructionList; if (keyframeList.Contains(keyframe) == false) { item.RemoveObject(keyframe); } } } } #endregion } #endregion }
public void HighlightNoCall(KeyframeList keyframeList) { UpdateLists(); mInstructionSetListBox.HighlightObjectNoCall(keyframeList, false); }
// Photon Code: // Write/Read from data stream void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { // write time & position to stream stream.SendNext(PhotonNetwork.time); stream.SendNext(transform.position); } else { // receive keyframe double time = (double)stream.ReceiveNext(); Vector3 position = (Vector3)stream.ReceiveNext(); if (m_PositionKeyFrames == null) m_PositionKeyFrames = new KeyframeList<Vector3>(); m_PositionKeyFrames.Add(time, position); if (m_PositionKeyFrames.Count > 2) { //Debug.Log("removing old keyframes"); // remove old keyframes ( let's say 5 seconds old? ) m_PositionKeyFrames.RemoveAllBefore(time - 5); } } }
public TimedKeyframeList(KeyframeList keyframeList, string targetName) { mKeyframeList = keyframeList; mTargetName = targetName; mName = keyframeList.Name; }
// Use this for initialization void Start() { m_PositionKeyFrames = new KeyframeList <Vector3>(); m_PlayerController = GetComponent <PlayerController>(); }