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); } }
public void ResetSmoothSharedPathPoint(SPData SPData) { SPData.SmoothData.SmoothNode = false; for (int i = 0; i < SPData.SmoothData.Nodes.Length; i++) { var branchKey = SPData.SmoothData.BranchesIndices[i]; var localIndex = SPData.SmoothData.Nodes[i].LocalIndex(SPData, branchKey); SPData.DictBranches[branchKey].Nodes[localIndex] = SPData.SharedNodes[SPData.Selections._SharedPathPointIndex].Node;//restore old center path point } BranchesClass.AddRefreshSharedNode(SPData, SPData.SharedNodes[SPData.Selections._SharedPathPointIndex].Node); //delete created branches for (int i = 0; i < SPData.SmoothData.newBranchesIndices.Count; i++) { BranchesClass.DeleteBranch(SPData, SPData.SmoothData.newBranchesIndices[i]); } SPData.SplinePlus.SplineCreationClass.UpdateAllBranches(SPData); }