public void WeldBranch(SPData SPData, Node node, int n) { var branch = SPData.DictBranches[SPData.Selections._BranchKey]; Undo.RecordObject(SPData.SplinePlus, "branch welded"); if (n == 0) { branch.Nodes.Insert(0, node); } else { branch.Nodes.Add(node); } if (SPData.NodeType == NodeType.Free) { node._Type = NodeType.Free; } else { node._Type = NodeType.Smooth; } BranchesClass.BreakBranch(SPData, node); BranchesClass.AddRefreshSharedNode(SPData, node); BranchesClass.BranchWeldSt(SPData); EditorUtility.SetDirty(SPData.SplinePlus); SPData.SplinePlus.SplineCreationClass.UpdateBranch(SPData, branch); }
void BranchEdit(SPData SPData) { if (!SPData.IsLooped && SPData.ObjectType != SPType.Extrude) { AddBranch(SPData); } if (SPData.DictBranches.Count == 0) { return; } if (GUI.Button(new Rect(272, 30, 30, 30), new GUIContent(SplinePlusEditor.Delete.image, "Delete the selected node "), GUIStyle.none) && EditorUtility.DisplayDialog("Branch deletion?", "Are you sure you want to delete this branch? " , "Yes", "No")) { BranchesClass.DeleteBranch(SPData, SPData.Selections._BranchKey); SceneView.RepaintAll(); } if (GUI.Button(new Rect(304, 30, 30, 30), new GUIContent(SplinePlusEditor.FlipHandles.image, "Flips the handles of the selected node "), GUIStyle.none)) { Undo.RecordObject(SPData.SplinePlus, "handles Fliped"); BranchesClass.FlipHandles(SPData, SPData.Selections._BranchKey, SPData.Selections._LocalNodeIndex); EditorUtility.SetDirty(SPData.SplinePlus); } var rec = new Rect(336, 30, 30, 30); if (SPData.ObjectType != SPType.Extrude && !SPData.IsLooped) { rec = new Rect(368, 30, 30, 30); if (GUI.Button(new Rect(336, 30, 30, 30), new GUIContent(SplinePlusEditor.BreakAt.image, "Break the selected branch at the selected node"), GUIStyle.none)) { if (!SPData.Selections._PathPoint.Equals(null)) { Undo.RecordObject(SPData.SplinePlus, "Break at branch"); var node = SPData.Selections._PathPoint; BranchesClass.BreakBranch(SPData, node); EditorUtility.SetDirty(SPData.SplinePlus); } else { EditorUtility.DisplayDialog("Error", "You need to have a node selected where you want your branch to be broken at " , "Ok"); } } } else { rec = new Rect(336, 30, 30, 30); } if (GUI.Button(rec, new GUIContent(SplinePlusEditor.Reverse.image, "Reverse the direction of the selected branch "), GUIStyle.none)) { Undo.RecordObject(SPData.SplinePlus, "branch Reversed"); BranchesClass.ReverseBranch(SPData, SPData.Selections._BranchKey); EditorUtility.SetDirty(SPData.SplinePlus); } }