Example #1
0
 public AnimationState(AnimationStateDescription stateDesc, AnimationPackage package)
 {
     Name = stateDesc.Name;
     MinDuration = TimeSpan.FromSeconds(stateDesc.MinDurationInSeconds);
     timeInState = TimeSpan.Zero;
     playbackRate = 1.0f;
     blendTree = AnimationNode.Create(package.NodeDescriptions[stateDesc.BlendTreeNodeName], package);
 }
Example #2
0
 public AnimationState(AnimationStateDescription stateDesc, AnimationPackage package)
 {
     Name         = stateDesc.Name;
     MinDuration  = TimeSpan.FromSeconds(stateDesc.MinDurationInSeconds);
     timeInState  = TimeSpan.Zero;
     playbackRate = 1.0f;
     blendTree    = AnimationNode.Create(package.NodeDescriptions[stateDesc.BlendTreeNodeName], package);
 }
        public BinaryAdditiveBlendNode(BinaryAdditiveBlendNodeDescription nodeDesc, AnimationPackage package)
        {
            Name = nodeDesc.Name;

            targetPose = AnimationNode.Create(package.NodeDescriptions[nodeDesc.TargetNodeName], package);
            differencePose = AnimationNode.Create(package.NodeDescriptions[nodeDesc.DifferenceNodeName], package);

            playbackRate = 1.0f;
            PlaybackRate = nodeDesc.PlaybackRate;
        }
Example #4
0
        public BinaryAdditiveBlendNode(BinaryAdditiveBlendNodeDescription nodeDesc, AnimationPackage package)
        {
            Name = nodeDesc.Name;

            targetPose     = AnimationNode.Create(package.NodeDescriptions[nodeDesc.TargetNodeName], package);
            differencePose = AnimationNode.Create(package.NodeDescriptions[nodeDesc.DifferenceNodeName], package);

            playbackRate = 1.0f;
            PlaybackRate = nodeDesc.PlaybackRate;
        }
Example #5
0
        public BinaryRateRampBlendNode(BinaryRateRampBlendNodeDescription nodeDesc, AnimationPackage package)
        {
            Name  = nodeDesc.Name;
            rate1 = nodeDesc.Rate1;
            rate2 = nodeDesc.Rate2;

            child = AnimationNode.Create(package.NodeDescriptions[nodeDesc.ChildNodeName], package);

            playbackRate = 1.0f;
            BlendFactor  = nodeDesc.BlendFactor;
        }
        public BinaryRateRampBlendNode(BinaryRateRampBlendNodeDescription nodeDesc, AnimationPackage package)
        {
            Name = nodeDesc.Name;
            rate1 = nodeDesc.Rate1;
            rate2 = nodeDesc.Rate2;

            child = AnimationNode.Create(package.NodeDescriptions[nodeDesc.ChildNodeName], package);

            playbackRate = 1.0f;
            BlendFactor = nodeDesc.BlendFactor;
        }
        public BinaryLerpBlendNode(BinaryLerpBlendNodeDescription nodeDesc, AnimationPackage package)
        {
            Name = nodeDesc.Name;
            BlendFactor = nodeDesc.BlendFactor;
            playbackRate = nodeDesc.PlaybackRate;

            child1 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child1NodeName], package);
            child2 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child2NodeName], package);

            playbackRate = 1.0f;
            PlaybackRate = nodeDesc.PlaybackRate;   // Make sure the child nodes are populated so this value can propagate down.
        }
Example #8
0
        public BinaryLerpBlendNode(BinaryLerpBlendNodeDescription nodeDesc, AnimationPackage package)
        {
            Name         = nodeDesc.Name;
            BlendFactor  = nodeDesc.BlendFactor;
            playbackRate = nodeDesc.PlaybackRate;

            child1 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child1NodeName], package);
            child2 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child2NodeName], package);

            playbackRate = 1.0f;
            PlaybackRate = nodeDesc.PlaybackRate;   // Make sure the child nodes are populated so this value can propagate down.
        }
