Esempio n. 1
0
        protected override bool DoGUI(bool isValid)
        {
            if (State.ExportRoot == null)
            {
                return(false);
            }

            //
            // T-Pose
            //
            if (State.ExportRoot.GetComponent <Animator>() != null)
            {
                var backup = GUI.enabled;
                GUI.enabled = State.ExportRoot.scene.IsValid();
                if (GUI.enabled)
                {
                    EditorGUILayout.HelpBox(EnableTPose.ENALBE_TPOSE_BUTTON.Msg(), MessageType.Info);
                }
                else
                {
                    EditorGUILayout.HelpBox(EnableTPose.DISABLE_TPOSE_BUTTON.Msg(), MessageType.Warning);
                }

                //
                // T-Pose
                //
                if (GUILayout.Button(VRMExportSettingsEditor.Options.DO_TPOSE.Msg()))
                {
                    if (State.ExportRoot != null)
                    {
                        // fallback
                        Undo.RecordObjects(State.ExportRoot.GetComponentsInChildren <Transform>(), "tpose");
                        VRMBoneNormalizer.EnforceTPose(State.ExportRoot);
                        Repaint();
                    }
                }

                if (GUILayout.Button(VRMExportSettingsEditor.Options.DO_TPOSE.Msg() + "(unity internal)"))
                {
                    if (State.ExportRoot != null)
                    {
                        Undo.RecordObjects(State.ExportRoot.GetComponentsInChildren <Transform>(), "tpose.internal");
                        if (InternalTPose.TryMakePoseValid(State.ExportRoot))
                        {
                            // done
                            Repaint();
                        }
                        else
                        {
                            Debug.LogWarning("not found");
                        }
                    }
                }

                GUI.enabled = backup;
            }

            if (!isValid)
            {
                return(false);
            }

            EditorGUILayout.HelpBox($"Mesh size: {m_meshes.ExpectedExportByteSize / 1000000.0f:0.0} MByte", MessageType.Info);


            //
            // GUI
            //
            _tab = MeshUtility.TabBar.OnGUI(_tab);
            foreach (var meshInfo in m_meshes.Meshes)
            {
                switch (meshInfo.VertexColor)
                {
                case UniGLTF.MeshExportInfo.VertexColorState.ExistsAndMixed:
                    Validation.Warning($"{meshInfo.Renderer}: Both vcolor.multiply and not multiply unlit materials exist").DrawGUI();
                    break;
                }
            }
            return(DrawWizardGUI());
        }
Esempio n. 2
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(20);
            var settings = (VRMExportSettings)target;
            var root     = settings.Root;
            var backup   = GUI.enabled;

            GUI.enabled = root.scene.IsValid();
            if (GUI.enabled)
            {
                EditorGUILayout.HelpBox(Options.ENALBE_TPOSE_BUTTON.Msg(), MessageType.Info);
            }
            else
            {
                EditorGUILayout.HelpBox(Options.DISABLE_TPOSE_BUTTON.Msg(), MessageType.Warning);
            }

            //
            // T-Pose
            //
            if (GUILayout.Button(VRMExportSettingsEditor.Options.DO_TPOSE.Msg()))
            {
                if (settings.Root != null)
                {
                    // fallback
                    Undo.RecordObjects(settings.Root.GetComponentsInChildren <Transform>(), "tpose");
                    VRMBoneNormalizer.EnforceTPose(settings.Root);
                }
            }

            if (GUILayout.Button(VRMExportSettingsEditor.Options.DO_TPOSE.Msg() + "(unity internal)"))
            {
                if (settings.Root != null)
                {
                    Undo.RecordObjects(settings.Root.GetComponentsInChildren <Transform>(), "tpose.internal");
                    if (InternalTPose.TryMakePoseValid(settings.Root))
                    {
                        // done
                    }
                    else
                    {
                        Debug.LogWarning("not found");
                    }
                }
            }

            GUI.enabled = backup;
            GUILayout.Space(20);

            // ToDo: 任意の BlendShapeClip を適用する

            EditorGUIUtility.labelWidth = 160;
            serializedObject.Update();
            m_poseFreeze.Draw();
            m_useSparseAccessor.Draw();
            m_onlyBlendShapePosition.Draw();
            m_reduceBlendShape.Draw();
            m_reduceBlendShapeClip.Draw();
            m_divideVertexBuffer.Draw();

            serializedObject.ApplyModifiedProperties();
        }