コード例 #1
0
        public override void OnInspectorGUI()
        {
            s_currentTab = TabBar.OnGUI(s_currentTab);
            GUILayout.Space(10);

            switch (s_currentTab)
            {
            case Tabs.Model:
            {
                switch (m_result.FileType)
                {
                case Vrm10FileType.Vrm1:
                    EditorGUILayout.HelpBox(m_result.Message, MessageType.Info);
                    break;

                case Vrm10FileType.Vrm0:
                    EditorGUILayout.HelpBox(m_result.Message, m_model != null ? MessageType.Info : MessageType.Warning);
                    // migration check boxs
                    base.OnInspectorGUI();
                    break;

                default:
                    break;
                }
            }
            break;

            case Tabs.Materials:
                if (m_result.Data != null && m_result.Vrm != null)
                {
                    m_materialEditor.OnGUI(m_importer, m_result.Data, new Vrm10TextureDescriptorGenerator(m_result.Data),
                                           assetPath => $"{Path.GetFileNameWithoutExtension(assetPath)}.vrm1.Textures",
                                           assetPath => $"{Path.GetFileNameWithoutExtension(assetPath)}.vrm1.Materials");
                    RevertApplyRemapGUI(m_importer);
                }
                break;

            case Tabs.Vrm:
                if (m_result.Data != null && m_result.Vrm != null)
                {
                    m_vrmEditor.OnGUI(m_importer, m_result.Data, m_result.Vrm);
                    RevertApplyRemapGUI(m_importer);
                }
                break;
            }
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            s_currentTab = TabBar.OnGUI(s_currentTab);
            GUILayout.Space(10);

            switch (s_currentTab)
            {
            case Tabs.Model:
            {
                if (m_migration == null)
                {
                    {
                        serializedObject.Update();
                        // normalize
                        EditorGUILayout.Space();
                        EditorGUILayout.HelpBox("Create normalized prefab", MessageType.Info);
                        EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(VrmScriptedImporter.Normalize)));
                        serializedObject.ApplyModifiedProperties();
                    }

                    ApplyRevertGUI();
                }
                else
                {
                    EditorGUILayout.HelpBox(m_migration.Message, m_model != null ? MessageType.Info : MessageType.Warning);

                    if (VRMShaders.Symbols.VRM_DEVELOP)
                    {
                        if (GUILayout.Button("debug export"))
                        {
                            File.WriteAllBytes("tmp.vrm", m_migration.MigratedBytes);
                        }
                    }

                    {
                        serializedObject.Update();
                        // migration
                        EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(VrmScriptedImporter.MigrateToVrm1)));
                        serializedObject.ApplyModifiedProperties();
                    }

                    ApplyRevertGUI();
                }
                break;
            }

            case Tabs.Materials:
                if (m_result.Data != null && m_result.VrmExtension != null)
                {
                    m_materialEditor.OnGUI(m_importer, m_result.Data, new Vrm10TextureDescriptorGenerator(m_result.Data),
                                           assetPath => $"{Path.GetFileNameWithoutExtension(assetPath)}.vrm1.Textures",
                                           assetPath => $"{Path.GetFileNameWithoutExtension(assetPath)}.vrm1.Materials");

                    // render pipeline
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox("Experimental", MessageType.Warning);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(VrmScriptedImporter.RenderPipeline)));

                    ApplyRevertGUI();
                }
                break;

            case Tabs.Vrm:
                if (m_result.Data != null && m_result.VrmExtension != null)
                {
                    m_vrmEditor.OnGUI(m_importer, m_result.Data, m_result.VrmExtension);
                    ApplyRevertGUI();
                }
                break;
            }
        }