private void LoadPropertiesForSelection() { m_BindingPropertyView = null; m_ActionPropertyView = null; // Column #1: Load selected action map. if (m_ActionMapsTree.GetSelectedRow() != null) { var row = m_ActionMapsTree.GetSelectedRow(); if (row != null) { m_ActionsTree.actionMapProperty = m_ActionMapsTree.GetSelectedRow().elementProperty; m_ActionsTree.Reload(); } } // Column #2: Load selected action or binding. if (m_ActionsTree.HasSelection() && m_ActionsTree.GetSelection().Count == 1) { var item = m_ActionsTree.GetSelectedRow(); if (item is BindingTreeItem) { // Grab the action for the binding and see if we have an expected control layout // set on it. Pass that on to the control picking machinery. var isCompositePartBinding = item is CompositeTreeItem; var isCompositeBinding = item is CompositeGroupTreeItem; var actionItem = (isCompositePartBinding ? item.parent.parent : item.parent) as ActionTreeItem; Debug.Assert(actionItem != null); // Show properties for binding. m_BindingPropertyView = new InputBindingPropertiesView( item.elementProperty, change => { if (change == InputBindingPropertiesView.k_CompositeTypeChanged) { Debug.Assert(isCompositeBinding, "Binding is expected to be a composite"); // This is a pretty complex change. We basically tear out part of the binding tree // and replace it with a different structure. var actionMapRow = (ActionMapTreeItem)m_ActionMapsTree.GetSelectedRow(); Debug.Assert(actionMapRow != null); var compositeName = m_BindingPropertyView.compositeType; var compositeType = InputBindingComposite.s_Composites.LookupTypeRegistration(compositeName); InputActionSerializationHelpers.ChangeCompositeType(actionMapRow.bindingsProperty, actionItem.bindingsStartIndex + item.index, compositeName, compositeType, actionItem.actionName); ApplyAndReload(); } else if (change == InputBindingPropertiesView.k_PathChanged) { // If path changed, perform a full reload as it affects the action tree. // Otherwise just do a "soft" apply. This is important so as to not lose // edit state while editing parameters on interactions or processors. ApplyAndReload(); } else { // Simple property change that doesn't affect the rest of the UI. Apply(); } }, m_PickerTreeViewState, m_InputActionWindowToolbar, isCompositeBinding: isCompositeBinding, expectedControlLayout: item.expectedControlLayout); } if (item is ActionTreeItem actionItem1) { // Show properties for binding. m_ActionPropertyView = new InputActionPropertiesView( actionItem1.elementProperty, // Apply without reload is enough here. change => Apply()); } } }