Example #1
0
        void InsertKey()
        {
            if (keyframes.Count <= 1)
            {
                AddKey();
                return;
            }

            float currentTime = time.val;

            JSONClass pose = GetPoseFromPerson();

            int      index = GetLastFrameIndex(currentTime);
            Keyframe last  = keyframes[index];

            int nextIndex = index + 1;

            if (nextIndex >= keyframes.Count)
            {
                nextIndex = 0;
            }

            Keyframe next         = keyframes[nextIndex];
            float    nextTimeStep = next.step.timeStep;

            AnimationStep newStep = animationPattern.CreateStepAfterStep(last.step);

            newStep.transitionToTime = currentTime - last.step.timeStep;

            next.step.transitionToTime = nextTimeStep - currentTime;

            Keyframe newKey = CreateKeyframe(pose, newStep, nextIndex);

            UpdateSaveStore();

            time.SetVal(animationPattern.GetTotalTime());

            SuperController.singleton.SelectController(newKey.step.containingAtom.mainController);
        }