protected virtual void CopyTo(XmlNode node) { node.Animate = this.Animate; node.Translation = this.Translation; node.Parent = null; node.ID = this.ID; }
protected override void CopyTo(XmlNode node) { base.CopyTo(node); var brush = node as XmlBrush; if (brush == null) return; var planes = new List<Plane>(); foreach (var plane in this.Planes) planes.Add(new Plane(plane)); brush.Planes = planes; }
protected override void CopyTo(XmlNode node) { base.CopyTo(node); var branch = node as XmlBranch; if (branch == null) return; branch.Operator = this.Operator; if (this.Left != null) branch.Left = this.Left.Clone(); else branch.Left = null; if (this.Right != null) branch.Right = this.Right.Clone(); else branch.Right = null; }
static XmlNode RemoveInstances(XmlNode node, Dictionary<string, XmlNode> lookup) { if (node == null) return null; var instance = node as XmlInstance; if (instance != null) { if (string.IsNullOrWhiteSpace(instance.InstanceID)) return null; XmlNode lookupNode; if (!lookup.TryGetValue(instance.InstanceID, out lookupNode)) return null; lookupNode = lookupNode.Clone(); lookupNode.ID = instance.ID; if (lookupNode == null) return null; var result = RemoveInstances(lookupNode, lookup); if (result == null) return null; result.ID = instance.ID; result.Translation = Vector3.Add(instance.Translation, result.Translation); result.Animate = result.Animate || instance.Animate; return result; } var branch = node as XmlBranch; if (branch != null) { branch.Left = RemoveInstances(branch.Left, lookup); branch.Right = RemoveInstances(branch.Right, lookup); if (branch.Left == null || branch.Right == null) return null; } return node; }