/// <summary> /// Setup of the base framework. Enough to manage and calculate canvases. /// </summary> private static void setupBaseFramework() { CheckEditorPath(); // Init Resource system. Can be called anywhere else, too, if it's needed before. ResourceManager.SetDefaultResourcePath(editorPath + "Resources/"); // Run fetching algorithms searching the script assemblies for Custom Nodes / Connection Types / NodeCanvas Types ConnectionTypes.FetchTypes(); NodeTypes.FetchNodes(); NodeCanvasManager.GetAllCanvasTypes(); // Setup Callback system NodeEditorCallbacks.SetupReceivers(); NodeEditorCallbacks.IssueOnEditorStartUp(); // Init input NodeEditorInputSystem.SetupInput(); #if UNITY_EDITOR UnityEditor.EditorApplication.update -= Update; UnityEditor.EditorApplication.update += Update; #endif initiatedBase = true; }
public static void checkInit() { if (!initiated && !InitiationError) { #if UNITY_EDITOR Object script = UnityEditor.AssetDatabase.LoadAssetAtPath(editorPath + "Framework/NodeEditor.cs", typeof(Object)); if (script == null) { Debug.LogError("Node Editor: Not installed in default directory '" + editorPath + "'! Please modify the editorPath variable in the source!"); InitiationError = true; return; } #endif ResourceManager.Init(editorPath + "Resources/"); if (!NodeEditorGUI.Init()) { InitiationError = true; } ConnectionTypes.FetchTypes(); NodeTypes.FetchNodes(); NodeEditorCallbacks.SetupReceivers(); NodeEditorCallbacks.IssueOnEditorStartUp(); GUIScaleUtility.Init(); initiated = true; } }
public static void ReInit(bool GUIFunction) { CheckEditorPath(); // Init Resource system. Can be called anywhere else, too, if it's needed before. ResourceManager.Init(editorPath + "Resources/"); // Init NE GUI. I may throw an error if a texture was not found. if (!NodeEditorGUI.Init(GUIFunction)) { InitiationError = true; return; } // Run fetching algorithms searching the script assemblies for Custom Nodes / Connection Types ConnectionTypes.FetchTypes(); NodeTypes.FetchNodes(); // Setup Callback system NodeEditorCallbacks.SetupReceivers(); NodeEditorCallbacks.IssueOnEditorStartUp(); // Init GUIScaleUtility. This fetches reflected calls and my throw a message notifying about incompability. GUIScaleUtility.Init(); #if UNITY_EDITOR RepaintClients(); #endif initiated = true; }
public static void checkInit() { if (!initiated && !InitiationError) { #if UNITY_EDITOR Object script = UnityEditor.AssetDatabase.LoadAssetAtPath(editorPath + "Framework/NodeEditor.cs", typeof(Object)); if (script == null) { Debug.LogError("Node Editor: Not installed in default directory '" + editorPath + "'! Please modify the editorPath variable in the source!"); InitiationError = true; return; } #endif Background = LoadTexture("Textures/background.png"); AALineTex = LoadTexture("Textures/AALine.png"); if (!Background || !AALineTex) { InitiationError = true; return; } ConnectionTypes.FetchTypes(); NodeTypes.FetchNodes(); NodeEditorCallbacks.SetupReceivers(); NodeEditorCallbacks.IssueOnEditorStartUp(); // Styles nodeBox = new GUIStyle(GUI.skin.box); #if UNITY_EDITOR nodeBox.normal.background = ColorToTex(UnityEditor.EditorGUIUtility.isProSkin? new Color(0.5f, 0.5f, 0.5f) : new Color(0.2f, 0.2f, 0.2f)); #else nodeBox.normal.background = ColorToTex(new Color(0.2f, 0.2f, 0.2f)); #endif nodeBox.normal.textColor = new Color(0.7f, 0.7f, 0.7f); nodeButton = new GUIStyle(GUI.skin.button); nodeLabel = new GUIStyle(GUI.skin.label); nodeLabel.normal.textColor = new Color(0.7f, 0.7f, 0.7f); nodeLabelBold = new GUIStyle(nodeLabel); nodeLabelBold.fontStyle = FontStyle.Bold; nodeLabelBold.wordWrap = false; initiated = true; } return; }
private void CheckType() { if (_typeData == null || !_typeData.isValid()) { _typeData = ConnectionTypes.GetTypeData(typeID); } if (_typeData == null || !_typeData.isValid()) { ConnectionTypes.FetchTypes(); _typeData = ConnectionTypes.GetTypeData(typeID); if (_typeData == null || !_typeData.isValid()) { throw new UnityException("Could not find type " + typeID + "!"); } } }
public static void ReInit(bool GUIFunction) { CheckEditorPath(); ResourceManager.SetDefaultResourcePath(editorPath + "Resources/"); if (!NodeEditorGUI.Init(GUIFunction)) { InitiationError = true; } else { ConnectionTypes.FetchTypes(); NodeTypes.FetchNodes(); NodeCanvasManager.GetAllCanvasTypes(); NodeEditorCallbacks.SetupReceivers(); NodeEditorCallbacks.IssueOnEditorStartUp(); GUIScaleUtility.CheckInit(); NodeEditorInputSystem.SetupInput(); initiated = GUIFunction; } }