Exemplo n.º 1
0
        List <MorphAnimationStep> ConstructPlayback(JSONClass animationData)
        {
            DAZCharacterSelector       dcs     = containingAtom.GetStorableByID("geometry") as DAZCharacterSelector;
            GenerateDAZMorphsControlUI morphUI = dcs.morphsControlUI;

            return(animationData.Keys.ToList().Select((morphName) =>
            {
                DAZMorph morph = morphUI.GetMorphByDisplayName(morphName);
                JSONArray changes = animationData[morphName].AsArray;

                List <MorphAnimationStep> steps = changes.Childs.ToList().Select(change =>
                {
                    JSONClass changeObject = change.AsObject;
                    float time = float.Parse(changeObject["time"]);
                    float value = float.Parse(changeObject["value"]);
                    MorphAnimationStep step = new MorphAnimationStep()
                    {
                        morph = morph,
                        time = time,
                        value = value,
                    };
                    return step;
                }).ToList();

                for (int i = 0; i < steps.Count - 1; i++)
                {
                    steps[i].next = steps[i + 1];
                }

                MorphAnimationStep head = steps[0];
                return head;
            }).ToList());
        }
Exemplo n.º 2
0
        void SeekToTime(float time)
        {
            playbackSteps.ForEach(clipStep =>
            {
                MorphAnimationStep step = clipStep;
                while (time >= step.time && step.next != null)
                {
                    step = step.next;
                }

                step.morph.SetValue(step.value);
                step.morph.SyncJSON();
            });
        }