コード例 #1
0
    void addSelectedObjects()
    {
        MB3_MeshBakerRoot mom = (MB3_MeshBakerRoot)target;

        if (mom == null)
        {
            Debug.LogError("Must select a target MeshBaker to add objects to");
            return;
        }
        List <GameObject> newMomObjs = GetFilteredList();

        MB_EditorUtil.RegisterUndo(mom, "Add Objects");
        List <GameObject> momObjs = mom.GetObjectsToCombine();
        int numAdded = 0;

        for (int i = 0; i < newMomObjs.Count; i++)
        {
            if (!momObjs.Contains(newMomObjs[i]))
            {
                momObjs.Add(newMomObjs[i]);
                numAdded++;
            }
        }
        SerializedObject so = new SerializedObject(mom);

        so.SetIsDifferentCacheDirty();

        if (numAdded == 0)
        {
            Debug.LogWarning("Added 0 objects. Make sure some or all objects are selected in the hierarchy view. Also check ths 'Only Static Objects', 'Using Material' and 'Using Shader' settings");
        }
        else
        {
            Debug.Log("Added " + numAdded + " objects to " + mom.name);
        }
    }
コード例 #2
0
    void drawTabAddObjectsToBakers()
    {
        if (helpBoxString == null)
        {
            helpBoxString = "";
        }
        EditorGUILayout.HelpBox("To add, select one or more objects in the hierarchy view. Child Game Objects with MeshRender or SkinnedMeshRenderer will be added. Use the fields below to filter what is added." +
                                "To remove, use the fields below to filter what is removed.\n" + helpBoxString, UnityEditor.MessageType.None);
        target = (MB3_MeshBakerRoot)EditorGUILayout.ObjectField("Target to add objects to", target, typeof(MB3_MeshBakerRoot), true);

        if (target != null)
        {
            targetGO = target.gameObject;
        }
        else
        {
            targetGO = null;
        }

        if (targetGO != oldTargetGO && targetGO != null)
        {
            textureBaker = targetGO.GetComponent <MB3_TextureBaker>();
            meshBaker    = targetGO.GetComponent <MB3_MeshBaker>();
            tbe          = new MB3_TextureBakerEditorInternal();
            mbe          = new MB3_MeshBakerEditorInternal();
            oldTargetGO  = targetGO;
            if (textureBaker != null)
            {
                serializedObject = new SerializedObject(textureBaker);
                tbe.OnEnable(serializedObject);
            }
            else if (meshBaker != null)
            {
                serializedObject = new SerializedObject(meshBaker);
                mbe.OnEnable(serializedObject);
            }
        }


        EditorGUIUtility.labelWidth = 300;
        onlyStaticObjects           = EditorGUILayout.Toggle("Only Static Objects", onlyStaticObjects);

        onlyEnabledObjects = EditorGUILayout.Toggle("Only Enabled Objects", onlyEnabledObjects);

        excludeMeshesWithOBuvs = EditorGUILayout.Toggle("Exclude meshes with out-of-bounds UVs", excludeMeshesWithOBuvs);

        excludeMeshesAlreadyAddedToBakers = EditorGUILayout.Toggle("Exclude GameObjects already added to bakers", excludeMeshesAlreadyAddedToBakers);

        mat       = (Material)EditorGUILayout.ObjectField("Using Material", mat, typeof(Material), true);
        shaderMat = (Material)EditorGUILayout.ObjectField("Using Shader", shaderMat, typeof(Material), true);

        string[] lightmapDisplayValues = new string[257];
        int[]    lightmapValues        = new int[257];
        lightmapValues[0]        = -2;
        lightmapValues[1]        = -1;
        lightmapDisplayValues[0] = "don't filter on lightmapping";
        lightmapDisplayValues[1] = "not lightmapped";
        for (int i = 2; i < lightmapDisplayValues.Length; i++)
        {
            lightmapDisplayValues[i] = "" + i;
            lightmapValues[i]        = i;
        }
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Using Lightmap Index ");
        lightmapIndex = EditorGUILayout.IntPopup(lightmapIndex,
                                                 lightmapDisplayValues,
                                                 lightmapValues);
        EditorGUILayout.EndHorizontal();
        if (regExParseError != null && regExParseError.Length > 0)
        {
            EditorGUILayout.HelpBox("Error In Regular Expression:\n" + regExParseError, MessageType.Error);
        }
        searchRegEx = EditorGUILayout.TextField(GUIContentRegExpression, searchRegEx);


        EditorGUILayout.Separator();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Add Selected Meshes To Target"))
        {
            addSelectedObjects();
        }
        if (GUILayout.Button("Remove Matching Meshes From Target"))
        {
            removeSelectedObjects();
        }
        EditorGUILayout.EndHorizontal();

        if (textureBaker != null)
        {
            MB_EditorUtil.DrawSeparator();
            tbFoldout = EditorGUILayout.Foldout(tbFoldout, "Texture Baker");
            if (tbFoldout)
            {
                tbe.DrawGUI(serializedObject, (MB3_TextureBaker)textureBaker, typeof(MB3_MeshBakerEditorWindow));
            }
        }
        if (meshBaker != null)
        {
            MB_EditorUtil.DrawSeparator();
            mbFoldout = EditorGUILayout.Foldout(mbFoldout, "Mesh Baker");
            if (mbFoldout)
            {
                mbe.DrawGUI(serializedObject, (MB3_MeshBaker)meshBaker, typeof(MB3_MeshBakerEditorWindow));
            }
        }
    }
