public override int ChildNameToIndex(string name) { if (name.EndsWith(":port")) { return(CollectionResolverUtilities.DefaultChildNameToIndex(name) + base.ChildCount); } return(base.ChildNameToIndex(name)); }
public void ForgetDynamicPort(InspectorProperty property) { var nodePortInfo = GetNodePortInfo(property.Name); // What index does he think he is? int index = CollectionResolverUtilities.DefaultChildNameToIndex(property.Name); if (index >= 0 && index < ChildCount) { var currentNodeWindow = NodeEditorWindow.current; EditorApplication.delayCall += () => { RemoveAt((TList)Property.ValueEntry.WeakValues[0], index); // Note: This really shouldn't be index 0 but it's impossible to multi edit currentNodeWindow.Repaint(); }; } }
public NodePortInfo GetNodePortInfo(string propertyName) { // Ensure the properties exist var index = CollectionResolverUtilities.DefaultChildNameToIndex(propertyName); var portInfo = GetInfoForPortAtIndex(index); if (portInfo == null) { return(null); } if (propertyToNodeProperty.TryGetValue(propertyName, out var portPropertyName)) { if (nameToNodePropertyInfo.TryGetValue(portPropertyName, out var nodePortInfo)) { return(nodePortInfo); } } return(null); }