private void OnGUI() { _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos); EditorGUIUtility.labelWidth = 150; // lang LanguageGetter.OnGuiSelectLang(); _tab = TabBar.OnGUI(_tab, _tabButtonStyle, _tabButtonSize); switch (_tab) { case Tabs.MeshSeparator: EditorGUILayout.LabelField(MeshProcessingMessages.MESH_SEPARATOR.Msg()); break; case Tabs.MeshIntegrator: EditorGUILayout.LabelField(MeshProcessingMessages.MESH_INTEGRATOR.Msg()); break; case Tabs.StaticMeshIntegrator: EditorGUILayout.LabelField(MeshProcessingMessages.STATIC_MESH_INTEGRATOR.Msg()); break; case Tabs.BoneMeshEraser: EditorGUILayout.LabelField(MeshProcessingMessages.BONE_MESH_ERASER.Msg()); break; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(MeshProcessingMessages.TARGET_OBJECT.Msg(), GUILayout.MaxWidth(146.0f)); _exportTarget = (GameObject)EditorGUILayout.ObjectField(_exportTarget, typeof(GameObject), true); EditorGUILayout.EndHorizontal(); if (_exportTarget == null && MeshUtility.IsGameObjectSelected()) { _exportTarget = Selection.activeObject as GameObject; } if (_tab == Tabs.BoneMeshEraser) { if (_boneMeshEraserEditor) { _boneMeshEraserEditor.OnInspectorGUI(); } // any better way we can detect component change? if (_cSkinnedMesh != _pSkinnedMesh || _cAnimator != _pAnimator || _cEraseRoot != _pEraseRoot) { BoneMeshEraserValidate(); } _pSkinnedMesh = _cSkinnedMesh; _pAnimator = _cAnimator; _pEraseRoot = _cEraseRoot; } // Create Other Buttons { GUILayout.BeginVertical(); { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Process", GUILayout.MinWidth(100))) { switch (_tab) { case Tabs.MeshSeparator: _isInvokeSuccess = InvokeWizardUpdate("MeshSeparator"); break; case Tabs.MeshIntegrator: _isInvokeSuccess = InvokeWizardUpdate("MeshIntegrator"); break; case Tabs.StaticMeshIntegrator: _isInvokeSuccess = InvokeWizardUpdate("StaticMeshIntegrator"); break; case Tabs.BoneMeshEraser: _isInvokeSuccess = InvokeWizardUpdate("BoneMeshRemover"); break; } if (_isInvokeSuccess) { Close(); GUIUtility.ExitGUI(); } } GUI.enabled = true; GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } EditorGUILayout.EndScrollView(); }
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(); } }