public static void ShowSensorSelectionWindow(Vector2 nSize, Rect nPosition, VRPNDataObject nInFront) { size = nSize; pos = nPosition; inFront = nInFront; sensors = VRPNEditEditor.Instance.GetSensors(inFront.dataName, inFront.originalDataTime, inFront.dataDevice); disabledSensors = VRPNEditEditor.Instance.GetDisabledSensors(inFront.dataName, inFront.originalDataTime, inFront.dataDevice); states = new bool[sensors.Count]; sensorsE = sensors.GetEnumerator(); //Initial sensors state int numSensor = 0; while (sensorsE.MoveNext()) { int test; if (disabledSensors.TryGetValue(sensorsE.Current.Key, out test)) { states[numSensor] = false; } else { states[numSensor] = true; } numSensor++; } VRPNSensorSelectionWindow window = VRPNSensorSelectionWindow.CreateInstance <VRPNSensorSelectionWindow>(); window.ShowAsDropDown(pos, size); }
public static void ShowSensorSelectionWindow(Vector2 nSize, Rect nPosition, VRPNDataObject nInFront) { size = nSize; pos = nPosition; inFront = nInFront; sensors = VRPNEditEditor.Instance.GetSensors(inFront.dataName, inFront.originalDataTime, inFront.dataDevice); disabledSensors = VRPNEditEditor.Instance.GetDisabledSensors(inFront.dataName, inFront.originalDataTime, inFront.dataDevice); states = new bool[sensors.Count]; sensorsE = sensors.GetEnumerator(); //Initial sensors state int numSensor = 0; while (sensorsE.MoveNext()) { int test; if (disabledSensors.TryGetValue(sensorsE.Current.Key, out test)) { states[numSensor] = false; } else { states[numSensor] = true; } numSensor++; } VRPNSensorSelectionWindow window = VRPNSensorSelectionWindow.CreateInstance<VRPNSensorSelectionWindow>(); window.ShowAsDropDown(pos, size); }
//Method to paint the recordings in the time line private void DataPainting() { VRPNDataObject toFront; bool previousState, flipRepaint; toFront = null; doRepaintDrag = false; flipRepaint = false; foreach (VRPNDataObject data in devicesData) { previousState = data.dragging; data.OnGUI(headerHeight, timeLineTime, timeLineZoom, timeLineProportion, data.Equals(inFront)); if (data.dragging) { doRepaintDrag = true; if (devicesData.IndexOf(data) != devicesData.Count - 1) { toFront = data; } } else if (previousState) { flipRepaint = true; inFront = data; } } // Move an object to front if needed if (toFront != null) { devicesData.Remove(toFront); devicesData.Add(toFront); } // If some object just stopped being dragged, we should repaing for the state change if (flipRepaint) { Repaint(); } }
//Method to extract the editor updated state from the VRPNEditEditor private void DataFilling() { Dictionary <string, VRPNTrackerRecordings> .Enumerator eTrackers = VRPNEditEditor.Instance.GetTrackersEnumerator(); Dictionary <string, VRPNAnalogRecordings> .Enumerator eAnalogs = VRPNEditEditor.Instance.GetAnalogsEnumerator(); Dictionary <string, VRPNButtonRecordings> .Enumerator eButtons = VRPNEditEditor.Instance.GetButtonsEnumerator(); devicesData = new List <VRPNDataObject>(); timeLineDevicesNumber = 0; while (eTrackers.MoveNext()) { List <VRPNTrackerRecording> .Enumerator eTracker = VRPNEditEditor.Instance.GetTrackerRecordingsEnumerator(eTrackers.Current.Key); while (eTracker.MoveNext()) { devicesData.Add(new VRPNDataObject(VRPNManager.DeviceType.Tracker, eTrackers.Current.Key, eTracker.Current.name, eTracker.Current.reportTime, eTracker.Current.lastTime, timeLineLinesSeparation * timeLineDevicesNumber)); } timeLineDevicesNumber++; } while (eAnalogs.MoveNext()) { List <VRPNAnalogRecording> .Enumerator eAnalog = VRPNEditEditor.Instance.GetAnalogRecordingsEnumerator(eAnalogs.Current.Key); while (eAnalog.MoveNext()) { devicesData.Add(new VRPNDataObject(VRPNManager.DeviceType.Analog, eAnalogs.Current.Key, eAnalog.Current.name, eAnalog.Current.reportTime, eAnalog.Current.lastTime, timeLineLinesSeparation * timeLineDevicesNumber)); } timeLineDevicesNumber++; } while (eButtons.MoveNext()) { List <VRPNButtonRecording> .Enumerator eButton = VRPNEditEditor.Instance.GetButtonRecordingsEnumerator(eButtons.Current.Key); while (eButton.MoveNext()) { devicesData.Add(new VRPNDataObject(VRPNManager.DeviceType.Button, eButtons.Current.Key, eButton.Current.name, eButton.Current.reportTime, eButton.Current.lastTime, timeLineLinesSeparation * timeLineDevicesNumber)); } timeLineDevicesNumber++; } inFront = null; Repaint(); }
//Method to extract the editor updated state from the VRPNEditEditor private void DataFilling() { Dictionary<string, VRPNTrackerRecordings>.Enumerator eTrackers = VRPNEditEditor.Instance.GetTrackersEnumerator(); Dictionary<string, VRPNAnalogRecordings>.Enumerator eAnalogs = VRPNEditEditor.Instance.GetAnalogsEnumerator(); Dictionary<string, VRPNButtonRecordings>.Enumerator eButtons = VRPNEditEditor.Instance.GetButtonsEnumerator(); devicesData = new List<VRPNDataObject>(); timeLineDevicesNumber = 0; while (eTrackers.MoveNext()) { List<VRPNTrackerRecording>.Enumerator eTracker = VRPNEditEditor.Instance.GetTrackerRecordingsEnumerator(eTrackers.Current.Key); while (eTracker.MoveNext()) { devicesData.Add(new VRPNDataObject(VRPNManager.DeviceType.Tracker, eTrackers.Current.Key, eTracker.Current.name, eTracker.Current.reportTime, eTracker.Current.lastTime, timeLineLinesSeparation * timeLineDevicesNumber)); } timeLineDevicesNumber++; } while (eAnalogs.MoveNext()) { List<VRPNAnalogRecording>.Enumerator eAnalog = VRPNEditEditor.Instance.GetAnalogRecordingsEnumerator(eAnalogs.Current.Key); while (eAnalog.MoveNext()) { devicesData.Add(new VRPNDataObject(VRPNManager.DeviceType.Analog, eAnalogs.Current.Key, eAnalog.Current.name, eAnalog.Current.reportTime, eAnalog.Current.lastTime, timeLineLinesSeparation * timeLineDevicesNumber)); } timeLineDevicesNumber++; } while (eButtons.MoveNext()) { List<VRPNButtonRecording>.Enumerator eButton = VRPNEditEditor.Instance.GetButtonRecordingsEnumerator(eButtons.Current.Key); while (eButton.MoveNext()) { devicesData.Add(new VRPNDataObject(VRPNManager.DeviceType.Button, eButtons.Current.Key, eButton.Current.name, eButton.Current.reportTime, eButton.Current.lastTime, timeLineLinesSeparation * timeLineDevicesNumber)); } timeLineDevicesNumber++; } inFront = null; Repaint(); }