private void AdjustEyeRotation()
        {
            //NOTE: どっちかというとWordToMotion用に"Disable/Enable"系のAPI出す方がいいかも
            if (!_hasValidEyeSettings || _config.ShouldSkipNonMouthBlendShape)
            {
                return;
            }

            bool shouldUseAlternativeBlink = _exTracker.Connected && _config.ShouldStopEyeDownOnBlink;

            float leftBlink = shouldUseAlternativeBlink
                ? _config.AlternativeBlinkL
                : _blendShapeProxy.GetValue(BlinkLKey);
            float rightBlink = shouldUseAlternativeBlink
                ? _config.AlternativeBlinkR
                : _blendShapeProxy.GetValue(BlinkRKey);

            //NOTE: 毎回LookAtで値がうまく設定されてる前提でこういう記法になっている事に注意
            _leftEyeBone.localRotation *= Quaternion.AngleAxis(
                eyeAngleDegreeWhenEyeClosed * leftBlink,
                Vector3.right
                );

            _rightEyeBone.localRotation *= Quaternion.AngleAxis(
                eyeAngleDegreeWhenEyeClosed * rightBlink,
                Vector3.right
                );
        }
Exemple #2
0
        void Update()
        {
            var valuesToSet  = new Dictionary <BlendShapeKey, float>();
            var keysFinished = new List <BlendShapeKey>();

            foreach (var t in transitions)
            {
                valuesToSet.Add(t.Key, t.Value.Next(Time.deltaTime));
                if (t.Value.IsFinished)
                {
                    keysFinished.Add(t.Key);
                }
            }

            if (!IsActive)
            {
                return;
            }
            VRM.SetValues(valuesToSet);

            // アニメーションが終わったものはリセットする
            // (リセットさせたくないものは Transition.Hold() でアニメーションを維持すること)
            foreach (var k in keysFinished)
            {
                transitions.Remove(k);
                if (VRM.GetValue(k) != 0)
                {
                    TurnDown(k, VRM.GetValue(k) * AutoResetSpeed);
                }
            }
        }
Exemple #3
0
    public void ResetNetwork(int sender_id)
    {
        if (m_PhotonView.ViewID != sender_id)
        {
            return;
        }

        foreach (KeyValuePair <string, BlendShapeSettings> pair in m_BlendShapeMap)
        {
            if (m_BlendShape.GetValue(pair.Value.m_Key) > 0)
            {
                StartCoroutine(EaseOut(pair.Key, m_BlendShape.GetValue(pair.Value.m_Key), 0f));
            }
        }
    }
        private void AdjustEyeRotation()
        {
            float leftBlink  = _blendShapeProxy.GetValue(BlinkLKey);
            float rightBlink = _blendShapeProxy.GetValue(BlinkRKey);

            //NOTE: 毎回LookAtで値がうまく設定されてる前提でこういう記法になっている事に注意
            _leftEyeBone.localRotation *= Quaternion.AngleAxis(
                eyeAngleDegreeWhenEyeClosed * leftBlink,
                Vector3.right
                );

            _rightEyeBone.localRotation *= Quaternion.AngleAxis(
                eyeAngleDegreeWhenEyeClosed * rightBlink,
                Vector3.right
                );
        }
    void GetBlendShape()
    {
        // VRM
        DestroyContent(VRMContent, VRMSliders);

        var clips = Proxy.BlendShapeAvatar.Clips;

        for (int i = 0; i < clips.Count; i++)
        {
            var panel = Instantiate(Panel);
            panel.transform.SetParent(VRMContent.transform);

            var text = panel.transform.GetChild(0).GetComponent <Text>();
            text.text = clips[i].BlendShapeName;

            var slider = panel.transform.GetChild(1).GetComponent <Slider>();
            slider.maxValue = 1;
            slider.value    = Proxy.GetValue(clips[i].Key);
            VRMSliders.Add(slider);
        }

        SetSizeDelta(VRMContent, clips.Count);

        // FBX
        DestroyContent(FullContent, FullSliders);

        var count    = 0;
        var skinneds = SelectVRM.RootMarker.GetComponentsInChildren <SkinnedMeshRenderer>();

        foreach (var skinned in skinneds)
        {
            for (int i = 0; i < skinned.sharedMesh.blendShapeCount; i++)
            {
                var panel = Instantiate(Panel);
                panel.transform.SetParent(FullContent.transform);

                var text = panel.transform.GetChild(0).GetComponent <Text>();
                text.text = skinned.sharedMesh.GetBlendShapeName(i);

                var slider = panel.transform.GetChild(1).GetComponent <Slider>();
                slider.maxValue = 100;
                slider.value    = skinned.GetBlendShapeWeight(i);
                FullSliders.Add(slider);

                count++;
            }
        }
        Skinneds = new List <SkinnedMeshRenderer>(skinneds);

        SetSizeDelta(FullContent, count);
    }
        private void AdjustEyeRotation()
        {
            //NOTE: どっちかというとWordToMotion用に"Disable/Enable"系のAPI出す方がいいかも
            if (!_hasValidEyeSettings ||
                wordToMotion.EnablePreview ||
                wordToMotion.IsPlayingBlendShape)
            {
                return;
            }

            float leftBlink  = _blendShapeProxy.GetValue(BlinkLKey);
            float rightBlink = _blendShapeProxy.GetValue(BlinkRKey);

            //NOTE: 毎回LookAtで値がうまく設定されてる前提でこういう記法になっている事に注意
            _leftEyeBone.localRotation *= Quaternion.AngleAxis(
                eyeAngleDegreeWhenEyeClosed * leftBlink,
                Vector3.right
                );

            _rightEyeBone.localRotation *= Quaternion.AngleAxis(
                eyeAngleDegreeWhenEyeClosed * rightBlink,
                Vector3.right
                );
        }
Exemple #7
0
        private void Update()
        {
            if (!_hasModel)
            {
                return;
            }

            for (int i = 0; i < _keys.Length; i++)
            {
                //NOTE: ゼロのやつを上書きすると負荷がムダに増えそうなので避けてます
                if (_proxy.GetValue(_keys[i]) > 0)
                {
                    _proxy.AccumulateValue(_keys[i], 0);
                }
            }
        }