Example #9
0
        public override Matrix[] GetBoneTransforms()
        {
            AnimationNode activeNode = GetActiveChild();

            BinaryBlendAnimationNode binaryNode = activeNode as BinaryBlendAnimationNode;

            if (binaryNode != null)
            {
                Vector2 range = Partition[activeNode.Name];
                binaryNode.BlendFactor = (BlendPosition - range.X) / (range.Y - range.X);
            }

            return(activeNode.GetBoneTransforms());
        }
        public TernaryLerpBlendNode(TernaryLerpBlendNodeDescription nodeDesc, AnimationPackage package)
        {
            Name = nodeDesc.Name;
            BlendPosition = nodeDesc.BlendPosition;
            Child1Position = nodeDesc.Child1NodePosition;
            Child2Position = nodeDesc.Child2NodePosition;
            Child3Position = nodeDesc.Child3NodePosition;

            child1 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child1NodeName], package);
            child2 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child2NodeName], package);
            child3 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child3NodeName], package);

            playbackRate = 1.0f;
            PlaybackRate = nodeDesc.PlaybackRate;
        }
Example #11
0
        public Continuous1DLerpBlendNode(Continuous1DLerpBlendNodeDescription nodeDesc, AnimationPackage package)
        {
            Name               = nodeDesc.Name;
            BlendPosition      = nodeDesc.BlendPosition;
            ChildrenByPosition = new Dictionary <float, AnimationNode>();

            for (int c = 0; c < nodeDesc.ChildNodeNames.Count; c++)
            {
                AnimationNode childNode = AnimationNode.Create(package.NodeDescriptions[nodeDesc.ChildNodeNames[c]], package);
                ChildrenByPosition.Add(nodeDesc.ChildPositionsByName[nodeDesc.ChildNodeNames[c]], childNode);
            }

            playbackRate = 1.0f;
            PlaybackRate = nodeDesc.PlaybackRate;
        }
Example #12
0
        public TernaryLerpBlendNode(TernaryLerpBlendNodeDescription nodeDesc, AnimationPackage package)
        {
            Name           = nodeDesc.Name;
            BlendPosition  = nodeDesc.BlendPosition;
            Child1Position = nodeDesc.Child1NodePosition;
            Child2Position = nodeDesc.Child2NodePosition;
            Child3Position = nodeDesc.Child3NodePosition;

            child1 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child1NodeName], package);
            child2 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child2NodeName], package);
            child3 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child3NodeName], package);

            playbackRate = 1.0f;
            PlaybackRate = nodeDesc.PlaybackRate;
        }
Example #13
0
        public General1DPositionalBlendNode(General1DPositionalBlendNodeDescription nodeDesc, AnimationPackage package)
        {
            Name             = nodeDesc.Name;
            BlendPosition    = nodeDesc.BlendPosition;
            children         = new List <AnimationNode>();
            Partition        = nodeDesc.ChildRangesByName;
            SyncClipNodeName = nodeDesc.SyncClipNodeName;

            for (int c = 0; c < nodeDesc.ChildNodeNames.Count; c++)
            {
                children.Add(AnimationNode.Create(package.NodeDescriptions[nodeDesc.ChildNodeNames[c]], package));
            }

            playbackRate = 1.0f;
            PlaybackRate = nodeDesc.PlaybackRate;
        }
Example #14
0
        public override void AdvanceTime(TimeSpan elapsedTime)
        {
            AnimationNode activeNode = GetActiveChild();

            activeNode.AdvanceTime(elapsedTime);

            foreach (AnimationNode an in Children)
            {
                if (an == activeNode)
                {
                    continue;
                }

                bool dummyNodeFound;
                an.Synchronize(activeNode.GetNormalizedTime(SyncClipNodeName, out dummyNodeFound));
            }
        }
Example #15
0
        public General2DPositionalBlendNode(General2DPositionalBlendNodeDescription nodeDesc, AnimationPackage package)
        {
            Name          = nodeDesc.Name;
            BlendPosition = nodeDesc.BlendPosition;
            Triangulation = new List <TernaryLerpBlendNode>();

            foreach (string triNodeName in nodeDesc.TriangleNodeNames)
            {
                Triangulation.Add((TernaryLerpBlendNode)(AnimationNode.Create(package.NodeDescriptions[triNodeName], package)));
            }

            children = new AnimationNode[Triangulation.Count];

            for (int c = 0; c < Triangulation.Count; c++)
            {
                children[c] = Triangulation[c];
            }

            playbackRate = 1.0f;
            PlaybackRate = nodeDesc.PlaybackRate;
        }