예제 #1
0
        public static bool OnGUI(GameObject root)
        {
            var _isInvokeSuccess = false;

            GUILayout.BeginVertical();
            {
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Process", GUILayout.MinWidth(100)))
                {
                    _isInvokeSuccess = TabMeshSeparator.Execute(root);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            return(_isInvokeSuccess);
        }
예제 #2
0
        private void OnGUI()
        {
            _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos);
            EditorGUIUtility.labelWidth = 200;
            LanguageGetter.OnGuiSelectLang();
            _exportTarget = (GameObject)EditorGUILayout.ObjectField(MeshProcessingMessages.TARGET_OBJECT.Msg(), _exportTarget, typeof(GameObject), true);
            _tab          = TabBar.OnGUI(_tab, "LargeButton", GUI.ToolbarButtonSize.Fixed);

            var processed = false;

            switch (_tab)
            {
            case MeshProcessDialogTabs.MeshSeparator:
            {
                EditorGUILayout.HelpBox(MeshProcessingMessages.MESH_SEPARATOR.Msg(), MessageType.Info);
                if (TabMeshSeparator.TryExecutable(_exportTarget, out string msg))
                {
                    processed = TabMeshSeparator.OnGUI(_exportTarget);
                }
                else
                {
                    EditorGUILayout.HelpBox(msg, MessageType.Error);
                }
                break;
            }

            case MeshProcessDialogTabs.MeshIntegrator:
            {
                EditorGUILayout.HelpBox(MeshProcessingMessages.MESH_INTEGRATOR.Msg(), MessageType.Info);
                _separateByBlendShape = EditorGUILayout.Toggle(MeshProcessingMessages.MESH_SEPARATOR_BY_BLENDSHAPE.Msg(), _separateByBlendShape);
                if (TabMeshIntegrator.TryExecutable(_exportTarget, out string msg))
                {
                    if (GUILayout.Button("Process", GUILayout.MinWidth(100)))
                    {
                        processed = TabMeshIntegrator.Execute(_exportTarget, _separateByBlendShape);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox(msg, MessageType.Error);
                }
                break;
            }

            case MeshProcessDialogTabs.BoneMeshEraser:
            {
                EditorGUILayout.HelpBox(MeshProcessingMessages.BONE_MESH_ERASER.Msg(), MessageType.Info);
                if (_boneMeshEraserEditor)
                {
                    _boneMeshEraserEditor.OnInspectorGUI();
                }
                if (TabBoneMeshRemover.TryExecutable(_exportTarget, _skinnedMeshRenderer, out string msg))
                {
                    processed = TabBoneMeshRemover.OnGUI(_exportTarget, _skinnedMeshRenderer, _eraseBones);
                }
                else
                {
                    EditorGUILayout.HelpBox(msg, MessageType.Error);
                }
                break;
            }
            }
            EditorGUILayout.EndScrollView();

            if (processed)
            {
                Close();
                GUIUtility.ExitGUI();
            }
        }