using System; using System.Collections.Generic; using System.Linq; using UnityEditor; using UnityEngine; using XNode; namespace XNodeEditor { /// Base class to derive custom Node Graph editors from. Use this to override how graphs are drawn in the editor. [CustomNodeGraphEditor(typeof(NodeGraph))] public class NodeGraphEditor : XNodeInternal.NodeEditorBase { /// Custom node editors defined with [CustomNodeGraphEditor] [NonSerialized] private static Dictionary editors; public NodeGraph target; public SerializedObject serializedObject; public virtual Texture2D GetGridTexture() { return NodeEditorPreferences.gridTexture; } [AttributeUsage(AttributeTargets.Class)] public class CustomNodeGraphEditorAttribute : Attribute, INodeEditorAttrib { private Type inspectedType; /// Tells a NodeEditor which Node type it is an editor for /// Type that this editor can edit /// Path to the node public CustomNodeGraphEditorAttribute(Type inspectedType) { this.inspectedType = inspectedType; } public Type GetInspectedType() { return inspectedType; } } } }