Esempio n. 1
0
        public override void OnInspectorGUI()
        {
            var changed = false;

            serializedObject.Update();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical();
            PrefabGUI();
            EditorGUILayout.LabelField("Preview Weight");
            var previewSlider = EditorGUILayout.Slider(m_previewSlider, 0, 1.0f);

            if (m_target.IsBinary)
            {
                previewSlider = Mathf.Round(previewSlider);
            }
            if (previewSlider != m_previewSlider)
            {
                m_previewSlider = previewSlider;
                changed         = true;
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
            Separator();

            if (m_scene == null)
            {
                if (m_target.Prefab != null)
                {
                    m_scene = UniVRM10.PreviewSceneManager.GetOrCreate(m_target.Prefab);
                    if (m_scene != null)
                    {
                        m_scene.gameObject.SetActive(false);
                    }
                    Bake();
                }
            }

            if (m_scene != null)
            {
                if (m_serializedEditor == null)
                {
                    m_serializedEditor = new SerializedExpressionEditor(serializedObject, m_scene);
                }
                if (m_serializedEditor.Draw(out VRM10Expression bakeValue))
                {
                    changed = true;
                }
                if (changed)
                {
                    m_scene.Bake(bakeValue, m_previewSlider);
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 2
0
        public override void OnInspectorGUI()
        {
            if (PreviewSceneManager == null)
            {
                return;
            }
            serializedObject.Update();

            if (m_serializedEditor == null)
            {
                m_serializedEditor = new SerializedExpressionEditor(serializedObject, PreviewSceneManager);
            }

            EditorGUILayout.BeginHorizontal();

            var changed = false;

            EditorGUILayout.BeginVertical();
            base.OnInspectorGUI();
            EditorGUILayout.LabelField("Preview Weight");
            var previewSlider = EditorGUILayout.Slider(m_previewSlider, 0, 1.0f);

            EditorGUILayout.EndVertical();

            if (m_serializedEditor.IsBinary)
            {
                previewSlider = Mathf.Round(previewSlider);
            }

            if (previewSlider != m_previewSlider)
            {
                m_previewSlider = previewSlider;
                changed         = true;
            }

            EditorGUILayout.EndHorizontal();
            Separator();
            // EditorGUILayout.Space();

            if (m_serializedEditor.Draw(out VRM10Expression bakeValue))
            {
                changed = true;
            }

            if (changed && PreviewSceneManager != null)
            {
                PreviewSceneManager.Bake(bakeValue, m_previewSlider);
            }
        }
Esempio n. 3
0
        void OnSelected(VRM10Expression clip)
        {
            if (PreviewSceneManager == null)
            {
                m_serializedEditor = null;
                return;
            }

            if (clip != null)
            {
                // select clip
                var status = SerializedExpressionEditor.EditorStatus.Default;
                if (m_serializedEditor != null)
                {
                    status = m_serializedEditor.Status;
                }
                m_serializedEditor = new SerializedExpressionEditor(clip, PreviewSceneManager, status);
            }
            else
            {
                // clear selection
                m_serializedEditor = null;
                PreviewSceneManager.Bake(default, 1.0f);