private void OnGUI() { GUILayout.Label("URDF Transfer (From Unity to ROS)", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 100; protocolType = (RosConnector.Protocols)EditorGUILayout.EnumPopup("Protocol", protocolType); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); address = EditorGUILayout.TextField("Address", address); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); timeout = EditorGUILayout.IntField("Timeout [s]", timeout); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); assetPath = EditorGUILayout.TextField("Asset Path", assetPath); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Reset to Default", GUILayout.Width(150))) { DeleteEditorPrefs(); GetEditorPrefs(); } EditorGUILayout.EndHorizontal(); GUILayout.Space(20); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Read Robot Description")) { SetEditorPrefs(); Thread rosSocketConnectThread = new Thread(() => transferHandler.TransferUrdf(protocolType, address, timeout, assetPath)); rosSocketConnectThread.Start(); } EditorGUILayout.EndHorizontal(); GUILayout.Space(20); EditorGUIUtility.labelWidth = 300; DrawLabelField("1. rosbridge_server Connected:", "connected"); DrawLabelField("2. Robot Name Received:", "robotNameReceived"); DrawLabelField("3. Robot Description Received:", "robotDescriptionReceived"); DrawLabelField("4. Resource Files Received:", "resourceFilesReceived"); DrawLabelField("5. rosbridge_server Disconnected:", "disconnected"); DrawLabelField("6. Import Complete:", "importComplete"); }
private void OnGUI() { GUILayout.Label("URDF Transfer (From ROS to Unity)", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); address = EditorGUILayout.TextField("Address", address); EditorGUILayout.EndHorizontal(); showSettings = EditorGUILayout.Foldout(showSettings, "Settings"); if (showSettings) { EditorGUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 100; protocolType = (RosConnector.Protocols)EditorGUILayout.EnumPopup("Protocol", protocolType); EditorGUILayout.EndHorizontal(); //TODO URDF Parameter EditorGUILayout.BeginHorizontal(); urdfParameter = EditorGUILayout.TextField("URDF Parameter", urdfParameter); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); timeout = EditorGUILayout.IntField("Timeout [s]", timeout); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); assetPath = EditorGUILayout.TextField("Asset Path", assetPath); EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Reset to Default", GUILayout.Width(150))) { DeleteEditorPrefs(); GetEditorPrefs(); } EditorGUILayout.EndHorizontal(); GUILayout.Space(20); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Read Robot Description")) { SetEditorPrefs(); Thread rosSocketConnectThread = new Thread(() => transferHandler.TransferUrdf(protocolType, address, timeout, assetPath, urdfParameter)); rosSocketConnectThread.Start(); } EditorGUILayout.EndHorizontal(); GUILayout.Space(20); EditorGUIUtility.labelWidth = 300; DrawLabelField("Connected:", "connected"); DrawLabelField("Robot Name Received:", "robotNameReceived"); DrawLabelField("Robot Description Received:", "robotDescriptionReceived"); DrawLabelField("Resource Files Received:", "resourceFilesReceived"); DrawLabelField("Disconnected:", "disconnected"); DrawLabelField("Import Complete:", "importComplete"); }