コード例 #3
0
    void drawTabAnalyseScene()
    {
        //first time we are displaying collect the filters
        if (groupByOptionNames == null || groupByOptionNames.Length == 0)
        {
            //var types = AppDomain.CurrentDomain.GetAssemblies()
            //	.SelectMany(s => s.GetTypes())
            //		.Where(p => type.IsAssignableFrom(p));
            populateGroupByFilters();

            //set filter initial values
            for (int i = 0; i < groupByOptionFilters.Length; i++)
            {
                if (groupByOptionFilters[i] is GroupByShader)
                {
                    groupByFilterIdxs[0] = i;
                    break;
                }
            }
            for (int i = 0; i < groupByOptionFilters.Length; i++)
            {
                if (groupByOptionFilters[i] is GroupByStatic)
                {
                    groupByFilterIdxs[1] = i;
                    break;
                }
            }
            for (int i = 0; i < groupByOptionFilters.Length; i++)
            {
                if (groupByOptionFilters[i] is GroupByRenderType)
                {
                    groupByFilterIdxs[2] = i;
                    break;
                }
            }
            for (int i = 0; i < groupByOptionFilters.Length; i++)
            {
                if (groupByOptionFilters[i] is GroupByOutOfBoundsUVs)
                {
                    groupByFilterIdxs[3] = i;
                    break;
                }
            }
            groupByFilterIdxs[4] = 0;             //none
        }
        if (groupByFilterIdxs == null || groupByFilterIdxs.Length < NUM_FILTERS)
        {
            groupByFilterIdxs = new int[] {
                0, 0, 0, 0, 0
            };
        }
        EditorGUILayout.HelpBox("List shaders in scene prints a report to the console of shaders and which objects use them. This is useful for planning which objects to combine.", UnityEditor.MessageType.None);

        groupByFilterIdxs[0] = EditorGUILayout.Popup("Group By:", groupByFilterIdxs[0], groupByOptionNames);
        for (int i = 1; i < NUM_FILTERS; i++)
        {
            groupByFilterIdxs[i] = EditorGUILayout.Popup("Then Group By:", groupByFilterIdxs[i], groupByOptionNames);
        }

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Select Folder For Combined Material Assets"))
        {
            generate_AssetsFolder = EditorUtility.SaveFolderPanel("Create Combined Material Assets In Folder", "", "");
            generate_AssetsFolder = "Assets" + generate_AssetsFolder.Replace(Application.dataPath, "") + "/";
        }
        EditorGUILayout.LabelField("Folder: " + generate_AssetsFolder);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("List Shaders In Scene"))
        {
            EditorUtility.DisplayProgressBar("Analysing Scene", "", .05f);
            try{
                listMaterialsInScene();
            } catch (Exception ex) {
                Debug.LogError(ex.StackTrace);
            } finally {
                EditorUtility.ClearProgressBar();
            }
        }

        if (GUILayout.Button("Bake Every MeshBaker In Scene"))
        {
            try{
                MB3_TextureBaker[] texBakers = (MB3_TextureBaker[])FindObjectsOfType(typeof(MB3_TextureBaker));
                for (int i = 0; i < texBakers.Length; i++)
                {
                    texBakers[i].CreateAtlases(updateProgressBar, true, new MB3_EditorMethods());
                }
                MB3_MeshBakerCommon[] mBakers = (MB3_MeshBakerCommon[])FindObjectsOfType(typeof(MB3_MeshBakerCommon));
                for (int i = 0; i < mBakers.Length; i++)
                {
                    if (mBakers[i].textureBakeResults != null)
                    {
                        MB3_MeshBakerEditorFunctions.BakeIntoCombined(mBakers[i]);
                    }
                }
            } catch (Exception e) {
                Debug.LogError(e);
            }finally{
                EditorUtility.ClearProgressBar();
            }
        }
        EditorGUILayout.EndHorizontal();

        if (sceneAnalysisResults.Count > 0)
        {
            float height = position.height - 150f;
            if (height < 500f)
            {
                height = 500f;
            }
            MB_EditorUtil.DrawSeparator();
            scrollPos2 = EditorGUILayout.BeginScrollView(scrollPos2, false, true);           //(scrollPos2,, GUILayout.Width(position.width - 20f), GUILayout.Height(height));
            EditorGUILayout.LabelField("Shaders In Scene", EditorStyles.boldLabel);
            for (int i = 0; i < sceneAnalysisResults.Count; i++)
            {
                List <GameObjectFilterInfo> gows = sceneAnalysisResults[i];
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Generate Baker", GUILayout.Width(200)))
                {
                    createAndSetupBaker(gows, generate_AssetsFolder);
                }
                string descr = gows[0].GetDescription(GameObjectFilterInfo.filters, gows[0]);

                EditorGUILayout.LabelField(descr, EditorStyles.wordWrappedLabel);
                EditorGUILayout.EndHorizontal();
                sceneAnalysisResultsFoldouts[i] = EditorGUILayout.Foldout(sceneAnalysisResultsFoldouts[i], "");
                if (sceneAnalysisResultsFoldouts[i])
                {
                    EditorGUI.indentLevel += 1;
                    for (int j = 0; j < gows.Count; j++)
                    {
                        if (gows[j].go != null)
                        {
                            EditorGUILayout.LabelField(gows[j].go.name + "  " + gows[j].GetDescription(GameObjectFilterInfo.filters, gows[j]));
                        }
                    }
                    EditorGUI.indentLevel -= 1;
                }
            }
            EditorGUILayout.EndScrollView();
            MB_EditorUtil.DrawSeparator();
        }
    }
