1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-02-04 22:34:54 +08:00

Added Noodle Thickness at preferences

The default value for the thickness of the noodle can be modified from xNode preferences.

This value is only effective if the user does not make an override from the EditorGraph at GetNoodleThickness(...).

Many users do not like to edit from the script, this will help in the creation of my new layout template, similar to the new graphView from unity
This commit is contained in:
juliocp 2020-10-05 16:25:08 -03:00
parent 2c35e5ddb3
commit 629474d042
2 changed files with 4 additions and 1 deletions

View File

@ -42,6 +42,8 @@ namespace XNodeEditor {
[SerializeField] private string typeColorsData = ""; [SerializeField] private string typeColorsData = "";
[NonSerialized] public Dictionary<string, Color> typeColors = new Dictionary<string, Color>(); [NonSerialized] public Dictionary<string, Color> typeColors = new Dictionary<string, Color>();
[FormerlySerializedAs("noodleType")] public NoodlePath noodlePath = NoodlePath.Curvy; [FormerlySerializedAs("noodleType")] public NoodlePath noodlePath = NoodlePath.Curvy;
public float noodleThickness = 2f;
public NoodleStroke noodleStroke = NoodleStroke.Full; public NoodleStroke noodleStroke = NoodleStroke.Full;
private Texture2D _gridTexture; private Texture2D _gridTexture;
@ -160,6 +162,7 @@ namespace XNodeEditor {
EditorGUILayout.LabelField("Node", EditorStyles.boldLabel); EditorGUILayout.LabelField("Node", EditorStyles.boldLabel);
settings.highlightColor = EditorGUILayout.ColorField("Selection", settings.highlightColor); settings.highlightColor = EditorGUILayout.ColorField("Selection", settings.highlightColor);
settings.noodlePath = (NoodlePath) EditorGUILayout.EnumPopup("Noodle path", (Enum) settings.noodlePath); settings.noodlePath = (NoodlePath) EditorGUILayout.EnumPopup("Noodle path", (Enum) settings.noodlePath);
settings.noodleThickness = EditorGUILayout.FloatField(new GUIContent("Noodle thickness", "Noodle Thickness of the node connections"), settings.noodleThickness);
settings.noodleStroke = (NoodleStroke) EditorGUILayout.EnumPopup("Noodle stroke", (Enum) settings.noodleStroke); settings.noodleStroke = (NoodleStroke) EditorGUILayout.EnumPopup("Noodle stroke", (Enum) settings.noodleStroke);
settings.portTooltips = EditorGUILayout.Toggle("Port Tooltips", settings.portTooltips); settings.portTooltips = EditorGUILayout.Toggle("Port Tooltips", settings.portTooltips);
settings.dragToCreate = EditorGUILayout.Toggle(new GUIContent("Drag to Create", "Drag a port connection anywhere on the grid to create and connect a node"), settings.dragToCreate); settings.dragToCreate = EditorGUILayout.Toggle(new GUIContent("Drag to Create", "Drag a port connection anywhere on the grid to create and connect a node"), settings.dragToCreate);

View File

@ -125,7 +125,7 @@ namespace XNodeEditor {
/// <param name="output"> The output this noodle comes from. Never null. </param> /// <param name="output"> The output this noodle comes from. Never null. </param>
/// <param name="input"> The output this noodle comes from. Can be null if we are dragging the noodle. </param> /// <param name="input"> The output this noodle comes from. Can be null if we are dragging the noodle. </param>
public virtual float GetNoodleThickness(XNode.NodePort output, XNode.NodePort input) { public virtual float GetNoodleThickness(XNode.NodePort output, XNode.NodePort input) {
return 5f; return NodeEditorPreferences.GetSettings().noodleThickness;
} }
public virtual NoodlePath GetNoodlePath(XNode.NodePort output, XNode.NodePort input) { public virtual NoodlePath GetNoodlePath(XNode.NodePort output, XNode.NodePort input) {