void Validate() { if (!m_requireValidation) { return; } m_validator.Validate(ExportRoot, m_settings, Meta != null ? Meta : m_tmpMeta); m_requireValidation = false; m_meshes.SetRoot(ExportRoot, m_settings); }
protected override void OnLayout() { // m_settings, m_meshes.Meshes m_meshes.SetRoot(State.ExportRoot, m_settings); }
private void OnGUI() { // ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint Aborting // Validation により GUI の表示項目が変わる場合があるので、 // EventType.Layout と EventType.Repaint 間で内容が変わらないようしている。 if (Event.current.type == EventType.Layout) { // m_settings, m_meshes.Meshes m_meshes.SetRoot(m_state.ExportRoot, m_settings); m_state.Validate(ValidatorFactory()); } EditorGUIUtility.labelWidth = 150; // lang MeshUtility.M17N.Getter.OnGuiSelectLang(); EditorGUILayout.LabelField("ExportRoot"); { m_state.ExportRoot = (GameObject)EditorGUILayout.ObjectField(m_state.ExportRoot, typeof(GameObject), true); } // Render contents using Generic Inspector GUI m_ScrollPosition = BeginVerticalScrollView(m_ScrollPosition, false, GUI.skin.verticalScrollbar, "OL Box"); GUIUtility.GetControlID(645789, FocusType.Passive); bool modified = ScrollArea(); EditorGUILayout.EndScrollView(); // Create and Other Buttons { // errors GUILayout.BeginVertical(); // GUILayout.FlexibleSpace(); { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUI.enabled = m_state.Validations.All(x => x.CanExport); if (GUILayout.Button("Export", GUILayout.MinWidth(100))) { OnExportClicked(m_state.ExportRoot, Meta != null ? Meta : m_tmpMeta, m_settings, m_meshes); Close(); GUIUtility.ExitGUI(); } GUI.enabled = true; GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } GUILayout.Space(8); if (modified) { m_state.Invalidate(); } }