diff --git a/Scripts/Editor/NodeEditor.cs b/Scripts/Editor/NodeEditor.cs index 6c73af4..ba5a7f2 100644 --- a/Scripts/Editor/NodeEditor.cs +++ b/Scripts/Editor/NodeEditor.cs @@ -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)); } /// Draws standard field editors for all public fields @@ -119,6 +119,11 @@ namespace XNodeEditor #endif } + /// + /// Called after rendering. Used for additional controls specific to a node. + /// + public virtual void OnControlsGUI() {} + public virtual int GetWidth() { Type type = target.GetType(); @@ -131,7 +136,7 @@ namespace XNodeEditor return 208; } - /// Returns color for target node + /// Returns tint for target node public virtual Color GetTint() { // Try get color from [NodeTint] attribute @@ -146,9 +151,34 @@ namespace XNodeEditor return NodeEditorPreferences.GetSettings().tintColor; } - public virtual GUIStyle GetBodyStyle() + /// Returns header color for target node + 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; + } + + /// Returns body color for target node + 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; diff --git a/Scripts/Editor/NodeEditorAction.cs b/Scripts/Editor/NodeEditorAction.cs index 4b9ed62..1ee113f 100644 --- a/Scripts/Editor/NodeEditorAction.cs +++ b/Scripts/Editor/NodeEditorAction.cs @@ -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; - isPanning = true; - } + // 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 diff --git a/Scripts/Editor/NodeEditorGUI.cs b/Scripts/Editor/NodeEditorGUI.cs index c19d276..0e91de1 100755 --- a/Scripts/Editor/NodeEditorGUI.cs +++ b/Scripts/Editor/NodeEditorGUI.cs @@ -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) diff --git a/Scripts/Editor/NodeEditorPreferences.cs b/Scripts/Editor/NodeEditorPreferences.cs index 535b861..3090676 100644 --- a/Scripts/Editor/NodeEditorPreferences.cs +++ b/Scripts/Editor/NodeEditorPreferences.cs @@ -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(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(); + } + /// Load prefs if they exist. Create if they don't private static Settings LoadPrefs() { diff --git a/Scripts/Editor/NodeEditorReflection.cs b/Scripts/Editor/NodeEditorReflection.cs index 74825ed..1fe34f3 100644 --- a/Scripts/Editor/NodeEditorReflection.cs +++ b/Scripts/Editor/NodeEditorReflection.cs @@ -16,6 +16,8 @@ namespace XNodeEditor public static class NodeEditorReflection { [NonSerialized] private static Dictionary nodeTint; + [NonSerialized] private static Dictionary nodeHeaderColor; + [NonSerialized] private static Dictionary nodeBodyColor; [NonSerialized] private static Dictionary nodeWidth; /// All available node types public static Type[] nodeTypes => _nodeTypes != null ? _nodeTypes : _nodeTypes = GetNodeTypes(); @@ -37,7 +39,7 @@ namespace XNodeEditor return GetDerivedTypes(typeof(Node)); } - /// Custom node tint colors defined with [NodeColor(r, g, b)] + /// Custom node tint colors defined with [NodeTint(r, g, b)] 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); } + /// Custom node header colors defined with [NodeColorHeader(r, g, b)] + public static bool TryGetAttributeHeader(this Type nodeType, out Color headerColor) + { + if (nodeHeaderColor == null) + { + CacheAttributes(ref nodeHeaderColor, x => x.color); + } + + return nodeHeaderColor.TryGetValue(nodeType, out headerColor); + } + + + /// Custom node body colors defined with [NodeColorBody(r, g, b)] + public static bool TryGetAttributeBody(this Type nodeType, out Color bodyColor) + { + if (nodeBodyColor == null) + { + CacheAttributes(ref nodeBodyColor, x => x.color); + } + + return nodeBodyColor.TryGetValue(nodeType, out bodyColor); + } + /// Get custom node widths defined with [NodeWidth(width)] public static bool TryGetAttributeWidth(this Type nodeType, out int width) { diff --git a/Scripts/Editor/NodeEditorResources.cs b/Scripts/Editor/NodeEditorResources.cs index cc963e8..7c7be4e 100644 --- a/Scripts/Editor/NodeEditorResources.cs +++ b/Scripts/Editor/NodeEditorResources.cs @@ -11,9 +11,17 @@ namespace XNodeEditor public static Texture2D dotOuter => _dotOuter != null ? _dotOuter : _dotOuter = Resources.Load("xnode_dot_outer"); private static Texture2D _dotOuter; + + public static Texture2D nodeHeader => + _nodeHeader != null ? _nodeHeader : _nodeHeader = Resources.Load("xnode_node_header"); + private static Texture2D _nodeHeader; + public static Texture2D nodePorts => + _nodePorts != null ? _nodePorts : _nodePorts = Resources.Load("xnode_node_ports"); + private static Texture2D _nodePorts; public static Texture2D nodeBody => - _nodeBody != null ? _nodeBody : _nodeBody = Resources.Load("xnode_node"); + _nodeBody != null ? _nodeBody : _nodeBody = Resources.Load("xnode_node_body"); private static Texture2D _nodeBody; + public static Texture2D nodeHighlight => _nodeHighlight != null ? _nodeHighlight : _nodeHighlight = Resources.Load("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; diff --git a/Scripts/Editor/NodeEditorWindow.cs b/Scripts/Editor/NodeEditorWindow.cs index 2cec68d..d6075d8 100644 --- a/Scripts/Editor/NodeEditorWindow.cs +++ b/Scripts/Editor/NodeEditorWindow.cs @@ -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 nodeSizes { get; } = new Dictionary(); @@ -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); } diff --git a/Scripts/Editor/NodeGroupEditor.cs b/Scripts/Editor/NodeGroupEditor.cs index f5a00c6..f23a1bf 100644 --- a/Scripts/Editor/NodeGroupEditor.cs +++ b/Scripts/Editor/NodeGroupEditor.cs @@ -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("xnode_corner"); private static Texture2D _corner; - private bool _isDragging; + private bool _isResizing; private Vector2 _size; private float _currentHeight; private Vector2 _draggingOffset; + private List _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(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; } diff --git a/Scripts/Editor/RenameTextField.cs b/Scripts/Editor/RenameTextField.cs index 46ee6a3..95138f3 100644 --- a/Scripts/Editor/RenameTextField.cs +++ b/Scripts/Editor/RenameTextField.cs @@ -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); diff --git a/Scripts/Editor/Resources/xnode_node.png b/Scripts/Editor/Resources/xnode_node.png index 6f0b42e..78115aa 100644 Binary files a/Scripts/Editor/Resources/xnode_node.png and b/Scripts/Editor/Resources/xnode_node.png differ diff --git a/Scripts/Editor/Resources/xnode_node.png.meta b/Scripts/Editor/Resources/xnode_node.png.meta index 979e6f9..0fbcf7c 100644 --- a/Scripts/Editor/Resources/xnode_node.png.meta +++ b/Scripts/Editor/Resources/xnode_node.png.meta @@ -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: diff --git a/Scripts/Editor/Resources/xnode_node_body.png b/Scripts/Editor/Resources/xnode_node_body.png new file mode 100644 index 0000000..9e7ace6 Binary files /dev/null and b/Scripts/Editor/Resources/xnode_node_body.png differ diff --git a/Scripts/Editor/Resources/xnode_node_body.png.meta b/Scripts/Editor/Resources/xnode_node_body.png.meta new file mode 100644 index 0000000..65897bb --- /dev/null +++ b/Scripts/Editor/Resources/xnode_node_body.png.meta @@ -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: diff --git a/Scripts/Editor/Resources/xnode_node_header.png b/Scripts/Editor/Resources/xnode_node_header.png new file mode 100644 index 0000000..b805af9 Binary files /dev/null and b/Scripts/Editor/Resources/xnode_node_header.png differ diff --git a/Scripts/Editor/Resources/xnode_node_header.png.meta b/Scripts/Editor/Resources/xnode_node_header.png.meta new file mode 100644 index 0000000..4066d7f --- /dev/null +++ b/Scripts/Editor/Resources/xnode_node_header.png.meta @@ -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: diff --git a/Scripts/Editor/Resources/xnode_node_highlight.png.meta b/Scripts/Editor/Resources/xnode_node_highlight.png.meta index 21b6034..755845e 100644 --- a/Scripts/Editor/Resources/xnode_node_highlight.png.meta +++ b/Scripts/Editor/Resources/xnode_node_highlight.png.meta @@ -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: diff --git a/Scripts/Editor/Resources/xnode_node_ports.png b/Scripts/Editor/Resources/xnode_node_ports.png new file mode 100644 index 0000000..51360a1 Binary files /dev/null and b/Scripts/Editor/Resources/xnode_node_ports.png differ diff --git a/Scripts/Editor/Resources/xnode_node_ports.png.meta b/Scripts/Editor/Resources/xnode_node_ports.png.meta new file mode 100644 index 0000000..eea4f9a --- /dev/null +++ b/Scripts/Editor/Resources/xnode_node_ports.png.meta @@ -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: diff --git a/Scripts/Editor/Resources/xnode_node_workfile.psd b/Scripts/Editor/Resources/xnode_node_workfile.psd index a578c46..eb65569 100644 Binary files a/Scripts/Editor/Resources/xnode_node_workfile.psd and b/Scripts/Editor/Resources/xnode_node_workfile.psd differ diff --git a/Scripts/Editor/Resources/xnode_node_workfile_long.psd b/Scripts/Editor/Resources/xnode_node_workfile_long.psd new file mode 100644 index 0000000..96b942f Binary files /dev/null and b/Scripts/Editor/Resources/xnode_node_workfile_long.psd differ diff --git a/Scripts/Editor/Resources/xnode_node_workfile_long.psd.meta b/Scripts/Editor/Resources/xnode_node_workfile_long.psd.meta new file mode 100644 index 0000000..bc8a59e --- /dev/null +++ b/Scripts/Editor/Resources/xnode_node_workfile_long.psd.meta @@ -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: diff --git a/Scripts/Node.cs b/Scripts/Node.cs index be8dd39..077414b 100644 --- a/Scripts/Node.cs +++ b/Scripts/Node.cs @@ -557,7 +557,7 @@ namespace XNode } } - /// Specify a color for this node type + /// Specify a color tint for this node type [AttributeUsage(AttributeTargets.Class)] public class NodeTintAttribute : Attribute { @@ -589,6 +589,76 @@ namespace XNode } } + + /// Specify a header color for this node type + [AttributeUsage(AttributeTargets.Class)] + public class NodeColorHeaderAttribute : Attribute + { + public Color color; + + /// Specify a color for this node type + /// Red [0.0f .. 1.0f] + /// Green [0.0f .. 1.0f] + /// Blue [0.0f .. 1.0f] + /// Alpha [0.0f .. 1.0f] + public NodeColorHeaderAttribute(float r, float g, float b, float a = 1.0f) + { + color = new Color(r, g, b, a); + } + + /// Specify a color for this node type + /// HEX color value + public NodeColorHeaderAttribute(string hex) + { + ColorUtility.TryParseHtmlString(hex, out color); + } + + /// Specify a color for this node type + /// Red [0 .. 255] + /// Green [0 .. 255] + /// Blue [0 .. 255] + /// Alpha [0 .. 255] + public NodeColorHeaderAttribute(byte r, byte g, byte b, byte a = byte.MaxValue) + { + color = new Color32(r, g, b, a); + } + } + + + /// Specify a body color for this node type + [AttributeUsage(AttributeTargets.Class)] + public class NodeColorBodyAttribute : Attribute + { + public Color color; + + /// Specify a color for this node type + /// Red [0.0f .. 1.0f] + /// Green [0.0f .. 1.0f] + /// Blue [0.0f .. 1.0f] + /// Alpha [0.0f .. 1.0f] + public NodeColorBodyAttribute(float r, float g, float b, float a = 1.0f) + { + color = new Color(r, g, b, a); + } + + /// Specify a color for this node type + /// HEX color value + public NodeColorBodyAttribute(string hex) + { + ColorUtility.TryParseHtmlString(hex, out color); + } + + /// Specify a color for this node type + /// Red [0 .. 255] + /// Green [0 .. 255] + /// Blue [0 .. 255] + /// Alpha [0 .. 255] + public NodeColorBodyAttribute(byte r, byte g, byte b, byte a = byte.MaxValue) + { + color = new Color32(r, g, b, a); + } + } + /// Specify a width for this node type [AttributeUsage(AttributeTargets.Class)] public class NodeWidthAttribute : Attribute diff --git a/Scripts/NodeGroup.cs b/Scripts/NodeGroup.cs index a227b10..85d68bd 100644 --- a/Scripts/NodeGroup.cs +++ b/Scripts/NodeGroup.cs @@ -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) {