Beispiel #1
0
        private void CloseNodesAndEdges()
        {
            CacheMovableData();
            if (Edges != null)
            {
                for (var i = 0; i < Edges.Length; i++)
                {
                    if (Edges[i] != null)
                    {
                        Edges[i].CurveUpdated -= OnCurveUpdated;
                        EdgeRemoved?.Invoke(this, Edges[i]);
                        Edges[i].Close();
                    }

                    Edges[i] = null;
                }
            }

            // ReSharper disable once InvertIf
            if (Nodes != null)
            {
                for (var i = 0; i < Nodes.Length; i++)
                {
                    if (Nodes[i] != null)
                    {
                        NodeRemoved?.Invoke(this, Nodes[i]);
                        if (!Definition.Nodes[i].Movable)
                        {
                            Nodes[i].UnpinTangent();
                        }
                    }

                    Nodes[i] = null;
                }
            }

            EdgeSetupChanged?.Invoke(this);
        }
 private void OnCurveUpdated(Edge e)
 {
     if (Edges == null)
     {
         return;
     }
     EdgeSetupChanged?.Invoke(this);
     for (var i = 0; i < Edges.Length; i++)
     {
         if (Edges[i] == e)
         {
             var def = Definition.Edges[i];
             if (def.Bones != null && def.Bones.Count > 0)
             {
                 foreach (var b in def.Bones)
                 {
                     MarkBoneDirty(b);
                 }
             }
             break;
         }
     }
 }