コード例 #4
0
    void OnGUI()
    {
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height));

        EditorGUILayout.LabelField("Generate Report", EditorStyles.boldLabel);
        EditorGUILayout.HelpBox("List shaders in scene prints a report to the console of shaders and which objects use them. This is useful for planning which objects to combine.", UnityEditor.MessageType.None);

        if (GUILayout.Button("List Shaders In Scene"))
        {
            listMaterialsInScene(false);
        }

        EditorGUILayout.Separator();
        MB_EditorUtil.DrawSeparator();

        EditorGUILayout.HelpBox("This feature is experimental. It should be safe to use as all it does is generate game objects with Mesh and Material bakers " +
                                "on them and assets for the combined materials.\n\n" +
                                "Creates bakers and combined material assets in your scene based on the groupings in 'Generate Report'." +
                                "Some configuration may still be required after bakers are generated. Groups are created for objects that " +
                                "use the same material(s), shader(s) and lightmap. These groups should produce good results when baked.\n\n" +
                                "This feature groups objects conservatively so bakes almost always work.   This is not the only way to group objects. Objects with different shaders can also be grouped but results are" +
                                " less preditable. Meshes with submeshes are only" +
                                "grouped if all meshes use the same set of shaders.", UnityEditor.MessageType.None);

        EditorGUILayout.LabelField(autoGenerateGUIContent, EditorStyles.boldLabel);
        autoGenerateMeshBakers = EditorGUILayout.Foldout(autoGenerateMeshBakers, "Show Tools");
        if (autoGenerateMeshBakers)
        {
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Select Folder For Combined Material Assets"))
            {
                generate_AssetsFolder = EditorUtility.SaveFolderPanel("Create Combined Material Assets In Folder", "", "");
                generate_AssetsFolder = "Assets" + generate_AssetsFolder.Replace(Application.dataPath, "") + "/";
            }
            EditorGUILayout.LabelField("Folder: " + generate_AssetsFolder);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Included Objects Must Be Static", GUILayout.Width(200));
            generate_IncludeStaticObjects = EditorGUILayout.Toggle(GUIContent.none, generate_IncludeStaticObjects);
            EditorGUILayout.EndHorizontal();
            generate_LightmapOption = (LightMapOption)EditorGUILayout.EnumPopup("Lightmapping", generate_LightmapOption);
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Generate Mesh Bakers"))
            {
                listMaterialsInScene(true);
            }
            if (GUILayout.Button("Bake Every MeshBaker In Scene"))
            {
                try{
                    MB3_TextureBaker[] texBakers = (MB3_TextureBaker[])FindObjectsOfType(typeof(MB3_TextureBaker));
                    for (int i = 0; i < texBakers.Length; i++)
                    {
                        texBakers[i].CreateAtlases(updateProgressBar, true, new MB3_EditorMethods());
                    }
                    MB3_MeshBaker[] mBakers = (MB3_MeshBaker[])FindObjectsOfType(typeof(MB3_MeshBaker));
                    for (int i = 0; i < mBakers.Length; i++)
                    {
                        if (mBakers[i].textureBakeResults != null)
                        {
                            MB3_MeshBakerEditorFunctions.BakeIntoCombined(mBakers[i]);
                        }
                    }
                } catch (Exception e) {
                    Debug.LogError(e);
                }finally{
                    EditorUtility.ClearProgressBar();
                }
            }
            EditorGUILayout.EndHorizontal();
        }
        MB_EditorUtil.DrawSeparator();
        EditorGUILayout.Separator();

        EditorGUILayout.LabelField("Add Selected Meshes To Bakers", EditorStyles.boldLabel);
        EditorGUILayout.HelpBox("Select one or more objects in the hierarchy view. Child Game Objects with MeshRender will be added. Use the fields below to filter what is added.", UnityEditor.MessageType.None);
        target = (MB3_MeshBakerRoot)EditorGUILayout.ObjectField("Target to add objects to", target, typeof(MB3_MeshBakerRoot), true);

        if (target != null)
        {
            targetGO = target.gameObject;
        }
        else
        {
            targetGO = null;
        }

        if (targetGO != oldTargetGO)
        {
            textureBaker = targetGO.GetComponent <MB3_TextureBaker>();
            meshBaker    = targetGO.GetComponent <MB3_MeshBaker>();
            tbe          = new MB3_TextureBakerEditorInternal();
            mbe          = new MB3_MeshBakerEditorInternal();
            oldTargetGO  = targetGO;
        }

        onlyStaticObjects = EditorGUILayout.Toggle("Only Static Objects", onlyStaticObjects);

        onlyEnabledObjects = EditorGUILayout.Toggle("Only Enabled Objects", onlyEnabledObjects);

        excludeMeshesWithOBuvs = EditorGUILayout.Toggle("Exclude meshes with out-of-bounds UVs", excludeMeshesWithOBuvs);

        mat       = (Material)EditorGUILayout.ObjectField("Using Material", mat, typeof(Material), true);
        shaderMat = (Material)EditorGUILayout.ObjectField("Using Shader", shaderMat, typeof(Material), true);

        string[] lightmapDisplayValues = new string[257];
        int[]    lightmapValues        = new int[257];
        lightmapValues[0]        = -2;
        lightmapValues[1]        = -1;
        lightmapDisplayValues[0] = "don't filter on lightmapping";
        lightmapDisplayValues[1] = "not lightmapped";
        for (int i = 2; i < lightmapDisplayValues.Length; i++)
        {
            lightmapDisplayValues[i] = "" + i;
            lightmapValues[i]        = i;
        }
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Using Lightmap Index ");
        lightmapIndex = EditorGUILayout.IntPopup(lightmapIndex,
                                                 lightmapDisplayValues,
                                                 lightmapValues);
        EditorGUILayout.EndHorizontal();

        if (GUILayout.Button("Add Selected Meshes"))
        {
            addSelectedObjects();
        }

        /*
         * if (GUILayout.Button("Add LOD To Selected")){
         *      addLODToSelected();
         * }
         *
         * if (GUILayout.Button("Remove LOD From All")){
         *      LODInternal[] lods = (LODInternal[]) FindObjectsOfType(typeof(LODInternal));
         *      for (int i = 0; i < lods.Length; i++){
         *              DestroyImmediate(lods[i]);
         *      }
         * }
         */

        if (textureBaker != null)
        {
            MB_EditorUtil.DrawSeparator();
            tbFoldout = EditorGUILayout.Foldout(tbFoldout, "Texture Baker");
            if (tbFoldout)
            {
                tbe.DrawGUI((MB3_TextureBaker)textureBaker, typeof(MB3_MeshBakerEditorWindow));
            }
        }
        if (meshBaker != null)
        {
            MB_EditorUtil.DrawSeparator();
            mbFoldout = EditorGUILayout.Foldout(mbFoldout, "Mesh Baker");
            if (mbFoldout)
            {
                mbe.DrawGUI((MB3_MeshBaker)meshBaker, typeof(MB3_MeshBakerEditorWindow));
            }
        }
        EditorGUILayout.EndScrollView();
    }
