private static Domain.Nodes.Node BuildSpriteNode(DocumentData data, Node node) { var spriteRef = new SpriteReference(node.SpriteKey); var domainNode = new SpriteNode(data.MessageBus, node.Id, node.Name, spriteRef) { Parent = node.ParentId == 0 ? null : data.Nodes[node.ParentId] // node list is in hierarchical order, so parents always are available when their children are added. }; if (domainNode.Parent == null) { data.RootNodes.InternalAdd(domainNode); } else { domainNode.Parent?.InternalAdd(domainNode); } domainNode.GetProperty(PropertyType.TranslationX).SetDesignValueInternal(node.Position.X); domainNode.GetProperty(PropertyType.TranslationY).SetDesignValueInternal(node.Position.Y); domainNode.GetProperty(PropertyType.RotationAngle).SetDesignValueInternal(node.Angle); domainNode.GetProperty(PropertyType.Visibility).SetDesignValueInternal(node.IsVisible ? 1f : 0f); return(domainNode); }