void DrawBindingField(Rect rect, Rect editBtn, SerializedProperty pathProperty) { var path = pathProperty.stringValue; if (m_ManualEditMode || string.IsNullOrEmpty(BindingTreeItem.ParseName(path))) { EditorGUI.BeginChangeCheck(); path = EditorGUI.DelayedTextField(rect, path); if (EditorGUI.EndChangeCheck()) { pathProperty.stringValue = path; OnBindingModified(pathProperty); } if (GUI.Button(editBtn, "˅")) { rect.x += editBtn.width; ShowInputControlPicker(rect, pathProperty); } } else { var parsedPath = BindingTreeItem.ParseName(path); if (EditorGUI.DropdownButton(rect, new GUIContent(parsedPath), FocusType.Keyboard)) { ShowInputControlPicker(rect, pathProperty); } if (GUI.Button(editBtn, "...")) { m_ManualEditMode = true; } } }
public void OnGUI() { if (m_BindingProperty == null) { return; } EditorGUILayout.BeginVertical(); m_GeneralFoldout = DrawFoldout(m_GeneralContent, m_GeneralFoldout); if (m_GeneralFoldout) { EditorGUI.indentLevel++; var pathProperty = m_BindingProperty.FindPropertyRelative("path"); var path = BindingTreeItem.ParseName(pathProperty.stringValue); var btnRect = GUILayoutUtility.GetRect(0, EditorStyles.miniButton.lineHeight); btnRect = EditorGUI.IndentedRect(btnRect); if (EditorGUI.DropdownButton(btnRect, new GUIContent(path), FocusType.Keyboard)) { PopupWindow.Show(btnRect, new InputControlPicker(pathProperty, ref m_TreeViewState) { onPickCallback = OnBindingModified }); } EditorGUI.indentLevel--; } EditorGUILayout.Space(); m_InteractionsFoldout = DrawFoldout(m_InteractionsContent, m_InteractionsFoldout); if (m_InteractionsFoldout) { EditorGUI.indentLevel++; var listRect = GUILayoutUtility.GetRect(200, m_InteractionsListView.GetHeight()); listRect = EditorGUI.IndentedRect(listRect); m_InteractionsListView.DoList(listRect); EditorGUI.indentLevel--; } EditorGUILayout.Space(); m_ProcessorsFoldout = DrawFoldout(m_ProcessorsContent, m_ProcessorsFoldout); if (m_ProcessorsFoldout) { EditorGUI.indentLevel++; var listRect = GUILayoutUtility.GetRect(200, m_ProcessorsListView.GetHeight()); listRect = EditorGUI.IndentedRect(listRect); m_ProcessorsListView.DoList(listRect); EditorGUI.indentLevel--; } GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); }