コード例 #5
0
    void OnGUI()
    {
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height));

        EditorGUILayout.HelpBox("List shaders in scene prints a report to the console of shaders and which objects use them. This is useful for grouping objects to be combined. SkinnedMeshRenderers are ignored.", UnityEditor.MessageType.None);
        if (GUILayout.Button("List Shaders In Scene"))
        {
            listMaterialsInScene();
        }

        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.HelpBox("Select one or more objects in the hierarchy view. Child Game Objects with MeshRender will be added. Use the fields below to filter what is added.", UnityEditor.MessageType.None);
        target = (MB2_MeshBakerRoot)EditorGUILayout.ObjectField("Target to add objects to", target, typeof(MB2_MeshBakerRoot), true);

        if (target != null)
        {
            targetGO = target.gameObject;
        }
        else
        {
            targetGO = null;
        }

        if (targetGO != oldTargetGO)
        {
            textureBaker = targetGO.GetComponent <MB2_TextureBaker>();
            meshBaker    = targetGO.GetComponent <MB2_MeshBaker>();
            tbe          = new MB2_TextureBakerEditorInternal();
            mbe          = new MB2_MeshBakerEditorInternal();
            oldTargetGO  = targetGO;
        }

        onlyStaticObjects = EditorGUILayout.Toggle("Only Static Objects", onlyStaticObjects);

        mat       = (Material)EditorGUILayout.ObjectField("Using Material", mat, typeof(Material), true);
        shaderMat = (Material)EditorGUILayout.ObjectField("Using Shader", shaderMat, typeof(Material), true);

        if (GUILayout.Button("Add Selected Meshes"))
        {
            addSelectedObjects();
        }

        if (textureBaker != null)
        {
            MB_EditorUtil.DrawSeparator();
            tbFoldout = EditorGUILayout.Foldout(tbFoldout, "Texture Baker");
            if (tbFoldout)
            {
                tbe.DrawGUI((MB2_TextureBaker)textureBaker);
            }
        }
        if (meshBaker != null)
        {
            MB_EditorUtil.DrawSeparator();
            mbFoldout = EditorGUILayout.Foldout(mbFoldout, "Mesh Baker");
            if (mbFoldout)
            {
                mbe.DrawGUI((MB2_MeshBaker)meshBaker);
            }
        }
        EditorGUILayout.EndScrollView();
    }
