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 detect and process a tracker sensor edit (S key) private void detectTrackerSensorEdit() { if (!VRPNEdit.instance.isPlaying) { Event evt = Event.current; switch (evt.type) { case EventType.KeyUp: if (evt.keyCode == KeyCode.S && EditorWindow.focusedWindow.Equals(window) && inFront != null && inFront.dataType == VRPNManager.DeviceType.Tracker) { VRPNSensorSelectionWindow.ShowSensorSelectionWindow(new Vector2(headerLabelsWidth, 200), new Rect(window.position.position.x, window.position.position.y, headerLabelsWidth, 0), inFront); } break; } } }