public void SetExplicitConnection(UniOSCConnection newCon) { if (useExplicitConnection) { explicitConnection = newCon; } }
protected void _OnConnectionInStatusChanged(UniOSCConnection con) { //Debug.Log("UniOSCEventTarget._OnConnectionInStatusChanged"); //force refresh of status enabled = !enabled; enabled = !enabled; }
protected void _OnConnectionOutStatusChanged(UniOSCConnection con) { if (!con.isConnectedOut) { return; } //Debug.Log("_OnConnectionOutStatusChanged"); bool isChanged = false; isChanged = (_oscOutIPAddress != con.oscOutIPAddress || _oscOutPort != con.oscOutPort); if (isChanged) { _oscOutIPAddress = con.oscOutIPAddress; _oscOutPort = con.oscOutPort; //force refresh _SetupChanged(false); } /* * if (_isEnabled){ * Disable(); * Enable(); * } * */ }
public UniOSCEventTargetCB(UniOSCConnection con) { //Debug.Log("UniOSCEventTargetCB.Construktor"); //oscPort = con.oscPort; _receiveAllPorts = false; _receiveAllAddresses = true; _useExplicitConnection = true; _explicitConnection = con; Awake(); }
protected void _OnConnectionInStatusChanged(UniOSCConnection con) { //Debug.Log("UniOSCEventTarget._OnConnectionInStatusChanged"); // if (!con.isConnected) return; if (_oscPort != con.oscPort) { _oscPort = con.oscPort; //force refresh of status _SetupChanged(); } }
static void _CreateOSCConnection() { GameObject go = new GameObject("OSCConnection" + _osConnectionList.Count); UniOSCConnection oc = go.AddComponent <UniOSCConnection>(); oc.oscPort = 8000; oc.oscOutPort = 9000; oc.oscOutIPAddress = UniOSCUtils.GetLocalIPAddress(); go.name = "OSCConnection." + go.GetInstanceID(); oc.Awake(); }
void OnGUI_OSCConnection() { EditorGUILayout.BeginHorizontal(); //Hardcoding layout for wrapping int maxCols = 3; int minCols = 1; maxCols = (int)Math.Max(minCols, Math.Floor((_editorWidth - 20f) / (400f * 1.0f))); //Floor Ceiling if (_osConnectionIDList.Count <= 0) { EditorGUILayout.BeginVertical(); GUILayout.Space(10f); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); Rect area = GUILayoutUtility.GetRect(500.0f, 80.0f); EditorGUI.HelpBox(area, "There is no OSCConnection discovered. Please create an OSCConnection or enable a GameObject with an OSCConnection component in your project.\nIf you can't see any OSCConnection even if you have enabled one please hit the 'Refresh Editor' button.", MessageType.Info); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); GUILayout.Space(10f); EditorGUILayout.EndVertical(); } else { for (var i = 0; i < _osConnectionIDList.Count; i++) { // Begin new row? if (i % maxCols == 0 && i > 0) { GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); } //without storing ID we loose the connection to the instances on Play/Stop UniOSCConnection con = EditorUtility.InstanceIDToObject(_osConnectionIDList[i]) as UniOSCConnection; if (con != null) { EditorGUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(400f)); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(con.name); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); UniOSCConnectionEditor.ShowOSCReciverStatus(con); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } } //for GUILayout.FlexibleSpace(); //push Layout } //if EditorGUILayout.EndHorizontal(); }
protected void _OnConnectionOutStatusChanged(UniOSCConnection con) { if (!con.isConnectedOut) { return; } oscOutIPAddress = con.oscOutIPAddress; oscOutPort = con.oscOutPort; //force refresh of status enabled = !enabled; enabled = !enabled; }
public UniOSCEventDispatcherCB(string __oscOutAddress, UniOSCConnection __explicitConnection) { _oscOutAddress = __oscOutAddress; if (__explicitConnection != null) { _oscOutIPAddress = __explicitConnection.oscOutIPAddress; _oscOutPort = __explicitConnection.oscOutPort; } _explicitConnection = __explicitConnection; _useExplicitConnection = true; Awake(); }
public static void Show (string label,SerializedProperty list) { EditorGUILayout.LabelField(label); EditorGUI.indentLevel += 1; if (list.isExpanded) { for (int i = 0; i < list.arraySize; i++) { UniOSCConnection con = list.GetArrayElementAtIndex(i).objectReferenceValue as UniOSCConnection; EditorGUILayout.LabelField(con.name); } } EditorGUI.indentLevel -= 1; }
public UniOSCEventTargetCB(string _oscAddress, UniOSCConnection con) { //Debug.Log("UniOSCEventTargetCB.Construktor"); //oscPort = con.oscPort; _receiveAllPorts = false; _receiveAllAddresses = false; if (!_oscAddresses.Contains(_oscAddress)) { _oscAddresses.Add(_oscAddress); } _useExplicitConnection = true; _explicitConnection = con; Awake(); }
private void _HandleOnPlayModeChanged() { Debug.Log("_HandleOnPlayModeChanged"); // This method is run whenever the playmode state is changed. if (Application.isPlaying) { //Debug.Log("PLAY"); } else { //Debug.Log("STOP"); } //When we change the playmode we have to trigger a new Connection setup on our oscTargets, otherwise we loose our event binding! UniOSCConnection actualCon = null; if (OSCConnectionID >= 0) { actualCon = EditorUtility.InstanceIDToObject(OSCConnectionID) as UniOSCConnection; } oscTarget1.ForceSetupChange(); //If we use a explicitConnection we need to update the reference to the OSCConection: oscTarget2.explicitConnection = actualCon; oscTarget3.ForceSetupChange(); oscTarget4.ForceSetupChange(); oscTarget5.explicitConnection = actualCon; oscSender1.explicitConnection = actualCon; /* * if (! EditorApplication.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode) * { * * Debug.Log("PLAY"); * } * * if (EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode) * { * Debug.Log("STOP"); * } */ }
public void OnEnable() { // Debug.Log("OnEnable"); // We need to monitor the playmodeStateChanged event to update the references to OSCConnections (only necessary when we use the explicitConnection feature) //and force a new connection setup through disable/enable on our OSCEventTargets otherwise we have to re-open our Editor EditorApplication.playmodeStateChanged += _HandleOnPlayModeChanged; //Here we show the different possibilities to create a OSCEventTarget from code: //When we only specify a port we listen to all OSCmessages on that port (We assume that there is a OSCConnection with that listening port in our scene) oscTarget1 = new UniOSCEventTargetCBImplementation(OSCPort); oscTarget1.OSCMessageReceived += OnOSCMessageReceived1; oscTarget1.Enable(); //When we use a OSCConnection in the constructor of a OSCEventTarget instance we need to also store the InstanceID to be able to re-reference it on playmodeStateChanges! OSCConnection = FindObjectOfType <UniOSCConnection>() as UniOSCConnection; if (OSCConnection != null) { OSCConnectionID = OSCConnection.GetInstanceID(); } //This implies that we use the explicitConnection mode. (With responding to all OSCmessages) oscTarget2 = new UniOSCEventTargetCBImplementation(OSCConnection); oscTarget2.OSCMessageReceived += OnOSCMessageReceived2; oscTarget2.Enable(); //We listen to a special OSCAddress regardless of the port. oscTarget3 = new UniOSCEventTargetCBImplementation(OSCAddress); oscTarget3.OSCMessageReceived += OnOSCMessageReceived3; oscTarget3.Enable(); //The standard : respond to a given OSCAddress on a given port oscTarget4 = new UniOSCEventTargetCBImplementation(OSCAddress, OSCPort); oscTarget4.OSCMessageReceived += OnOSCMessageReceived4; oscTarget4.Enable(); //This version has the advantage that we are not bound to a special port. If the connection changes the port we still respond to the OSCMessage oscTarget5 = new UniOSCEventTargetCBImplementation(OSCAddress, OSCConnection); oscTarget5.OSCMessageReceived += OnOSCMessageReceived5; oscTarget5.Enable(); oscSender1 = new UniOSCEventDispatcherCBImplementation(OSCOutAddress, OSCConnection); oscSender1.AppendData("TestData"); oscSender1.AppendData(12345); oscSender1.Enable(); }
private static void _DropArea(Event evt, Rect area, UniOSCConnection oscConnection) { switch (evt.type) { case EventType.MouseDown: if (area.Contains(evt.mousePosition)) { EditorGUIUtility.PingObject(oscConnection); Selection.activeObject = oscConnection; } break; case EventType.DragUpdated: case EventType.DragPerform: if (!area.Contains(evt.mousePosition)) { return; } DragAndDrop.visualMode = DragAndDropVisualMode.Copy; if (evt.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); foreach (UnityEngine.Object dragged_object in DragAndDrop.objectReferences) { if (dragged_object.GetType() == typeof(UniOSCMappingFileObj)) { if (!oscConnection.oscMappingFileObjList.Contains((UniOSCMappingFileObj)dragged_object)) { oscConnection.oscMappingFileObjList.Add((UniOSCMappingFileObj)dragged_object); } } if (dragged_object.GetType() == typeof(UniOSCSessionFileObj)) { if (!oscConnection.oscSessionFileObjList.Contains((UniOSCSessionFileObj)dragged_object)) { oscConnection.oscSessionFileObjList.Add((UniOSCSessionFileObj)dragged_object); } } } //foreach } //DragPerform break; } //switch }
protected void _OnConnectionOutStatusChanged(UniOSCConnection con) { if (!con.isConnectedOut) { return; } //Debug.Log("_OnConnectionOutStatusChanged"); oscOutIPAddress = con.oscOutIPAddress; oscOutPort = con.oscOutPort; //force refresh if (_isEnabled) { Disable(); Enable(); } }
static void _SetupOSCConnectionsOSCMessageReceivedEvent(bool flag) { foreach (var id in _osConnectionIDList) { UniOSCConnection c = EditorUtility.InstanceIDToObject(id) as UniOSCConnection; if (c != null) { //security!!! c.OSCMessageReceivedRaw -= _OnOSCMessageReceived; c.OSCMessageSend -= _OnOSCMessageSended; if (flag == true) { c.OSCMessageReceivedRaw += _OnOSCMessageReceived; c.OSCMessageSend += _OnOSCMessageSended; } } } //for }
void OnEnable() { if (target != _target) { _target = target as UniOSCConnection; } serializedObject.Update(); tex_logo = Resources.Load(UniOSCUtils.LOGO16_NAME, typeof(Texture2D)) as Texture2D; LoadTextures(); AutoConnectOSCInProp = serializedObject.FindProperty("autoConnectOSCIn"); AutoConnectOSCOutProp = serializedObject.FindProperty("autoConnectOSCOut"); OSCPortProp = serializedObject.FindProperty("oscPort"); OSCMappingFileObjListProp = serializedObject.FindProperty("oscMappingFileObjList"); OSCSessionFileObjListProp = serializedObject.FindProperty("oscSessionFileObjList"); OSCOutPortProp = serializedObject.FindProperty("oscOutPort"); OSCOutIPAddressProp = serializedObject.FindProperty("oscOutIPAddress"); FoldoutOSCOutProp = serializedObject.FindProperty("foldoutOSCOut"); FoldoutOSCInProp = serializedObject.FindProperty("foldoutOSCIn"); serializedObject.ApplyModifiedProperties(); }
protected void _OnConnectionOutStatusChanged(UniOSCConnection con) { // Debug.Log("UniOSCEventDispatcher._OnConnectionOutStatusChanged"); //if(!con.isConnectedOut)return; bool isChanged = false; isChanged = (_oscOutIPAddress != con.oscOutIPAddress || _oscOutPort != con.oscOutPort); if (isChanged) { _oscOutIPAddress = con.oscOutIPAddress; _oscOutPort = con.oscOutPort; //force refresh of status _SetupChanged(false); } /* * enabled = !enabled; * enabled = !enabled; */ }
void OnEnable() { if (target != _target) { _target = target as UniOSCConnection; } serializedObject.Update(); tex_logo = Resources.Load(UniOSCUtils.LOGO16_NAME, typeof(Texture2D)) as Texture2D; LoadTextures(); AutoConnectOSCInProp = serializedObject.FindProperty("autoConnectOSCIn"); AutoConnectOSCOutProp = serializedObject.FindProperty("autoConnectOSCOut"); OSCPortProp = serializedObject.FindProperty("_oscPort"); OSCMappingFileObjListProp = serializedObject.FindProperty("oscMappingFileObjList"); OSCSessionFileObjListProp = serializedObject.FindProperty("oscSessionFileObjList"); OSCOutPortProp = serializedObject.FindProperty("_oscOutPort"); OSCOutIPAddressProp = serializedObject.FindProperty("_oscOutIPAddress"); FoldoutOSCOutProp = serializedObject.FindProperty("foldoutOSCOut"); FoldoutOSCInProp = serializedObject.FindProperty("foldoutOSCIn"); TransmissionTypeInProp = serializedObject.FindProperty("_transmissionTypeIn"); OSCMulticastIPAddressProp = serializedObject.FindProperty("_oscMulticastIPAddress"); OSCOutMulticastIPAddressProp = serializedObject.FindProperty("_oscOutMulticastIPAddress"); TransmissionTypeOutProp = serializedObject.FindProperty("_transmissionTypeOut"); _TransmissionTypes = new string[TransmissionTypeInProp.enumNames.Length - 2]; Array.Copy(TransmissionTypeInProp.enumNames, _TransmissionTypes, _TransmissionTypes.Length); _TransmissionTypesOut = new string[TransmissionTypeInProp.enumNames.Length - 1]; Array.Copy(TransmissionTypeInProp.enumNames, _TransmissionTypesOut, _TransmissionTypesOut.Length); // _TransmissionTypes = TransmissionTypeOutProp.enumNames; serializedObject.ApplyModifiedProperties(); }
public UniOSCEventDispatcherCBSimple(string __oscOutAddress, UniOSCConnection __explicitConnection) : base(__oscOutAddress, __explicitConnection) { }
public UniOSCEventTargetCBImplementation(UniOSCConnection con) : base(con) { }
private void _HandleOnPlayModeChanged() { // This method is run whenever the playmode state is changed. if (Application.isPlaying) { //Debug.Log("PLAY"); } else { //Debug.Log("STOP"); } //When we change the playmode we have to trigger a new Connection setup on our oscTargets, otherwise we lose our event binding! UniOSCConnection actualCon = null; if (OSCConnectionID >= 0) { actualCon = EditorUtility.InstanceIDToObject(OSCConnectionID) as UniOSCConnection; } //Debug.Log("OSC Connections (playmodechanged):" + _myOSCConnections.Count); //Debug.Log("OSCConnectionID="+OSCConnectionID); if (oscSender1.isEnabled) { oscSender1.Disable(); oscSender1.SetExplicitConnection(actualCon); oscSender1.Enable(); } if (oscSender2.isEnabled) { oscSender2.Disable(); oscSender2.SetExplicitConnection(actualCon); oscSender2.Enable(); } if (oscSender3.isEnabled) { oscSender3.Disable(); oscSender3.SetExplicitConnection(actualCon); oscSender3.Enable(); } if (oscSender4.isEnabled) { oscSender4.Disable(); oscSender4.SetExplicitConnection(actualCon); oscSender4.Enable(); } /* * if (! EditorApplication.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode) * { * * Debug.Log("PLAY"); * } * * if (EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode) * { * Debug.Log("STOP"); * } */ }
public static void ShowOSCReciverStatus(UniOSCConnection oscConnection) { EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); Event evt = Event.current; GUIStyle style = new GUIStyle(GUI.skin.button); style.padding = new RectOffset(0, 0, 0, 0); style.border = new RectOffset(0, 0, 0, 0); #region IN EditorGUILayout.BeginVertical(GUILayout.MaxWidth(200)); Rect area = GUILayoutUtility.GetRect(195.0f, 40.0f); area.width *= 1f; Rect r1 = GUILayoutUtility.GetRect(195.0f, 20.0f); r1.width *= 1f; int btnsize1 = 20; Rect r1b = new Rect(area); r1b.x += r1b.width - (btnsize1 * 1); r1b.y += r1b.height - btnsize1; r1b.width = btnsize1 * 1; r1b.height = btnsize1; if (oscConnection.isConnected) { GUI.contentColor = Color.white; GUI.backgroundColor = oscConnection.dispatchOSC ? UniOSCUtils.CONNECTION_ON_COLOR : UniOSCUtils.CONNECTION_PAUSE_COLOR; //EditorGUI.HelpBox(area, "OSC IN: " + UniOSCConnection.localIPAddress + "\nPort: "+ oscConnection.oscPort + "\nListening", MessageType.Info); EditorGUI.HelpBox(area, "OSC IN: " + oscConnection.oscInIPAddress + "\nPort: " + oscConnection.oscPort + "\nListening", MessageType.Info); if (GUI.Button(r1, "Disconnect")) { oscConnection.DisconnectOSC(); } GUI.backgroundColor = Color.white; GUI.contentColor = Color.white; //if (GUI.Button (r1b,new GUIContent(tex2,""),style ) ){oscConnection.SendTestMessage();} Texture2D currTex = oscConnection.dispatchOSC ? texON : texOFF; oscConnection.dispatchOSC = GUI.Toggle(r1b, oscConnection.dispatchOSC, new GUIContent(currTex, "Turn the OSC dispatching into Unity on/off"), style); } else { GUI.contentColor = Color.white; GUI.backgroundColor = UniOSCUtils.CONNECTION_BG; //GUI.Box(area,"");//GUI.skin.box GUI.backgroundColor = UniOSCUtils.CONNECTION_OFF_COLOR; //EditorGUI.HelpBox(area, "OSC IN: "+ UniOSCConnection.localIPAddress + "\nPort: " + oscConnection.oscPort + "\nNot listening", MessageType.Warning); EditorGUI.HelpBox(area, "OSC IN: " + oscConnection.oscInIPAddress + "\nPort: " + oscConnection.oscPort + "\nNot listening", MessageType.Warning); if (GUI.Button(r1, "Connect")) { if (oscConnection.hasValidOscIPAddress) { oscConnection.ConnectOSC(); } else { EditorUtility.DisplayDialog("Invalid IP Address", "The IPAddress you have choosen is not valid! Please use a different.", "OK"); } } } _DropArea(evt, area, oscConnection); EditorGUILayout.EndVertical(); #endregion IN if (oscConnection.oscOut) { GUILayout.Space(5f); //GUILayout.FlexibleSpace(); //OUT------------------------- EditorGUILayout.BeginVertical(GUILayout.MaxWidth(200f)); Rect area_out = GUILayoutUtility.GetRect(100.0f, 40.0f); //, GUILayout.ExpandWidth (true) area_out.width *= 1f; //0.95f; Rect r2 = GUILayoutUtility.GetRect(100.0f, 20.0f); r2.width *= 1f; //0.95f; int btnsize = 20; Rect r2b = new Rect(area_out); r2b.x += r2b.width - (btnsize * 1); r2b.y += r2b.height - btnsize; r2b.width = btnsize * 1; r2b.height = btnsize; if (oscConnection.isConnectedOut) { GUI.contentColor = Color.white; GUI.backgroundColor = oscConnection.dispatchOSCOut ? UniOSCUtils.CONNECTION_ON_COLOR : UniOSCUtils.CONNECTION_PAUSE_COLOR; EditorGUI.HelpBox(area_out, "OSC OUT: " + oscConnection.oscOutIPAddress + "\nPort: " + oscConnection.oscOutPort + "\nIs sending", MessageType.Info); //oscConnection.name+ if (GUI.Button(r2, "Disconnect")) { oscConnection.DisconnectOSCOut(); } GUI.backgroundColor = Color.white; GUI.contentColor = Color.white; //if ( GUI.Button (r2b,new GUIContent(texTestMessage,""),style ) ){oscConnection.SendTestMessage();} Texture2D currTex = oscConnection.dispatchOSCOut ? texON : texOFF; oscConnection.dispatchOSCOut = GUI.Toggle(r2b, oscConnection.dispatchOSCOut, new GUIContent(currTex, "Turn the OSC sending from Unity on/off without start/stop the network resources"), style); } else { GUI.backgroundColor = Color.red; GUI.contentColor = Color.white; EditorGUI.HelpBox(area_out, "OSC OUT: " + oscConnection.oscOutIPAddress + "\nPort: " + oscConnection.oscOutPort + "\nNot sending", MessageType.Warning); //oscConnection.name+ if (GUI.Button(r2, "Connect")) { if (oscConnection.hasValidOscOutIPAddress) { oscConnection.ConnectOSCOut(); } else { EditorUtility.DisplayDialog("Invalid IP Address", "The IPAddress you have choosen is not valid! Please use a different.", "OK"); } } } _DropArea(evt, area_out, oscConnection); EditorGUILayout.EndVertical(); //OUT-------------------------------- } //if(oscConnection.OSCOut){ GUI.backgroundColor = Color.white; GUI.contentColor = Color.white; EditorGUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(oscConnection); } }
public void OnEnable() { // Debug.Log("OnEnable"); // We need to monitor the playmodeStateChanged event to update the references to OSCConnections (only necessary when we use the explicitConnection feature) //and force a new connection setup through disable/enable on our OSCEventTargets otherwise we have to re-open our Editor EditorApplication.playmodeStateChanged += _HandleOnPlayModeChanged; //When we use a OSCConnection in the constructor of a OSCEventTarget instance we need to also store the InstanceID to be able to re-reference it on playmodeStateChanges! OSCConnection = FindObjectOfType <UniOSCConnection>() as UniOSCConnection; // list of all connections //_myOSCConnections if (OSCConnection != null) { OSCConnectionID = OSCConnection.GetInstanceID(); //Debug.Log(OSCConnection.GetInstanceID()); //int numberOfConnections = FindObjectsOfTypeAll(typeof(UniOSCConnection)).Length; //L[] numberOfConnections = FindObjectsOfType(typeof(UniOSCConnection)) as UniOSCConnection[]; // Debug.Log("IP: "+OSCConnection.oscOutIPAddress+" Port:"+OSCConnection.oscOutPort+" Instance ID: "+OSCConnection.GetInstanceID); Debug.Log("OSC Connections:" + _myOSCConnections.Count); //public UniOSCEventDispatcherCBImplementation(string _oscOutAddress, string _oscOutIPAddress, int _oscPort): base( _oscOutAddress, _oscOutIPAddress, _oscPort) //oscSender1 = new UniOSCEventDispatcherCBImplementation(OSCOutAddress1,"10.0.1.10", 9000); oscSender1 = new UniOSCEventDispatcherCBImplementation(OSCOutAddress1, OSCConnection); oscSender1.AppendData(pageLabel1); //oscSender1.AppendData(pageLabel1); //oscSender1.AppendData(pageLabel1); oscSender1.Enable(); //oscSender2 = new UniOSCEventDispatcherCBImplementation(OSCOutAddress2,"10.0.1.10", 9000); oscSender2 = new UniOSCEventDispatcherCBImplementation(OSCOutAddress2, OSCConnection); oscSender2.AppendData(pageLabel2); //oscSender1.AppendData("b"); oscSender2.Enable(); // oscSender3 = new UniOSCEventDispatcherCBImplementation(OSCOutAddress3,"10.0.1.10", 9000); oscSender3 = new UniOSCEventDispatcherCBImplementation(OSCOutAddress3, OSCConnection); oscSender3.AppendData(pageLabel3); //oscSender1.AppendData("b"); oscSender3.Enable(); //oscSender4 = new UniOSCEventDispatcherCBImplementation(OSCOutAddress4,"10.0.1.10", 9000); oscSender4 = new UniOSCEventDispatcherCBImplementation(OSCOutAddress4, OSCConnection); oscSender4.AppendData(pageLabel4); //oscSender1.AppendData("b"); oscSender4.Enable(); //oscSender5 = new UniOSCEventDispatcherCBImplementation(OSCOutAddress5,"10.0.1.10", 9000); oscSender5 = new UniOSCEventDispatcherCBImplementation(OSCOutAddress5, OSCConnection); oscSender5.AppendData(pageLabel5); //oscSender1.AppendData("b"); oscSender5.Enable(); } }
override public void OnInspectorGUI() { GUILayout.Space(5); if (tex_logo != null) { UniOSCUtils.DrawClickableTextureHorizontal(tex_logo, () => { EditorApplication.ExecuteMenuItem(UniOSCUtils.MENUITEM_EDITOR); }); } serializedObject.Update(); EditorGUI.BeginChangeCheck(); FoldoutOSCInProp.boolValue = EditorGUILayout.Foldout(FoldoutOSCInProp.boolValue, "OSC IN"); if (FoldoutOSCInProp.boolValue) { GUILayout.BeginVertical("box"); EditorGUILayout.PropertyField(AutoConnectOSCInProp, new GUIContent("Auto connect on start", "")); EditorGUILayout.PropertyField(OSCPortProp, new GUIContent("Port:")); OSCPortProp.intValue = Mathf.Min(UniOSCUtils.MAXPORT, OSCPortProp.intValue); _TransmissionTypeIndex = TransmissionTypeInProp.enumValueIndex; _TransmissionTypeIndex = EditorGUILayout.Popup("TransmissionType", _TransmissionTypeIndex, _TransmissionTypes); TransmissionTypeInProp.enumValueIndex = _TransmissionTypeIndex; GUI.backgroundColor = _target.hasValidOscIPAddress ? Color.green : Color.red; if (TransmissionTypeInProp.enumValueIndex == (int)OSCsharp.Net.TransmissionType.Multicast) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(OSCMulticastIPAddressProp, new GUIContent("Multicast IP address", "")); EditorGUILayout.HelpBox("A valid multicast IP address is in the range between 224.0.0.0 and 239.255.255.255 !", MessageType.Warning); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); _target.ValidateOscInIPAddress(); } } else { GUI.backgroundColor = Color.white; GUILayout.BeginHorizontal("box"); EditorGUILayout.LabelField(new GUIContent("Local IP address ", ""), GUILayout.MaxWidth(115)); // GUILayout.FlexibleSpace(); EditorGUILayout.LabelField(new GUIContent(UniOSCConnection.localIPAddress, ""), GUILayout.MaxWidth(100)); // GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUI.backgroundColor = Color.white; GUILayout.EndVertical(); } if (EditorGUI.EndChangeCheck()) { // Debug.Log("CHANGE"); serializedObject.ApplyModifiedProperties(); UniOSCConnection.Update_AvailableOSCSettings(); _target.Force_SetupChanged_IN(); } EditorGUI.BeginChangeCheck(); FoldoutOSCOutProp.boolValue = EditorGUILayout.Foldout(FoldoutOSCOutProp.boolValue, "OSC OUT"); if (FoldoutOSCOutProp.boolValue) { GUILayout.BeginVertical("box"); EditorGUILayout.PropertyField(AutoConnectOSCOutProp, new GUIContent("Auto connect on start", "")); EditorGUILayout.PropertyField(OSCOutPortProp, new GUIContent("Port", "")); OSCOutPortProp.intValue = Mathf.Min(UniOSCUtils.MAXPORT, OSCOutPortProp.intValue); // _TransmissionTypes = TransmissionTypeOutProp.enumNames; _TransmissionTypeIndexOut = TransmissionTypeOutProp.enumValueIndex; _TransmissionTypeIndexOut = EditorGUILayout.Popup("TransmissionType", _TransmissionTypeIndexOut, _TransmissionTypesOut); TransmissionTypeOutProp.enumValueIndex = _TransmissionTypeIndexOut; GUI.backgroundColor = _target.hasValidOscOutIPAddress ? Color.green : Color.red; EditorGUI.BeginChangeCheck(); switch (TransmissionTypeOutProp.enumValueIndex) { case (int)OSCsharp.Net.TransmissionType.Unicast: EditorGUILayout.PropertyField(OSCOutIPAddressProp, new GUIContent("Target IP address", "")); break; case (int)OSCsharp.Net.TransmissionType.Multicast: EditorGUILayout.PropertyField(OSCOutMulticastIPAddressProp, new GUIContent("Multicast IP address", "")); EditorGUILayout.HelpBox("A valid multicast IP address is in the range between 224.0.0.0 and 239.255.255.255 !", MessageType.Warning); break; case (int)OSCsharp.Net.TransmissionType.Broadcast: case (int)OSCsharp.Net.TransmissionType.LocalBroadcast: GUI.backgroundColor = Color.white; GUILayout.BeginHorizontal("box"); EditorGUILayout.LabelField(new GUIContent("Target IP address", ""), GUILayout.MaxWidth(115)); GUILayout.FlexibleSpace(); EditorGUILayout.LabelField(new GUIContent(IPAddress.Broadcast.ToString(), ""), GUILayout.MaxWidth(100)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); break; } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); _target.ValidateOscOutIPAddress(); } GUI.backgroundColor = Color.white; GUILayout.EndVertical(); } GUILayout.Space(10); if (EditorGUI.EndChangeCheck()) { // Debug.Log("CHANGE"); serializedObject.ApplyModifiedProperties(); UniOSCConnection.Update_AvailableOSCSettings(); _target.Force_SetupChanged_OUT(); } ShowOSCReciverStatus(_target); Show("Mapping Files", OSCMappingFileObjListProp); Show("Session Files", OSCSessionFileObjListProp); if (_target.hasOSCSessionFileAttached) { //EditorGUILayout.PropertyField(AutoConnectOSCInProp,new GUIContent("Auto connect on start","") ); if (GUILayout.Button(new GUIContent("Send Session Data", "Send the last OSC data that are recorded with your session files."), GUILayout.Width(150f))) { _target.SendSessionData(); } if (!_target.isConnectedOut) { EditorGUILayout.HelpBox("To send the session data you have to turn on OSC OUT!", MessageType.Warning); } } serializedObject.ApplyModifiedProperties(); if (GUI.changed) { EditorUtility.SetDirty(_target); } }
public UniOSCEventTargetCBImplementation(string oscAddress, UniOSCConnection con) : base(oscAddress, con) { }
override public void OnInspectorGUI() { GUILayout.Space(5); if (tex_logo != null) { UniOSCUtils.DrawClickableTextureHorizontal(tex_logo, () => { EditorApplication.ExecuteMenuItem(UniOSCUtils.MENUITEM_EDITOR); }); } serializedObject.Update(); EditorGUI.BeginChangeCheck(); FoldoutOSCInProp.boolValue = EditorGUILayout.Foldout(FoldoutOSCInProp.boolValue, "OSC IN"); if (FoldoutOSCInProp.boolValue) { GUILayout.BeginVertical("box"); EditorGUILayout.PropertyField(AutoConnectOSCInProp, new GUIContent("Auto connect on start", "")); EditorGUILayout.PropertyField(OSCPortProp, new GUIContent("Port:")); OSCPortProp.intValue = Mathf.Min(UniOSCUtils.MAXPORT, OSCPortProp.intValue); GUILayout.EndVertical(); } FoldoutOSCOutProp.boolValue = EditorGUILayout.Foldout(FoldoutOSCOutProp.boolValue, "OSC OUT"); if (FoldoutOSCOutProp.boolValue) { GUILayout.BeginVertical("box"); EditorGUILayout.PropertyField(AutoConnectOSCOutProp, new GUIContent("Auto connect on start", "")); EditorGUILayout.PropertyField(OSCOutPortProp, new GUIContent("Port", "")); OSCOutPortProp.intValue = Mathf.Min(UniOSCUtils.MAXPORT, OSCOutPortProp.intValue); EditorGUILayout.PropertyField(OSCOutIPAddressProp, new GUIContent("Target IPAddress", "")); GUILayout.EndVertical(); } GUILayout.Space(10); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); UniOSCConnection.Update_AvailablePorts(); } ShowOSCReciverStatus(_target); Show("Mapping Files", OSCMappingFileObjListProp); Show("Session Files", OSCSessionFileObjListProp); if (_target.hasOSCSessionFileAttached) { //EditorGUILayout.PropertyField(AutoConnectOSCInProp,new GUIContent("Auto connect on start","") ); if (GUILayout.Button(new GUIContent("Send Session Data", "Send the last OSC data that are recorded with your session files."), GUILayout.Width(150f))) { _target.SendSessionData(); } if (!_target.isConnectedOut) { EditorGUILayout.HelpBox("To send the session data you have to turn on OSC OUT!", MessageType.Warning); //EditorGUI.HelpBox(area,"OSC IN: "+UniOSCConnection.localIPAddress+"\nPort: "+oscConnection.oscPort+"\nListening", MessageType.Info); } } serializedObject.ApplyModifiedProperties(); if (GUI.changed) { EditorUtility.SetDirty(_target); } }
public UniOSCEventDispatcherCBRawImplementation(string _oscOutAddress, UniOSCConnection _explicitConnection) : base(_oscOutAddress, _explicitConnection) { }
private void _OnConnectionInStatusChanged(UniOSCConnection con) { //Debug.Log("UniOSCEventTargetCB._OnConnectionInStatusChanged"); }