/// <summary> /// Returns a clone of the node hierarchy. /// </summary> public virtual Node Clone() { var clone = (Node)MemberwiseClone(); ++CreatedCount; clone.Parent = null; clone.FirstAnimation = null; clone.FirstChild = null; clone.NextSibling = null; clone.gestures = null; clone.AsWidget = clone as Widget; clone.Animations = Animations.Clone(clone); clone.Animators = AnimatorCollection.SharedClone(clone, Animators); clone.Nodes = Nodes.Clone(clone); clone.Components = Components.Clone(clone); clone.IsAwake = false; if (RenderChainBuilder != null) { clone.RenderChainBuilder = RenderChainBuilder.Clone(clone); } if (Presenter != null) { clone.Presenter = Presenter.Clone(); } if (PostPresenter != null) { clone.PostPresenter = PostPresenter.Clone(); } clone.DirtyMask = DirtyFlags.All; clone.UserData = null; return(clone); }
internal static AnimatorCollection SharedClone(Node owner, AnimatorCollection source) { var result = new AnimatorCollection(owner); foreach (var animator in source) { result.Add(animator.Clone()); } return(result); }
protected Node() { AnimationSpeed = 1; Components = new NodeComponentCollection(this); Animators = new AnimatorCollection(this); Animations = new AnimationCollection(this); Nodes = new NodeList(this); Presenter = DefaultPresenter.Instance; RenderChainBuilder = this; ++CreatedCount; }