override public void OnInspectorGUI() { GUILayout.Space(5f); if (_tex_logo != null) { UniOSCUtils.DrawClickableTextureHorizontal(_tex_logo, () => { EditorApplication.ExecuteMenuItem(UniOSCUtils.MENUITEM_EDITOR); }); } //EditorGUIUtility.LookLikeControls(150f,100f); EditorGUIUtility.labelWidth = 150f; EditorGUIUtility.fieldWidth = 100f; DrawDefaultInspector(); GUILayout.Space(5f); serializedObject.Update(); EditorGUI.BeginChangeCheck(); DrawConnectionSetup(); DrawConnectionInfo(); serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck()) { _target.enabled = !_target.enabled; _target.enabled = !_target.enabled; } }
override public void OnInspectorGUI() { GUILayout.Space(5f); if (_tex_logo != null) { UniOSCUtils.DrawClickableTextureHorizontal(_tex_logo, () => { EditorApplication.ExecuteMenuItem(UniOSCUtils.MENUITEM_EDITOR); }); } //EditorGUIUtility.LookLikeControls(150f,50f); EditorGUIUtility.labelWidth = 150f; EditorGUIUtility.fieldWidth = 50f; DrawDefaultInspector(); GUILayout.Space(5f); serializedObject.Update(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(OSCAddressProp, new GUIContent("OSC Address", "")); DrawConnectionSetup(); DrawConnectionInfo(); serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck() || _updateFlag) { ForceUpdate(); } }
override public void OnInspectorGUI() { GUILayout.Space(5f); if (_tex_logo != null) { UniOSCUtils.DrawClickableTextureHorizontal(_tex_logo, () => { EditorApplication.ExecuteMenuItem(UniOSCUtils.MENUITEM_EDITOR); }); } //EditorGUIUtility.LookLikeControls(150f,50f); EditorGUIUtility.labelWidth = 150f; EditorGUIUtility.fieldWidth = 50f; DrawDefaultInspector(); GUILayout.Space(5f); serializedObject.Update(); EditorGUI.BeginChangeCheck(); #region component List <Component> comps = _targetToggle.gameObject.GetComponents <Component>().ToList(); comps.Remove(comps.Find(c => c.GetType() == _targetToggle.GetType())); //security???? _options = new string[comps.Count]; for (int i = 0; i < comps.Count; i++) { _options[i] = comps[i].GetType().ToString(); } _componentIndex = comps.FindIndex(c => c.GetType() == _targetToggle.componentToToggle.GetType()); if (_componentIndex < 0) { //the current component was probably removed so we have to update our gameobject to prevent nasty exceptions (_compType) _updateFlag = true; } _componentIndex = Mathf.Max(0, _componentIndex); _componentIndex = EditorGUILayout.Popup("componentToToggle", _componentIndex, _options); _targetToggle.componentToToggle = comps[_componentIndex]; #endregion component ToggleStateProp.boolValue = GUILayout.Toggle(ToggleStateProp.boolValue, new GUIContent("Toggle State", "")); //,GUILayout.Width(100) EditorGUILayout.PropertyField(OSCAddressProp, new GUIContent("OSC Address", "")); DrawConnectionSetup(); DrawConnectionInfo(); serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck() || _updateFlag) { //update data (EditorUtility.SetDirty(_target) doesn't work) ForceUpdate(); } }
override public void OnInspectorGUI(){ GUILayout.Space(5f); if(_tex_logo != null){ UniOSCUtils.DrawClickableTextureHorizontal(_tex_logo,()=>{EditorApplication.ExecuteMenuItem(UniOSCUtils.MENUITEM_EDITOR);}); } EditorGUI.BeginChangeCheck(); if (drawDefaultInspectorProp.boolValue) { DrawDefaultInspector (); } serializedObject.Update(); //EditorGUI.BeginChangeCheck(); GUILayout.BeginVertical("box"); EditorGUILayout.PropertyField(OSCOutAddressProp,new GUIContent("OSC Out Address","") ); GUILayout.EndVertical(); GUILayout.BeginVertical("box"); EditorGUILayout.PropertyField(UseExplicitConnectionProp,new GUIContent("Explicit Connection",UniOSCUtils.TOOLTIP_EXPLICITCONNECTION) ); if(UseExplicitConnectionProp.boolValue) { EditorGUILayout.PropertyField(ExplicitConnectionProp,new GUIContent("Selected Connection","") ); GUILayout.EndVertical(); } else { GUILayout.EndVertical(); GUILayout.BeginVertical("box"); DrawIPAddress(); DrawPort(); GUILayout.EndVertical(); } //EditorGUILayout.PropertyField(sendIntervalProp,new GUIContent("Send Interval","The interval in milliseconds to send OSC data.") ); DrawConnectionInfo(); serializedObject.ApplyModifiedProperties(); if(EditorGUI.EndChangeCheck()){ //update data (EditorUtility.SetDirty(_target) doesn't work) _target.ForceSetupChange(true); //_target.enabled = !_target.enabled; //_target.enabled = !_target.enabled; } }
override public void OnInspectorGUI() { GUILayout.Space(5f); if (_tex_logo != null) { UniOSCUtils.DrawClickableTextureHorizontal(_tex_logo, () => { EditorApplication.ExecuteMenuItem(UniOSCUtils.MENUITEM_EDITOR); }); } //EditorGUIUtility.LookLikeControls(150f,50f); EditorGUIUtility.labelWidth = 150f; EditorGUIUtility.fieldWidth = 50f; DrawDefaultInspector(); GUILayout.Space(5f); serializedObject.Update(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(ReceiveAllAddressesProp, new GUIContent("Receive all Addresses", "Listen to all OSC addresses. If you have performance problems it's better to specifiy the OSC address explicit and deselect this option.")); if (!ReceiveAllAddressesProp.boolValue) { GUILayout.BeginVertical("box"); EditorGUILayout.PropertyField(OSCAddressProp, new GUIContent("OSC Address", "OSC address string the component should listen to. Other addresses are skipped so in your component callback method you don't need to filter the addresses by yourself.")); GUILayout.EndVertical(); } else { if (!Application.isPlaying) { GUIContent gc = new GUIContent("Component listens to all addresses. Watch your performance on heavy OSC traffic."); Rect area = GUILayoutUtility.GetRect(gc, GUI.skin.box); EditorGUI.HelpBox(area, gc.text, MessageType.Info); } } DrawConnectionSetup(); DrawConnectionInfo(); serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck()) { //update data (EditorUtility.SetDirty(_target) doesn't work) _target.ForceSetupChange(); //_target.enabled = !_target.enabled; //_target.enabled = !_target.enabled; } }
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); } }
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); } }