/// <summary> /// OnGUI /// </summary> // ----------------------------------------------------------------------------------------- void OnGUI() { if (this.m_serializedObject == null) { this.m_serializedObject = new SerializedObject(this); } EditorGUIUtility.labelWidth = 200; this.m_scrollPos = EditorGUILayout.BeginScrollView(this.m_scrollPos); // HelpBox { EditorGUILayout.HelpBox( "Mesh and Texture Combiner", MessageType.Info ); } GUILayout.Space(20.0f); // m_textureAtlasSize { this.m_maximumAtlasSize = (MaximumAtlasSize)EditorGUILayout.EnumPopup("Maximum Atlas Size", this.m_maximumAtlasSize); } // m_atlasPaddingSize { this.m_atlasPaddingSize = EditorGUILayout.IntSlider("Atlas Padding Size", this.m_atlasPaddingSize, 0, 16); } GUILayout.Space(20.0f); // m_includeChildren { this.m_includeChildren = EditorGUILayout.Toggle("Use GetComponentsInChildren", this.m_includeChildren); } // m_tagsToExcludeFromCombining { EditorGUILayout.PropertyField(this.m_serializedObject.FindProperty("m_tagsToExcludeFromCombining"), true); this.m_serializedObject.ApplyModifiedProperties(); } // m_gobjs { EditorGUILayout.PropertyField(this.m_serializedObject.FindProperty("m_gameObjects"), true); this.m_serializedObject.ApplyModifiedProperties(); } GUILayout.Space(20.0f); // { EditorGUILayout.HelpBox( "Please click [Check Materials] button again if you changed some Transform parameters.", MessageType.Info ); GUI.enabled = this.m_gameObjects.Count > 0; if (GUILayout.Button("Check Materials", GUILayout.MinHeight(30))) { this.checkMaterials(); } GUI.enabled = true; } GUILayout.Space(20.0f); // { foreach (var val in this.m_infoList.infos) { val.Value.foldout = EditorGUILayout.Foldout(val.Value.foldout, val.Key, true); if (val.Value.foldout) { this.drawLineForPathsToCreate(ref val.Value.meshPathToCreate, "File Path for Mesh", "asset"); this.drawLineForPathsToCreate(ref val.Value.materialPathToCreate, "File Path for Material", "mat"); this.drawLineForPathsToCreate(ref val.Value.texturePathToCreate, "File Path for Texture", "png"); } GUILayout.Space(20.0f); } } GUILayout.Space(20.0f); // { if (this.m_infoList.infos.Count > 0) { if (GUILayout.Button("Generate", GUILayout.MinHeight(30))) { if (this.confirmOverwrite()) { this.generate(); } } } } EditorGUILayout.EndScrollView(); }
/// <summary> /// OnGUI /// </summary> // ----------------------------------------------------------------------------------------- void OnGUI() { if (this.m_serializedObject == null) { this.m_serializedObject = new SerializedObject(this); } this.m_scrollPos = EditorGUILayout.BeginScrollView(this.m_scrollPos); // HelpBox { EditorGUILayout.HelpBox( "This tool will create the things as follows\n\n" + "Combined Materials\n" + "Combined Textures\n" + "Each mesh with changing UV\n" + "(And current scene will be copied for backup with current DateTime)\n", MessageType.Info ); } // HelpBox { EditorGUILayout.HelpBox( "This tool will replace mesh and material with new ones in each GameObject.\n" + "So this tool will DESTROY your scene.\n", MessageType.Error ); } GUILayout.Space(20.0f); // m_textureAtlasSize { this.m_maximumAtlasSize = (MaximumAtlasSize)EditorGUILayout.EnumPopup("Maximum Atlas Size", this.m_maximumAtlasSize); } // m_atlasPaddingSize { this.m_atlasPaddingSize = EditorGUILayout.IntSlider("Atlas Padding Size", this.m_atlasPaddingSize, 0, 16); } GUILayout.Space(20.0f); // m_includeChildren { this.m_includeChildren = EditorGUILayout.Toggle("Use GetComponentsInChildren", this.m_includeChildren); } // m_tagsToExcludeFromCombining { EditorGUILayout.PropertyField(this.m_serializedObject.FindProperty("m_tagsToExcludeFromCombining"), true); this.m_serializedObject.ApplyModifiedProperties(); } // m_gobjs { EditorGUILayout.PropertyField(this.m_serializedObject.FindProperty("m_gameObjects"), true); this.m_serializedObject.ApplyModifiedProperties(); } GUILayout.Space(20.0f); // { GUI.enabled = this.m_gameObjects.Count > 0; if (GUILayout.Button("Check Materials", GUILayout.MinHeight(30))) { this.checkTags(); this.checkMaterials(); } GUI.enabled = true; } GUILayout.Space(20.0f); // { foreach (var val in this.m_infoList.infos) { val.Value.foldout = EditorGUILayout.Foldout(val.Value.foldout, val.Key, true); if (val.Value.foldout) { this.drawLineForMeshFolder(ref val.Value.meshFolderPath, "Folder Path for Mesh"); this.drawLineForFilePathsToCreate(ref val.Value.materialPathToCreate, "File Path for Material", "mat"); this.drawLineForFilePathsToCreate(ref val.Value.texturePathToCreate, "File Path for Texture", "png"); } GUILayout.Space(20.0f); } } GUILayout.Space(20.0f); // { if (this.m_infoList.infos.Count > 0) { if (GUILayout.Button("Generate", GUILayout.MinHeight(30))) { if (this.checkIfPathsAreValid()) { if (this.confirmOverwrite()) { this.createBackupCurrentScene(); this.generate(); } } } } } EditorGUILayout.EndScrollView(); // ClearProgressBar { EditorUtility.ClearProgressBar(); } }