//Renders the blueprint editor panel and updates EditorGUILayout and GUILayout components inside the blueprint editor panel public static void Render() { //Render the grid tile texture GUI.DrawTextureWithTexCoords(new Rect(0.0f, 0.0f, Screen.width, Screen.height), BlueprintStyleHelper.GetPanelBackgroundTexture(), new Rect(_pan.x, _pan.y, Screen.width * 0.05f, Screen.height * 0.05f)); //Render the blueprint BlueprintEditor.GetBlueprint().Render(); }
//Handles mouse drag events for the blueprint editor panel private static void HandleMouseDragEvents() { //If the mouse drag event is being triggered by the middle mouse button if (Event.current.button == 2) { //Update pan _pan += new Vector2(-Event.current.delta.x, Event.current.delta.y) * _panSensitivity * Time.deltaTime; //Translate all blueprint nodes in the blueprint by the mouse delta BlueprintEditor.GetBlueprint().Translate(Event.current.delta * 0.667f); } //Process event Event.current.Use(); }
//Renders the blueprint editor header and updates EditorGUILayout and GUILayout components inside the blueprint editor header public static void Render() { //Render the active blueprints name GUILayout.Label(BlueprintEditor.GetBlueprint().GetName(), BlueprintStyleHelper.GetBlueprintHeaderTextStyle(), GUILayout.Width(Screen.width), GUILayout.Height(25.0f)); //Begin area for drawing the blueprint editor header toolbar GUILayout.BeginArea(new Rect(Screen.width * 0.5f - 100.0f, 25.0f, Screen.width * 0.5f + 100.0f, 30.0f)); //If the developer presses the save blueprint button if (GUILayout.Button("Save Blueprint", GUILayout.Width(200.0f), GUILayout.Height(30.0f))) { //Save the blueprint BlueprintEditor.SaveBlueprint(); } //End area for drawing the blueprint editor header toolbar GUILayout.EndArea(); }
//Adds a blueprint node blueprint instance to the blueprint private static void AddBlueprintNodeBlueprint(object userData) { //Add a blueprint node blueprint instance to the blueprint BlueprintEditor.GetBlueprint().AddCustomBlueprintNode((string)userData, _pan); }
//Adds a blueprint node variable component of the specified component type to the blueprint private static void AddBlueprintNodeVariableComponent <T1, T2, T3>(object userData) where T1 : Component where T2 : BlueprintConnectionAttribute, new() where T3 : BlueprintConnectionAttribute, new() { //Add a blueprint node variable component of the specified component type to the blueprint BlueprintEditor.GetBlueprint().AddBlueprintNodeVariableComponent <T1, T2, T3>((string)userData, _pan); }
//Adds a blueprint node connection one to many of the specified type to the blueprint private static void AddBlueprintNodeConnectionOneToMany <T1, T2>(object userData) where T1 : BlueprintConnectionAttribute, new() where T2 : BlueprintConnectionAttribute, new() { //Add a blueprint node connection one to many of the specified type to the blueprint BlueprintEditor.GetBlueprint().AddBlueprintNodeConnectionOneToMany <T1, T2>((string)userData, _pan); }
//Adds a blueprint node of the specified type to the blueprint private static void AddBlueprintNode <T>() where T : BlueprintNode, new() { //Add a blueprint node of the specified type to the blueprint BlueprintEditor.GetBlueprint().AddBlueprintNode(new T(), _pan); }