mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 01:36:03 +08:00
Changed node rendering. Header and Body (and optionally ports) sections are separate images. Allows more customizability.
Updated Node Editor Preferences window. Better separators. Added additional appearance options. Removed Rounding in GridToWindowPositionNoClipped() (and DrawGrid()) which was originally meant to fix UI Sharpness. But it did not have impact in my case and without it made panning feel much smoother.
This commit is contained in:
parent
ebb36fbd28
commit
7ec429ba77
@ -31,7 +31,7 @@ namespace XNodeEditor
|
||||
|
||||
public virtual void OnHeaderGUI()
|
||||
{
|
||||
GUILayout.Label(target.name, NodeEditorResources.styles.nodeHeader, GUILayout.Height(30));
|
||||
GUILayout.Label(target.name, NodeEditorResources.styles.nodeHeaderLabel, GUILayout.Height(30));
|
||||
}
|
||||
|
||||
/// <summary> Draws standard field editors for all public fields </summary>
|
||||
@ -119,6 +119,11 @@ namespace XNodeEditor
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called after rendering. Used for additional controls specific to a node.
|
||||
/// </summary>
|
||||
public virtual void OnControlsGUI() {}
|
||||
|
||||
public virtual int GetWidth()
|
||||
{
|
||||
Type type = target.GetType();
|
||||
@ -131,7 +136,7 @@ namespace XNodeEditor
|
||||
return 208;
|
||||
}
|
||||
|
||||
/// <summary> Returns color for target node </summary>
|
||||
/// <summary> Returns tint for target node </summary>
|
||||
public virtual Color GetTint()
|
||||
{
|
||||
// Try get color from [NodeTint] attribute
|
||||
@ -146,9 +151,34 @@ namespace XNodeEditor
|
||||
return NodeEditorPreferences.GetSettings().tintColor;
|
||||
}
|
||||
|
||||
public virtual GUIStyle GetBodyStyle()
|
||||
/// <summary> Returns header color for target node </summary>
|
||||
public virtual Color GetHeaderColor()
|
||||
{
|
||||
return NodeEditorResources.styles.nodeBody;
|
||||
// Try get color from [NodeColorHeader] attribute
|
||||
Type type = target.GetType();
|
||||
Color color;
|
||||
if (type.TryGetAttributeHeader(out color))
|
||||
{
|
||||
return color;
|
||||
}
|
||||
// Return default color (grey)
|
||||
|
||||
return NodeEditorPreferences.GetSettings().bgHeaderColor;
|
||||
}
|
||||
|
||||
/// <summary> Returns body color for target node </summary>
|
||||
public virtual Color GetBodyColor()
|
||||
{
|
||||
// Try get color from [NodeColorBody] attribute
|
||||
Type type = target.GetType();
|
||||
Color color;
|
||||
if (type.TryGetAttributeBody(out color))
|
||||
{
|
||||
return color;
|
||||
}
|
||||
// Return default color (grey)
|
||||
|
||||
return NodeEditorPreferences.GetSettings().bgBodyColor;
|
||||
}
|
||||
|
||||
public virtual GUIStyle GetHeaderStyle()
|
||||
@ -156,6 +186,21 @@ namespace XNodeEditor
|
||||
return NodeEditorResources.styles.nodeHeader;
|
||||
}
|
||||
|
||||
public virtual GUIStyle GetPortsStyle()
|
||||
{
|
||||
return NodeEditorResources.styles.nodePorts;
|
||||
}
|
||||
|
||||
public virtual GUIStyle GetBodyStyle()
|
||||
{
|
||||
return NodeEditorResources.styles.nodeBody;
|
||||
}
|
||||
|
||||
public virtual GUIStyle GetHeaderLabelStyle()
|
||||
{
|
||||
return NodeEditorResources.styles.nodeHeaderLabel;
|
||||
}
|
||||
|
||||
public virtual GUIStyle GetBodyHighlightStyle()
|
||||
{
|
||||
return NodeEditorResources.styles.nodeHighlight;
|
||||
|
||||
@ -135,7 +135,9 @@ namespace XNodeEditor
|
||||
|
||||
Repaint();
|
||||
}
|
||||
else if (currentActivity == NodeActivity.HoldNode)
|
||||
else if (IsHoveringNode && IsHoveringTitle(hoveredNode) &&
|
||||
currentActivity == NodeActivity.HoldNode)
|
||||
|
||||
{
|
||||
RecalculateDragOffsets(e);
|
||||
isDoubleClick = false;
|
||||
@ -241,11 +243,11 @@ namespace XNodeEditor
|
||||
else if (e.button == 1 || e.button == 2)
|
||||
{
|
||||
//check drag threshold for larger screens
|
||||
if (e.delta.magnitude > dragThreshold)
|
||||
{
|
||||
panOffset += e.delta * zoom;
|
||||
// if (e.delta.magnitude > dragThreshold)
|
||||
// {
|
||||
// }
|
||||
isPanning = true;
|
||||
}
|
||||
panOffset += e.delta * zoom;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -425,7 +427,8 @@ namespace XNodeEditor
|
||||
}
|
||||
|
||||
// If click node header, select it.
|
||||
if ((currentActivity == NodeActivity.HoldNode || !IsSelectingRenamingObject) &&
|
||||
if (IsHoveringNode && IsHoveringTitle(hoveredNode) &&
|
||||
(currentActivity == NodeActivity.HoldNode || !IsSelectingRenamingObject) &&
|
||||
!(e.control || e.shift))
|
||||
{
|
||||
selectedReroutes.Clear();
|
||||
@ -459,7 +462,7 @@ namespace XNodeEditor
|
||||
|
||||
Repaint();
|
||||
}
|
||||
else if (e.button == 1 || e.button == 2)
|
||||
else if (e.button == 1)
|
||||
{
|
||||
if (!isPanning)
|
||||
{
|
||||
@ -896,7 +899,7 @@ namespace XNodeEditor
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsHoveringTitle(Node node)
|
||||
public bool IsHoveringTitle(Node node)
|
||||
{
|
||||
Vector2 mousePos = Event.current.mousePosition;
|
||||
//Get node position
|
||||
|
||||
@ -113,8 +113,8 @@ namespace XNodeEditor
|
||||
Vector2 tileOffset = new Vector2(xOffset, yOffset);
|
||||
|
||||
// Amount of tiles
|
||||
float tileAmountX = Mathf.Round(rect.size.x * zoom) / gridTex.width;
|
||||
float tileAmountY = Mathf.Round(rect.size.y * zoom) / gridTex.height;
|
||||
float tileAmountX = rect.size.x * zoom / gridTex.width;
|
||||
float tileAmountY = rect.size.y * zoom / gridTex.height;
|
||||
|
||||
Vector2 tileAmount = new Vector2(tileAmountX, tileAmountY);
|
||||
|
||||
@ -694,9 +694,7 @@ namespace XNodeEditor
|
||||
}
|
||||
else
|
||||
{
|
||||
GUIStyle style = new GUIStyle(nodeEditor.GetBodyStyle());
|
||||
GUI.color = nodeEditor.GetTint();
|
||||
GUILayout.BeginVertical(style);
|
||||
GUILayout.BeginVertical();
|
||||
}
|
||||
|
||||
GUI.color = guiColor;
|
||||
@ -709,10 +707,27 @@ namespace XNodeEditor
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.color = nodeEditor.GetHeaderColor();
|
||||
GUIStyle style = new GUIStyle(nodeEditor.GetHeaderStyle());
|
||||
GUILayout.BeginVertical(style);
|
||||
|
||||
GUI.color = guiColor;
|
||||
nodeEditor.OnHeaderGUI();
|
||||
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
GUI.color = nodeEditor.GetBodyColor();
|
||||
GUIStyle bodyStyle = new GUIStyle(nodeEditor.GetBodyStyle());
|
||||
GUILayout.BeginVertical(bodyStyle);
|
||||
|
||||
GUI.color = guiColor;
|
||||
GUIStyle bodyPaddingStyle = NodeEditorResources.styles.nodePadding;
|
||||
GUILayout.BeginVertical(bodyPaddingStyle);
|
||||
nodeEditor.OnBodyGUI();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
//If user changed a value, notify other scripts through onUpdateNode
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
@ -809,6 +824,7 @@ namespace XNodeEditor
|
||||
}
|
||||
|
||||
GUILayout.EndArea();
|
||||
nodeEditor.OnControlsGUI();
|
||||
}
|
||||
|
||||
if (e.type != EventType.Layout && currentActivity == NodeActivity.DragGrid)
|
||||
|
||||
@ -67,6 +67,9 @@ namespace XNodeEditor
|
||||
public float maxZoom = 5f;
|
||||
public float minZoom = 1f;
|
||||
public Color32 tintColor = new Color32(90, 97, 105, 255);
|
||||
public Color32 bgHeaderColor = new Color32(50, 51, 54, 255);
|
||||
public Color32 bgPortsColor = new Color32(65, 67, 70, 255);
|
||||
public Color32 bgBodyColor = new Color32(65, 67, 70, 255);
|
||||
public Color32 highlightColor = new Color32(255, 255, 255, 255);
|
||||
public bool gridSnap = true;
|
||||
public bool autoSave = true;
|
||||
@ -190,6 +193,10 @@ namespace XNodeEditor
|
||||
VerifyLoaded();
|
||||
Settings settings = NodeEditorPreferences.settings[lastKey];
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.Space(5);
|
||||
|
||||
EditorGUILayout.BeginVertical();
|
||||
if (GUILayout.Button(new GUIContent("Documentation", "https://github.com/Siccity/xNode/wiki"),
|
||||
GUILayout.Width(100)))
|
||||
{
|
||||
@ -206,12 +213,16 @@ namespace XNodeEditor
|
||||
{
|
||||
ResetPrefs();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
private static void GridSettingsGUI(string key, Settings settings)
|
||||
{
|
||||
//Label
|
||||
EditorGUILayout.LabelField("Grid", EditorStyles.boldLabel);
|
||||
// EditorGUILayout.LabelField("Grid", EditorStyles.boldLabel);
|
||||
Separator("Grid Appearance");
|
||||
settings.gridSnap = EditorGUILayout.Toggle(new GUIContent("Snap", "Hold CTRL in editor to invert"),
|
||||
settings.gridSnap);
|
||||
settings.zoomToMouse =
|
||||
@ -224,8 +235,8 @@ namespace XNodeEditor
|
||||
settings.minZoom =
|
||||
EditorGUILayout.FloatField(new GUIContent("Min", "Lower limit to zoom"), settings.minZoom);
|
||||
EditorGUI.indentLevel--;
|
||||
settings.gridLineColor = EditorGUILayout.ColorField("Color", settings.gridLineColor);
|
||||
settings.gridBgColor = EditorGUILayout.ColorField(" ", settings.gridBgColor);
|
||||
settings.gridLineColor = EditorGUILayout.ColorField("Line Color", settings.gridLineColor);
|
||||
settings.gridBgColor = EditorGUILayout.ColorField("Background Color", settings.gridBgColor);
|
||||
if (GUI.changed)
|
||||
{
|
||||
SavePrefs(key, settings);
|
||||
@ -239,7 +250,8 @@ namespace XNodeEditor
|
||||
private static void SystemSettingsGUI(string key, Settings settings)
|
||||
{
|
||||
//Label
|
||||
EditorGUILayout.LabelField("System", EditorStyles.boldLabel);
|
||||
// EditorGUILayout.LabelField("System", EditorStyles.boldLabel);
|
||||
Separator("System");
|
||||
settings.autoSave =
|
||||
EditorGUILayout.Toggle(new GUIContent("Autosave", "Disable for better editor performance"),
|
||||
settings.autoSave);
|
||||
@ -258,14 +270,20 @@ namespace XNodeEditor
|
||||
private static void NodeSettingsGUI(string key, Settings settings)
|
||||
{
|
||||
//Label
|
||||
EditorGUILayout.LabelField("Node", EditorStyles.boldLabel);
|
||||
settings.tintColor = EditorGUILayout.ColorField("Tint", settings.tintColor);
|
||||
// EditorGUILayout.LabelField("Node", EditorStyles.boldLabel);
|
||||
Separator("Node Appearance");
|
||||
settings.tintColor = EditorGUILayout.ColorField("Global Tint", settings.tintColor);
|
||||
settings.bgHeaderColor = EditorGUILayout.ColorField("Header Background", settings.bgHeaderColor);
|
||||
settings.bgPortsColor = EditorGUILayout.ColorField("Ports Background", settings.bgPortsColor);
|
||||
settings.bgBodyColor = EditorGUILayout.ColorField("Body Background", settings.bgBodyColor);
|
||||
settings.highlightColor = EditorGUILayout.ColorField("Selection", settings.highlightColor);
|
||||
EditorGUILayout.Space();
|
||||
settings.noodlePath = (NoodlePath)EditorGUILayout.EnumPopup("Noodle path", 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", settings.noodleStroke);
|
||||
EditorGUILayout.Space();
|
||||
settings.portTooltips = EditorGUILayout.Toggle("Port Tooltips", settings.portTooltips);
|
||||
settings.dragToCreate =
|
||||
EditorGUILayout.Toggle(
|
||||
@ -290,7 +308,8 @@ namespace XNodeEditor
|
||||
private static void TypeColorsGUI(string key, Settings settings)
|
||||
{
|
||||
//Label
|
||||
EditorGUILayout.LabelField("Types", EditorStyles.boldLabel);
|
||||
// EditorGUILayout.LabelField("Types", EditorStyles.boldLabel);
|
||||
Separator("Types");
|
||||
|
||||
//Clone keys so we can enumerate the dictionary and make changes.
|
||||
var typeColorKeys = new List<Type>(typeColors.Keys);
|
||||
@ -322,6 +341,35 @@ namespace XNodeEditor
|
||||
}
|
||||
}
|
||||
|
||||
private static void Separator(string label = "")
|
||||
{
|
||||
Rect labelRect = EditorGUILayout.BeginHorizontal(GUILayout.Height(25));
|
||||
labelRect.y += 10;
|
||||
|
||||
GUIStyle labelStyle = new GUIStyle(GUI.skin.label);
|
||||
labelStyle.fontStyle = FontStyle.Bold;
|
||||
Vector2 textSize = labelStyle.CalcSize(new GUIContent(label));
|
||||
float separatorWidth = (labelRect.width - textSize.x) / 2 - 5;
|
||||
|
||||
// Needed here otherwise BeginHorizontal group has 0 height.
|
||||
GUILayout.Label("");
|
||||
Color initialColor = GUI.color;
|
||||
Color lineColor = new Color(0.5f, 0.5f, 0.5f);
|
||||
GUI.color = lineColor;
|
||||
GUI.Box(new Rect(labelRect.xMin + 5, labelRect.yMin, separatorWidth - 5, 1), string.Empty);
|
||||
|
||||
GUI.color = initialColor;
|
||||
GUI.Label(new Rect(labelRect.xMin + separatorWidth + 5, labelRect.yMin - 10, textSize.x, 20), label,
|
||||
labelStyle);
|
||||
|
||||
GUI.color = lineColor;
|
||||
GUI.Box(new Rect(labelRect.xMin + separatorWidth + 10 + textSize.x, labelRect.yMin, separatorWidth - 5, 1),
|
||||
string.Empty);
|
||||
|
||||
GUI.color = initialColor;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
/// <summary> Load prefs if they exist. Create if they don't </summary>
|
||||
private static Settings LoadPrefs()
|
||||
{
|
||||
|
||||
@ -16,6 +16,8 @@ namespace XNodeEditor
|
||||
public static class NodeEditorReflection
|
||||
{
|
||||
[NonSerialized] private static Dictionary<Type, Color> nodeTint;
|
||||
[NonSerialized] private static Dictionary<Type, Color> nodeHeaderColor;
|
||||
[NonSerialized] private static Dictionary<Type, Color> nodeBodyColor;
|
||||
[NonSerialized] private static Dictionary<Type, int> nodeWidth;
|
||||
/// <summary> All available node types </summary>
|
||||
public static Type[] nodeTypes => _nodeTypes != null ? _nodeTypes : _nodeTypes = GetNodeTypes();
|
||||
@ -37,7 +39,7 @@ namespace XNodeEditor
|
||||
return GetDerivedTypes(typeof(Node));
|
||||
}
|
||||
|
||||
/// <summary> Custom node tint colors defined with [NodeColor(r, g, b)] </summary>
|
||||
/// <summary> Custom node tint colors defined with [NodeTint(r, g, b)] </summary>
|
||||
public static bool TryGetAttributeTint(this Type nodeType, out Color tint)
|
||||
{
|
||||
if (nodeTint == null)
|
||||
@ -48,6 +50,29 @@ namespace XNodeEditor
|
||||
return nodeTint.TryGetValue(nodeType, out tint);
|
||||
}
|
||||
|
||||
/// <summary> Custom node header colors defined with [NodeColorHeader(r, g, b)] </summary>
|
||||
public static bool TryGetAttributeHeader(this Type nodeType, out Color headerColor)
|
||||
{
|
||||
if (nodeHeaderColor == null)
|
||||
{
|
||||
CacheAttributes<Color, Node.NodeColorHeaderAttribute>(ref nodeHeaderColor, x => x.color);
|
||||
}
|
||||
|
||||
return nodeHeaderColor.TryGetValue(nodeType, out headerColor);
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Custom node body colors defined with [NodeColorBody(r, g, b)] </summary>
|
||||
public static bool TryGetAttributeBody(this Type nodeType, out Color bodyColor)
|
||||
{
|
||||
if (nodeBodyColor == null)
|
||||
{
|
||||
CacheAttributes<Color, Node.NodeColorBodyAttribute>(ref nodeBodyColor, x => x.color);
|
||||
}
|
||||
|
||||
return nodeBodyColor.TryGetValue(nodeType, out bodyColor);
|
||||
}
|
||||
|
||||
/// <summary> Get custom node widths defined with [NodeWidth(width)] </summary>
|
||||
public static bool TryGetAttributeWidth(this Type nodeType, out int width)
|
||||
{
|
||||
|
||||
@ -11,9 +11,17 @@ namespace XNodeEditor
|
||||
public static Texture2D dotOuter =>
|
||||
_dotOuter != null ? _dotOuter : _dotOuter = Resources.Load<Texture2D>("xnode_dot_outer");
|
||||
private static Texture2D _dotOuter;
|
||||
|
||||
public static Texture2D nodeHeader =>
|
||||
_nodeHeader != null ? _nodeHeader : _nodeHeader = Resources.Load<Texture2D>("xnode_node_header");
|
||||
private static Texture2D _nodeHeader;
|
||||
public static Texture2D nodePorts =>
|
||||
_nodePorts != null ? _nodePorts : _nodePorts = Resources.Load<Texture2D>("xnode_node_ports");
|
||||
private static Texture2D _nodePorts;
|
||||
public static Texture2D nodeBody =>
|
||||
_nodeBody != null ? _nodeBody : _nodeBody = Resources.Load<Texture2D>("xnode_node");
|
||||
_nodeBody != null ? _nodeBody : _nodeBody = Resources.Load<Texture2D>("xnode_node_body");
|
||||
private static Texture2D _nodeBody;
|
||||
|
||||
public static Texture2D nodeHighlight => _nodeHighlight != null
|
||||
? _nodeHighlight
|
||||
: _nodeHighlight = Resources.Load<Texture2D>("xnode_node_highlight");
|
||||
@ -25,7 +33,16 @@ namespace XNodeEditor
|
||||
public static GUIStyle OutputPort => new GUIStyle(EditorStyles.label) { alignment = TextAnchor.UpperRight };
|
||||
public class Styles
|
||||
{
|
||||
public GUIStyle inputPort, outputPort, nodeHeader, nodeHeaderRename, nodeBody, tooltip, nodeHighlight;
|
||||
public GUIStyle inputPort,
|
||||
outputPort,
|
||||
nodeHeaderLabel,
|
||||
nodeHeaderLabelRename,
|
||||
nodeHeader,
|
||||
nodePorts,
|
||||
nodeBody,
|
||||
nodePadding,
|
||||
tooltip,
|
||||
nodeHighlight;
|
||||
|
||||
public Styles()
|
||||
{
|
||||
@ -44,22 +61,37 @@ namespace XNodeEditor
|
||||
outputPort.active.background = dot;
|
||||
outputPort.normal.background = dotOuter;
|
||||
|
||||
nodeHeader = new GUIStyle();
|
||||
nodeHeader.alignment = TextAnchor.MiddleCenter;
|
||||
nodeHeader.fontStyle = FontStyle.Bold;
|
||||
nodeHeader.normal.textColor = Color.white;
|
||||
nodeHeaderLabel = new GUIStyle();
|
||||
nodeHeaderLabel.alignment = TextAnchor.MiddleCenter;
|
||||
nodeHeaderLabel.fontStyle = FontStyle.Bold;
|
||||
nodeHeaderLabel.normal.textColor = Color.white;
|
||||
|
||||
nodeHeaderRename = new GUIStyle(GUI.skin.textField);
|
||||
nodeHeaderRename.alignment = TextAnchor.MiddleCenter;
|
||||
nodeHeaderRename.fontStyle = FontStyle.Bold;
|
||||
nodeHeaderRename.normal.textColor = Color.white;
|
||||
nodeHeaderRename.fixedHeight = 18;
|
||||
nodeHeaderRename.margin = new RectOffset(5, 5, 10, 8);
|
||||
nodeHeaderLabelRename = new GUIStyle(GUI.skin.textField);
|
||||
nodeHeaderLabelRename.alignment = TextAnchor.MiddleCenter;
|
||||
nodeHeaderLabelRename.fontStyle = FontStyle.Bold;
|
||||
nodeHeaderLabelRename.normal.textColor = Color.white;
|
||||
nodeHeaderLabelRename.fixedHeight = 18;
|
||||
nodeHeaderLabelRename.margin = new RectOffset(5, 5, 10, 8);
|
||||
|
||||
nodePadding = new GUIStyle();
|
||||
nodePadding.padding = new RectOffset(16, 16, 3, 16);
|
||||
|
||||
nodeHeader = new GUIStyle();
|
||||
nodeHeader.normal.background = NodeEditorResources.nodeHeader;
|
||||
nodeHeader.border = new RectOffset(32, 32, 16, 0);
|
||||
// nodeHeader.fixedHeight = 27;
|
||||
nodeHeader.padding = new RectOffset(0, 0, 1, 0);
|
||||
// nodeHeader.padding = new RectOffset(16, 16, 3, 16);
|
||||
|
||||
nodePorts = new GUIStyle();
|
||||
nodePorts.normal.background = NodeEditorResources.nodePorts;
|
||||
nodePorts.border = new RectOffset(32, 32, 32, 32);
|
||||
// nodePorts.padding = new RectOffset(16, 16, 3, 16);
|
||||
|
||||
nodeBody = new GUIStyle();
|
||||
nodeBody.normal.background = NodeEditorResources.nodeBody;
|
||||
nodeBody.border = new RectOffset(32, 32, 32, 32);
|
||||
nodeBody.padding = new RectOffset(16, 16, 4, 16);
|
||||
// nodeBody.padding = new RectOffset(16, 16, 3, 16);
|
||||
|
||||
nodeHighlight = new GUIStyle();
|
||||
nodeHighlight.normal.background = NodeEditorResources.nodeHighlight;
|
||||
|
||||
@ -96,23 +96,12 @@ namespace XNodeEditor
|
||||
{
|
||||
if (playModeStateChange == PlayModeStateChange.EnteredEditMode)
|
||||
{
|
||||
// graph = EditorUtility.InstanceIDToObject(graphInstanceID) as NodeGraph;
|
||||
// OnOpen(graphInstanceID, 0);
|
||||
// Repaint();
|
||||
editModeEntered = true;
|
||||
}
|
||||
else if (playModeStateChange == PlayModeStateChange.ExitingPlayMode)
|
||||
{
|
||||
// OnOpen(graphInstanceID, 0);
|
||||
// Repaint();
|
||||
editModeEntered = false;
|
||||
}
|
||||
|
||||
// if (!EditorApplication.isPlaying)
|
||||
// {
|
||||
// OnOpen(graphInstanceID, 0);
|
||||
// Repaint();
|
||||
// }
|
||||
}
|
||||
|
||||
public Dictionary<Node, Vector2> nodeSizes { get; } = new Dictionary<Node, Vector2>();
|
||||
@ -279,9 +268,8 @@ namespace XNodeEditor
|
||||
public Vector2 GridToWindowPositionNoClipped(Vector2 gridPosition)
|
||||
{
|
||||
Vector2 center = position.size * 0.5f;
|
||||
// UI Sharpness complete fix - Round final offset not panOffset
|
||||
float xOffset = Mathf.Round(center.x * zoom + (panOffset.x + gridPosition.x));
|
||||
float yOffset = Mathf.Round(center.y * zoom + (panOffset.y + gridPosition.y));
|
||||
float xOffset = center.x * zoom + (panOffset.x + gridPosition.x);
|
||||
float yOffset = center.y * zoom + (panOffset.y + gridPosition.y);
|
||||
return new Vector2(xOffset, yOffset);
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XNode;
|
||||
@ -14,11 +15,13 @@ namespace XNodeEditor.NodeGroups
|
||||
public static Texture2D corner =>
|
||||
_corner != null ? _corner : _corner = Resources.Load<Texture2D>("xnode_corner");
|
||||
private static Texture2D _corner;
|
||||
private bool _isDragging;
|
||||
private bool _isResizing;
|
||||
private Vector2 _size;
|
||||
private float _currentHeight;
|
||||
private Vector2 _draggingOffset;
|
||||
|
||||
private List<Vector2> _childNodesDragOffsets;
|
||||
|
||||
private const int mouseRectPadding = 4;
|
||||
private const int mouseRectMargin = 30;
|
||||
|
||||
@ -27,7 +30,7 @@ namespace XNodeEditor.NodeGroups
|
||||
public override void OnCreate()
|
||||
{
|
||||
_currentHeight = group.height;
|
||||
headerStyle = new GUIStyle(NodeEditorResources.styles.nodeHeader);
|
||||
headerStyle = new GUIStyle(NodeEditorResources.styles.nodeHeaderLabel);
|
||||
headerStyle.fontSize = 18;
|
||||
}
|
||||
|
||||
@ -38,11 +41,12 @@ namespace XNodeEditor.NodeGroups
|
||||
|
||||
public override void OnBodyGUI()
|
||||
{
|
||||
NodeEditorWindow.current.wantsMouseMove = true;
|
||||
Event e = Event.current;
|
||||
switch (e.type)
|
||||
{
|
||||
case EventType.MouseDrag:
|
||||
if (_isDragging)
|
||||
if (_isResizing)
|
||||
{
|
||||
group.width = Mathf.Max(200, (int)e.mousePosition.x + (int)_draggingOffset.x + 16);
|
||||
group.height = Mathf.Max(100, (int)e.mousePosition.y + (int)_draggingOffset.y - 34);
|
||||
@ -58,6 +62,14 @@ namespace XNodeEditor.NodeGroups
|
||||
return;
|
||||
}
|
||||
|
||||
_childNodesDragOffsets = new List<Vector2>(group.GetNodes().Count);
|
||||
foreach (Node node in group.GetNodes())
|
||||
{
|
||||
_childNodesDragOffsets.Add(node.position -
|
||||
NodeEditorWindow.current.WindowToGridPosition(
|
||||
e.mousePosition));
|
||||
}
|
||||
|
||||
if (NodeEditorWindow.current.nodeSizes.TryGetValue(target, out _size))
|
||||
{
|
||||
// Mouse position checking is in node local space
|
||||
@ -65,7 +77,7 @@ namespace XNodeEditor.NodeGroups
|
||||
_size.y - (mouseRectMargin + mouseRectPadding), mouseRectMargin, mouseRectMargin);
|
||||
if (lowerRight.Contains(e.mousePosition))
|
||||
{
|
||||
_isDragging = true;
|
||||
_isResizing = true;
|
||||
_draggingOffset = _size - e.mousePosition - new Vector2(GetBodyStyle().padding.right,
|
||||
GetBodyStyle().padding.bottom);
|
||||
}
|
||||
@ -73,9 +85,9 @@ namespace XNodeEditor.NodeGroups
|
||||
|
||||
break;
|
||||
case EventType.MouseUp:
|
||||
_isDragging = false;
|
||||
_isResizing = false;
|
||||
// Select nodes inside the group
|
||||
if (Selection.Contains(target))
|
||||
if (false && Selection.Contains(target))
|
||||
{
|
||||
var selection = Selection.objects.ToList();
|
||||
// Select Nodes
|
||||
@ -159,9 +171,9 @@ namespace XNodeEditor.NodeGroups
|
||||
|
||||
public override void OnRenameActive()
|
||||
{
|
||||
_currentHeight += 30 - NodeEditorResources.styles.nodeHeaderRename.fixedHeight -
|
||||
NodeEditorResources.styles.nodeHeaderRename.margin.top +
|
||||
NodeEditorResources.styles.nodeHeaderRename.margin.bottom / 2;
|
||||
_currentHeight += 30 - NodeEditorResources.styles.nodeHeaderLabelRename.fixedHeight -
|
||||
NodeEditorResources.styles.nodeHeaderLabelRename.margin.top +
|
||||
NodeEditorResources.styles.nodeHeaderLabelRename.margin.bottom / 2;
|
||||
}
|
||||
|
||||
|
||||
@ -175,12 +187,7 @@ namespace XNodeEditor.NodeGroups
|
||||
return group.width;
|
||||
}
|
||||
|
||||
public override Color GetTint()
|
||||
{
|
||||
return group.color;
|
||||
}
|
||||
|
||||
public override GUIStyle GetHeaderStyle()
|
||||
public override GUIStyle GetHeaderLabelStyle()
|
||||
{
|
||||
return headerStyle;
|
||||
}
|
||||
|
||||
@ -35,9 +35,9 @@ namespace XNodeEditor
|
||||
public void DrawRenameTextField()
|
||||
{
|
||||
GUI.SetNextControlName(inputControlName);
|
||||
GUIStyle stylesNodeHeaderRename = NodeEditorResources.styles.nodeHeaderRename;
|
||||
GUIStyle stylesNodeHeaderRename = NodeEditorResources.styles.nodeHeaderLabelRename;
|
||||
stylesNodeHeaderRename.fontSize =
|
||||
NodeEditor.GetEditor((Node)target, NodeEditorWindow.current).GetHeaderStyle().fontSize;
|
||||
NodeEditor.GetEditor((Node)target, NodeEditorWindow.current).GetHeaderLabelStyle().fontSize;
|
||||
input = GUILayout.TextField(input, stylesNodeHeaderRename);
|
||||
EditorGUI.FocusTextInControl(inputControlName);
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 813 B |
@ -1,14 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fea1dcb24935ef4ca514d534eb6aa3d
|
||||
timeCreated: 1507454532
|
||||
licenseType: Free
|
||||
guid: 55ecb0ff22e012c46bddb615781f372f
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 4
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -21,7 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -30,69 +34,107 @@ TextureImporter:
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 31, y: 31, z: 31, w: 31}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Standalone
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: WebGL
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 1537655665
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
BIN
Scripts/Editor/Resources/xnode_node_body.png
Normal file
BIN
Scripts/Editor/Resources/xnode_node_body.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
140
Scripts/Editor/Resources/xnode_node_body.png.meta
Normal file
140
Scripts/Editor/Resources/xnode_node_body.png.meta
Normal file
@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0fdf78a71a9fcf42ae10d50f558cde8
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Scripts/Editor/Resources/xnode_node_header.png
Normal file
BIN
Scripts/Editor/Resources/xnode_node_header.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 438 B |
140
Scripts/Editor/Resources/xnode_node_header.png.meta
Normal file
140
Scripts/Editor/Resources/xnode_node_header.png.meta
Normal file
@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 822c779e6791fd645a3aeb9593342a8d
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,15 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ab2b92d7e1771b47bba0a46a6f0f6d5
|
||||
timeCreated: 1516610730
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -22,7 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -31,12 +34,12 @@ TextureImporter:
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
@ -45,18 +48,40 @@ TextureImporter:
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 1
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
@ -65,8 +90,11 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
@ -75,13 +103,38 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
BIN
Scripts/Editor/Resources/xnode_node_ports.png
Normal file
BIN
Scripts/Editor/Resources/xnode_node_ports.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
140
Scripts/Editor/Resources/xnode_node_ports.png.meta
Normal file
140
Scripts/Editor/Resources/xnode_node_ports.png.meta
Normal file
@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25f1d4e3447fcff448f42aa9f8a30fb0
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
BIN
Scripts/Editor/Resources/xnode_node_workfile_long.psd
Normal file
BIN
Scripts/Editor/Resources/xnode_node_workfile_long.psd
Normal file
Binary file not shown.
140
Scripts/Editor/Resources/xnode_node_workfile_long.psd.meta
Normal file
140
Scripts/Editor/Resources/xnode_node_workfile_long.psd.meta
Normal file
@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5cc599cf52979248a326e2799d2f59e
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -557,7 +557,7 @@ namespace XNode
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Specify a color for this node type </summary>
|
||||
/// <summary> Specify a color tint for this node type </summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class NodeTintAttribute : Attribute
|
||||
{
|
||||
@ -589,6 +589,76 @@ namespace XNode
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Specify a header color for this node type </summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class NodeColorHeaderAttribute : Attribute
|
||||
{
|
||||
public Color color;
|
||||
|
||||
/// <summary> Specify a color for this node type </summary>
|
||||
/// <param name="r"> Red [0.0f .. 1.0f] </param>
|
||||
/// <param name="g"> Green [0.0f .. 1.0f] </param>
|
||||
/// <param name="b"> Blue [0.0f .. 1.0f] </param>
|
||||
/// <param name="a"> Alpha [0.0f .. 1.0f] </param>
|
||||
public NodeColorHeaderAttribute(float r, float g, float b, float a = 1.0f)
|
||||
{
|
||||
color = new Color(r, g, b, a);
|
||||
}
|
||||
|
||||
/// <summary> Specify a color for this node type </summary>
|
||||
/// <param name="hex"> HEX color value </param>
|
||||
public NodeColorHeaderAttribute(string hex)
|
||||
{
|
||||
ColorUtility.TryParseHtmlString(hex, out color);
|
||||
}
|
||||
|
||||
/// <summary> Specify a color for this node type </summary>
|
||||
/// <param name="r"> Red [0 .. 255] </param>
|
||||
/// <param name="g"> Green [0 .. 255] </param>
|
||||
/// <param name="b"> Blue [0 .. 255] </param>
|
||||
/// <param name="a"> Alpha [0 .. 255] </param>
|
||||
public NodeColorHeaderAttribute(byte r, byte g, byte b, byte a = byte.MaxValue)
|
||||
{
|
||||
color = new Color32(r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Specify a body color for this node type </summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class NodeColorBodyAttribute : Attribute
|
||||
{
|
||||
public Color color;
|
||||
|
||||
/// <summary> Specify a color for this node type </summary>
|
||||
/// <param name="r"> Red [0.0f .. 1.0f] </param>
|
||||
/// <param name="g"> Green [0.0f .. 1.0f] </param>
|
||||
/// <param name="b"> Blue [0.0f .. 1.0f] </param>
|
||||
/// <param name="a"> Alpha [0.0f .. 1.0f] </param>
|
||||
public NodeColorBodyAttribute(float r, float g, float b, float a = 1.0f)
|
||||
{
|
||||
color = new Color(r, g, b, a);
|
||||
}
|
||||
|
||||
/// <summary> Specify a color for this node type </summary>
|
||||
/// <param name="hex"> HEX color value </param>
|
||||
public NodeColorBodyAttribute(string hex)
|
||||
{
|
||||
ColorUtility.TryParseHtmlString(hex, out color);
|
||||
}
|
||||
|
||||
/// <summary> Specify a color for this node type </summary>
|
||||
/// <param name="r"> Red [0 .. 255] </param>
|
||||
/// <param name="g"> Green [0 .. 255] </param>
|
||||
/// <param name="b"> Blue [0 .. 255] </param>
|
||||
/// <param name="a"> Alpha [0 .. 255] </param>
|
||||
public NodeColorBodyAttribute(byte r, byte g, byte b, byte a = byte.MaxValue)
|
||||
{
|
||||
color = new Color32(r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Specify a width for this node type </summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class NodeWidthAttribute : Attribute
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XNode
|
||||
{
|
||||
[NodeColorHeader(0.2f, 0.2f, 0.2f, 0.5f)]
|
||||
[NodeColorBody(0.25f, 0.25f, 0.25f, 0.35f)]
|
||||
[CreateNodeMenu("Group")]
|
||||
public class NodeGroup : Node
|
||||
{
|
||||
public int width = 400;
|
||||
public int height = 400;
|
||||
public Color color = new Color(1f, 1f, 1f, 0.1f);
|
||||
|
||||
public override object GetValue(NodePort port)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user