Beispiel #1
0
        void ExpressionPreviewInPlay(VRM10ObjectExpression expression, Vrm10RuntimeExpression runtime)
        {
            if (expression == null)
            {
                EditorGUILayout.HelpBox("no expression settings", MessageType.Warning);
                return;
            }

            EditorGUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();

                // 右よせ
                EditorGUILayout.BeginVertical();
                {
                    GUILayout.FlexibleSpace();

                    m_map.Clear();
                    foreach (var kv in runtime.GetWeights())
                    {
                        var key = kv.Key;
                        if (kv.Key.Preset != ExpressionPreset.custom)
                        {
                            var value = ExpressionPresetSlider(expression, kv.Key.Preset, kv.Value);
                            m_map[key] = value;
                        }
                    }
                    GUILayout.FlexibleSpace();

                    runtime.SetWeights(m_map);
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
        }
Beispiel #2
0
        public Vrm10Runtime(Vrm10Instance target)
        {
            m_target = target;
            var animator = target.GetComponent <Animator>();

            if (animator == null)
            {
                throw new Exception();
            }

            m_head       = animator.GetBoneTransform(HumanBodyBones.Head);
            m_lookat     = new Vrm10RuntimeLookAt(target.Vrm.LookAt, animator, m_head, target.LookAtTargetType, target.Gaze);
            m_expression = new Vrm10RuntimeExpression(target, m_lookat, m_lookat.EyeDirectionApplicable);

            if (m_constraints == null)
            {
                m_constraints = target.GetComponentsInChildren <IVrm10Constraint>();
            }

            if (!Application.isPlaying)
            {
                // for UnitTest
                return;
            }

            m_fastSpringBoneService = FastSpringBoneService.Instance;
            m_fastSpringBoneBuffer  = CreateFastSpringBoneBuffer(m_target.SpringBone);
            m_fastSpringBoneService.BufferCombiner.Register(m_fastSpringBoneBuffer);
        }