mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 17:26:02 +08:00
Bugfix and old code removal
Fixed NodeEditorGUILayout.PortField being inconsistent with Ports drawn by NodeEditorGUILayout.PropertyField Removed obsolete NodeEditorGraph.GetNodePath
This commit is contained in:
parent
4b274df205
commit
c202829c9d
@ -112,11 +112,24 @@ namespace XNodeEditor {
|
||||
/// <summary> Make a simple port field. </summary>
|
||||
public static void PortField(GUIContent label, XNode.NodePort port, params GUILayoutOption[] options) {
|
||||
if (port == null) return;
|
||||
if (label == null) EditorGUILayout.LabelField(ObjectNames.NicifyVariableName(port.fieldName), options);
|
||||
else EditorGUILayout.LabelField(label, options);
|
||||
Rect rect = GUILayoutUtility.GetLastRect();
|
||||
if (port.direction == XNode.NodePort.IO.Input) rect.position = rect.position - new Vector2(16, 0);
|
||||
else if (port.direction == XNode.NodePort.IO.Output) rect.position = rect.position + new Vector2(rect.width, 0);
|
||||
Rect rect = new Rect();
|
||||
|
||||
// If property is an input, display a regular property field and put a port handle on the left side
|
||||
if (port.direction == XNode.NodePort.IO.Input) {
|
||||
// Display a label
|
||||
EditorGUILayout.LabelField(label != null ? label : new GUIContent(ObjectNames.NicifyVariableName(port.fieldName)), options);
|
||||
|
||||
rect = GUILayoutUtility.GetLastRect();
|
||||
rect.position = rect.position - new Vector2(16, 0);
|
||||
// If property is an output, display a text label and put a port handle on the right side
|
||||
} else if (port.direction == XNode.NodePort.IO.Output) {
|
||||
// Display a label
|
||||
EditorGUILayout.LabelField(label != null ? label : new GUIContent(ObjectNames.NicifyVariableName(port.fieldName)), NodeEditorResources.OutputPort, GUILayout.MinWidth(30));
|
||||
|
||||
rect = GUILayoutUtility.GetLastRect();
|
||||
rect.position = rect.position + new Vector2(rect.width, 0);
|
||||
}
|
||||
|
||||
rect.size = new Vector2(16, 16);
|
||||
|
||||
Color backgroundColor = new Color32(90, 97, 105, 255);
|
||||
|
||||
@ -28,12 +28,6 @@ namespace XNodeEditor {
|
||||
return new NodeEditorPreferences.Settings();
|
||||
}
|
||||
|
||||
/// <summary> Returns context menu path. Returns null if node is not available. </summary>
|
||||
[Obsolete("Use GetNodeMenuName instead")]
|
||||
public virtual string GetNodePath(Type type) {
|
||||
return GetNodeMenuName(type);
|
||||
}
|
||||
|
||||
/// <summary> Returns context node menu path. Null or empty strings for hidden nodes. </summary>
|
||||
public virtual string GetNodeMenuName(Type type) {
|
||||
//Check if type has the CreateNodeMenuAttribute
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user