示例#1
0
        public void AddPoint(RenderablePathPoint point)
        {
            DefaultScale = point.Scale;
            PathPoints.Add(point);

            PointAdded?.Invoke(point, EventArgs.Empty);
        }
示例#2
0
        public virtual RenderablePathPoint CreatePoint(Vector3 position)
        {
            var point = new RenderablePathPoint(this, position);

            point.Scale = DefaultScale;
            return(point);
        }
示例#3
0
        public void RemovePoint(RenderablePathPoint removePoint, bool isCollection = false)
        {
            RemovePointReferences(removePoint);
            PathPoints.Remove(removePoint);

            if (!isCollection)
            {
                PointRemoved?.Invoke(removePoint, EventArgs.Empty);
            }
        }
示例#4
0
 public PointInfo(RenderablePathPoint point)
 {
     ParentPath = point.ParentPath;
     Point      = point;
     foreach (var child in point.Children)
     {
         Children.Add(child);
     }
     foreach (var parent in point.Parents)
     {
         Parents.Add(parent);
     }
 }
示例#5
0
        /// <summary>
        /// Determines if the given point can be connected based on the properties of the path object.
        /// The point must be connected to a point that is less that the parent limit.
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        public bool PointCanConnect(RenderablePathPoint point)
        {
            return(true);

            foreach (var parent in point.Parents)
            {
                if (parent.Parents.Count >= LimitParentCount)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#6
0
        private void RemovePointReferences(RenderablePathPoint removePoint)
        {
            bool isDivision = removePoint.Parents.Count == 1 && removePoint.Children.Count == 1;

            if (isDivision)
            {
                var parent = removePoint.Parents[0];
                var child  = removePoint.Children[0];

                foreach (var point in PathPoints)
                {
                    if (point.Parents.Contains(removePoint))
                    {
                        point.Parents.Remove(removePoint);
                    }
                    if (point.Children.Contains(removePoint))
                    {
                        point.Children.Remove(removePoint);
                    }
                }

                parent.AddChild(child);
            }
            else
            {
                foreach (var point in PathPoints)
                {
                    if (point.Parents.Contains(removePoint))
                    {
                        point.Parents.Remove(removePoint);
                    }
                    if (point.Children.Contains(removePoint))
                    {
                        point.Children.Remove(removePoint);
                    }
                }
            }

            removePoint.Children.Clear();
            removePoint.Parents.Clear();
        }
示例#7
0
        public GenericSkeletonRenderer(STSkeleton skeleton)
            : base(Color.Yellow, Color.Yellow, Color.Yellow)
        {
            Skeleton = skeleton;
            var points = new RenderablePathPoint[skeleton.Bones.Count];

            for (int i = 0; i < skeleton.Bones.Count; i++)
            {
                STBone bone = skeleton.Bones[i];
                points[i] = FromBone(bone);
            }
            for (int i = 0; i < skeleton.Bones.Count; i++)
            {
                if (skeleton.Bones[i].ParentIndex != -1)
                {
                    points[skeleton.Bones[i].ParentIndex].AddChild(points[i]);
                }
            }

            PathPoints = points.ToList();
        }
        public void ConnectToPoint(RenderablePathPoint point)
        {
            Console.WriteLine($"ConnectToPoint {ParentPath.PathPoints.IndexOf(point)}");

            List <RenderablePathPoint> parents = new List <RenderablePathPoint>();

            foreach (var pt in Parents)
            {
                parents.Add(pt);
            }

            foreach (var parent in parents)
            {
                parent.AddChild(point);
            }

            foreach (var parent in parents)
            {
                parent.Children.Remove(this);
            }

            ParentPath.RemovePoint(this);
        }
示例#9
0
 public RevertableAddPointCollection(RenderablePathPoint point)
 {
     Points.Add(new PointInfo(point));
 }
示例#10
0
 public virtual void BeforePointDeleted(RenderablePathPoint point)
 {
 }
 public void AddChild(RenderablePathPoint point)
 {
     point.Parents.Add(this);
     Children.Add(point);
 }
 public void RemoveChild(RenderablePathPoint point)
 {
     point.Parents.Remove(this);
     Children.Remove(point);
 }
 //Note only copy the transform properties and any other thing linked to the path
 //Do not copy children or parent data
 public virtual void CopyPropertiesToPoint(RenderablePathPoint point)
 {
     point.GlobalPosition = this.GlobalPosition;
     point.GlobalRotation = this.GlobalRotation;
     point.GlobalScale    = this.GlobalScale;
 }