using System; using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; using XNode; namespace XNodeEditor { public interface INodeGraphEditor { NodeEditorWindow window { get; set; } Editor editor { get; } void OnGUI(); void OnOpen(); Texture2D GetGridTexture(); Texture2D GetSecondaryGridTexture(); /// Return default settings for this graph type. This is the settings the user will load if no previous settings have been saved. NodeEditorPreferences.Settings GetDefaultPreferences(); /// Returns context node menu path. Null or empty strings for hidden nodes. string GetNodeMenuName(Type type); /// Add items for the context menu when right-clicking this node. Override to add custom menu items. void AddContextMenuItems(GenericMenu menu); Color GetPortColor(XNode.NodePort port); Color GetTypeColor(Type type); /// Create a node and save it in the graph asset XNode.INode CreateNode(Type type, Vector2 position); /// Creates a copy of the original node in the graph XNode.INode CopyNode(XNode.INode original); /// Safely remove a node and all its connections. void RemoveNode(XNode.INode node); } [AttributeUsage(AttributeTargets.Class)] public class CustomNodeGraphEditorAttribute : Attribute, XNodeEditor.Internal.INodeEditorAttrib { private Type inspectedType; public string editorPrefsKey; /// Tells a NodeGraphEditor which Graph type it is an editor for /// Type that this editor can edit /// Define unique key for unique layout settings instance public CustomNodeGraphEditorAttribute(Type inspectedType, string editorPrefsKey = "xNode.Settings") { this.inspectedType = inspectedType; this.editorPrefsKey = editorPrefsKey; } public Type GetInspectedType() { return inspectedType; } } }