static NodePinType DrawTypeField(Type currentType, NodeGraphType graphType, List <NodePinType> dropdownTypes) { var pinTypeData = graphType.GetPinType(currentType); var typeExists = dropdownTypes.Exists(x => x.WrappedType == pinTypeData.WrappedType); NodeEditor.Assertions.IsTrue(typeExists, "The specified type does not exist in the provided list of pin types."); if (typeExists) { var selectedIndex = dropdownTypes.IndexOf(pinTypeData); var dropdownOptions = dropdownTypes.Select(x => x.Name).ToArray(); selectedIndex = EditorGUILayout.Popup("Type", selectedIndex, dropdownOptions); return(dropdownTypes[selectedIndex]); } return(dropdownTypes[0]); }
public static NodePinType DrawTypeField(Type currentType, NodeGraphType graphType, params NodePinTypeCategory[] categories) { return(DrawTypeField(currentType, graphType, graphType.GetPins(categories))); }
public static void DrawTypeField(NodeGraphVariable graphVariable, NodeGraphType graphType) { var type = DrawTypeField(graphVariable.WrappedType, graphType).WrappedType; graphVariable.SetValueWrapperFromType(type); }
public static NodePinType DrawTypeField(Type currentType, NodeGraphType graphType) { return(DrawTypeField(currentType, graphType, graphType.PinTypeRegister.ToList())); }