protected virtual void OnEnable() { Instance = this; wantsMouseMove = true; this.SetAntiAliasing(4); if (GraphData == null && (GraphData = EditorUtility.InstanceIDToObject(instanceID) as GraphData) == null) { return; } OpenGraph(GraphData); }
public static Type GetNodeType(Type nodeType, Type fallback) { if (_nodeTypeCache == null) { _nodeTypeCache = new Dictionary <Type, Type>(); Type[] nodeTypes = BaseGraphEditorWindow.GetDerivedTypes(typeof(BaseNode)); foreach (Type tempType in nodeTypes) { var attribs = tempType.GetCustomAttributes(typeof(CustomNodeAttribute), false); if (attribs == null || attribs.Length == 0) { continue; } CustomNodeAttribute attrib = attribs[0] as CustomNodeAttribute; _nodeTypeCache.Add(attrib.TargetType, tempType); } } if (_nodeTypeCache.TryGetValue(nodeType, out Type type)) { return(type); } return(fallback); }
public void SetWindow(BaseGraphEditorWindow targetWindow) { this.TargetWindow = targetWindow; }