private void InitializeCompositeProperties() { // Find name of current composite. var path = m_PathProperty.stringValue; var compositeNameAndParameters = NameAndParameters.Parse(path); var compositeName = compositeNameAndParameters.name; var compositeType = InputBindingComposite.s_Composites.LookupTypeRegistration(compositeName); // Collect all possible composite types. var selectedCompositeIndex = -1; var compositeTypeOptionsList = new List <GUIContent>(); var compositeTypeList = new List <string>(); var currentIndex = 0; foreach (var composite in InputBindingComposite.s_Composites.internedNames.Where(x => !InputBindingComposite.s_Composites.aliases.Contains(x)).OrderBy(x => x)) { if (InputBindingComposite.s_Composites.LookupTypeRegistration(composite) == compositeType) { selectedCompositeIndex = currentIndex; } var name = ObjectNames.NicifyVariableName(composite); compositeTypeOptionsList.Add(new GUIContent(name)); compositeTypeList.Add(composite); ++currentIndex; } // If the current composite type isn't a registered type, add it to the list as // an extra option. if (selectedCompositeIndex == -1) { selectedCompositeIndex = compositeTypeList.Count; compositeTypeOptionsList.Add(new GUIContent(ObjectNames.NicifyVariableName(compositeName))); compositeTypeList.Add(compositeName); } m_CompositeTypes = compositeTypeList.ToArray(); m_CompositeTypeOptions = compositeTypeOptionsList.ToArray(); m_SelectedCompositeType = selectedCompositeIndex; // Initialize parameters. m_CompositeParameters = new ParameterListView { onChange = OnCompositeParametersModified }; if (compositeType != null) { m_CompositeParameters.Initialize(compositeType, compositeNameAndParameters.parameters); } }
private void InitializeCompositeParameters() { m_CompositeParameters = new ParameterListView { onChange = OnCompositeParametersModified }; var path = m_PathProperty.stringValue; var nameAndParameters = InputControlLayout.ParseNameAndParameters(path); var compositeType = InputBindingComposite.s_Composites.LookupTypeRegistration(nameAndParameters.name); if (compositeType != null) { m_CompositeParameters.Initialize(compositeType, nameAndParameters.parameters); } }