コード例 #6
0
    public override void OnInspectorGUI()
    {
        meshBaker.Update();

        showInstructions = EditorGUILayout.Foldout(showInstructions, "Instructions:");
        if (showInstructions)
        {
            EditorGUILayout.HelpBox("1. Create empty assets for result materials and (if needed) result prefab.\n\n" +
                                    "2. Select shader on result materials.\n\n" +
                                    "3. Add scene objects or prefabs to combine. For best results these should use the same shader as result material.\n\n" +
                                    "4. Select an output option.\n\n" +
                                    "5. Bake objects.\n\n" +
                                    "6. Look at warnings/errors in console. Decide if action needs to be taken.\n\n" +
                                    "5. Use the combined/adjusted meshes.\n\n" +
                                    "7. (optional) Disable renderers in source objects.\n\n" +
                                    "8. (optional) Remove the MeshBaker object. You may want to keep it for easy re-baking if something changes in the source objects.", UnityEditor.MessageType.None);

            EditorGUILayout.Separator();
        }

        MB_MeshBaker mom = (MB_MeshBaker)target;

        EditorGUILayout.LabelField("Options", EditorStyles.boldLabel);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PropertyField(fixOutOfBoundsUVs, fixOutOfBoundsGUIContent);
        EditorGUILayout.PropertyField(doMultiMaterial, new GUIContent("Multiple Combined Materials"));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.PropertyField(atlasPadding, new GUIContent("Atlas Padding"));
        EditorGUILayout.PropertyField(resizePowerOfTwoTextures, resizePowerOfTwoGUIContent);
        EditorGUILayout.PropertyField(customShaderPropNames, customShaderPropertyNamesGUIContent, true);

        if (mom.doMultiMaterial)
        {
            MB_EditorUtil.DrawSeparator();
            EditorGUILayout.LabelField("Source Material To Combined Mapping", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            resultMaterialsFoldout = EditorGUILayout.Foldout(resultMaterialsFoldout, combinedMaterialsGUIContent);
            if (GUILayout.Button(insertContent, EditorStyles.miniButtonLeft, buttonWidth))
            {
                if (resultMaterials.arraySize == 0)
                {
                    mom.resultMaterials = new MB_MultiMaterial[1];
                }
                else
                {
                    resultMaterials.InsertArrayElementAtIndex(resultMaterials.arraySize - 1);
                }
            }
            if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
            {
                resultMaterials.DeleteArrayElementAtIndex(resultMaterials.arraySize - 1);
            }
            EditorGUILayout.EndHorizontal();
            if (resultMaterialsFoldout)
            {
                for (int i = 0; i < resultMaterials.arraySize; i++)
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.LabelField("---------- submesh:" + i);
                    EditorGUILayout.Separator();
                    SerializedProperty resMat = resultMaterials.GetArrayElementAtIndex(i);
                    EditorGUILayout.PropertyField(resMat.FindPropertyRelative("combinedMaterial"));
                    SerializedProperty sourceMats = resMat.FindPropertyRelative("sourceMaterials");
                    EditorGUILayout.PropertyField(sourceMats, true);
                }
            }
        }
        else
        {
            MB_EditorUtil.DrawSeparator();
            EditorGUILayout.LabelField("Combined Material", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(resultMaterial, new GUIContent("Combined Mesh Material"));
        }

        MB_EditorUtil.DrawSeparator();
        EditorGUILayout.LabelField("Objects To Be Combined", EditorStyles.boldLabel);
        if (GUILayout.Button(openToolsWindowLabelContent))
        {
            MB_MeshBakerEditorWindow mmWin = (MB_MeshBakerEditorWindow)EditorWindow.GetWindow(typeof(MB_MeshBakerEditorWindow));
            mmWin.target = (MB_MeshBaker)target;
        }
        EditorGUILayout.PropertyField(objsToMesh, new GUIContent("Objects To Be Combined"), true);
        MB_EditorUtil.DrawSeparator();

        EditorGUILayout.Separator();
        mom.resultPrefab = (GameObject)EditorGUILayout.ObjectField("Combined Mesh Prefab", mom.resultPrefab, typeof(GameObject), false);
        EditorGUILayout.PropertyField(outputOption, outputOptionGUIContent);
        if (GUILayout.Button("Bake"))
        {
            if (mom.outputOption == MB_OutputOptions.bakeIntoPrefab)
            {
                bakeMeshesIntoPrefab();
            }
            else if (mom.outputOption == MB_OutputOptions.bakeMeshsInPlace)
            {
                bakeMeshesInPlace();
            }
            else if (mom.outputOption == MB_OutputOptions.bakeTextureAtlasesOnly)
            {
                bakeTexturesOnly();
            }
        }
        EditorGUILayout.Separator();


        MB_EditorUtil.DrawSeparator();
        EditorGUILayout.LabelField("Utilities", EditorStyles.boldLabel);
        if (GUILayout.Button(createPrefabAndMaterialLabelContent))
        {
            string newPrefabPath = EditorUtility.SaveFilePanelInProject("Prefab name", "", "prefab", "Enter a name for the combined mesh prefab");
            if (newPrefabPath != null)
            {
                createNewPrefab(newPrefabPath);
            }
        }
        string enableRenderersLabel;

        if (mom.disableSourceRenderers)
        {
            enableRenderersLabel = "Disable Renderers On Combined Objects";
        }
        else
        {
            enableRenderersLabel = "Enable Renderers On Combined Objects";
        }
        if (GUILayout.Button(enableRenderersLabel))
        {
            mom.disableSourceRenderers = !mom.disableSourceRenderers;
            mom.EnableDisableSourceObjectRenderers(mom.disableSourceRenderers);
        }
        meshBaker.ApplyModifiedProperties();
    }