Exemplo n.º 1
0
 private IEnumerable <Node> GetAnimationNodes(Node3D model, Animation attachmentAnimation)
 {
     if (attachmentAnimation.Nodes.Count > 0)
     {
         var nodeList = new List <Node>();
         foreach (var attachmentNode in attachmentAnimation.Nodes.Distinct())
         {
             var node = model.TryFindNode(attachmentNode.Id);
             if (node == null)
             {
                 Console.WriteLine($"Attachment3D Warning: Undable to add \"{ attachmentNode.Id }\" to the list of animable nodes. Node not found");
                 continue;
             }
             nodeList.Add(node);
         }
         return(nodeList);
     }
     if (attachmentAnimation.IgnoredNodes.Count > 0)
     {
         var nodeList = new List <Node>();
         foreach (var nodeData in attachmentAnimation.IgnoredNodes.Distinct())
         {
             var node = model.TryFindNode(nodeData.Id);
             if (node == null)
             {
                 Console.WriteLine($"Attachment3D Warning: Undable to add \"{ nodeData.Id }\" to the list ignored for animation nodes. Node not found");
                 continue;
             }
             nodeList.Add(node);
         }
         return(model.Descendants.Where(i => !nodeList.Contains(i)));
     }
     return(model.Descendants);
 }
Exemplo n.º 2
0
 private void ProcessComponents(Node3D model)
 {
     foreach (var nodeComponentData in NodeComponents)
     {
         var node = nodeComponentData.IsRoot ? model : model.TryFindNode(nodeComponentData.NodeId);
         if (node != null)
         {
             foreach (var component in nodeComponentData.Components)
             {
                 if (ValidateComponentType(node.GetType(), component.GetType()))
                 {
                     node.Components.Add(Cloner.Clone(component));
                 }
                 else
                 {
                     Console.WriteLine($"Warning: Unable to add {component.GetType().Name} to the {node.Id}." +
                                       " This component type isn't allowed for this node type.");
                 }
             }
         }
     }
 }