示例#1
0
    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);
    }
示例#2
0
 public static void IsSharedPathPoint(SPData SPData, Node node, int currentBranchIndex)
 {
     foreach (var branch in SPData.DictBranches)
     {
         if (branch.Key == currentBranchIndex)
         {
             continue;
         }
         if (branch.Value.Nodes.Exists(x => x.Equals(node)))
         {
             BranchesClass.AddRefreshSharedNode(SPData, node);
         }
     }
 }
示例#3
0
    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);
    }