Beispiel #1
0
 public override string ToString()
 {
     return
         ($"```Prefix: {Prefix}\n" +
          $"Cam Timer: {CamTimer.ToString()}\n" +
          $"Blur Amount: {BlurAmount.ToString(CultureInfo.InvariantCulture)}\n" +
          $"TTS: {TtsEnabled.ToString()}\n" +
          $"Webcam: {CamEnabled.ToString()}\n" +
          $"Screenshots: {SsEnabled.ToString()}\n" +
          $"PlaySounds: {PlayEnabled.ToString()}\n" +
          $"Processes: {ProcessesEnabled}\n" +
          $"Timeout: {Timeout.ToString(CultureInfo.InvariantCulture)}\n" +
          $"Folder: {FolderPath}```");
 }
Beispiel #2
0
        public override void Draw(BaseScreen.Resources screenResources, SmartSpriteBatch spriteBatch, ScreenAbstractor screen, float opacity, FloatRectangle?clip = null, Texture2D bgTexture = null, Vector2?scrollOffset = null)
        {
            if (clip.HasValue && ParentPosition.HasValue)
            {
                clip = clip.Value.ConstrainTo(ParentPosition.Value);
            }

            clip = screen.Translate(clip);

            var t = Position.Value();

            FloatRectangle tmp = screen.Translate(ActualPosition.AdjustForMargin(Margin)).Value;

            if (clip.HasValue)
            {
                if (tmp.Right < clip.Value.X || tmp.X > clip.Value.Right)
                {
                    return;
                }
            }

            if (BlurAmount.Value() > 0)
            {
                Solids.GaussianBlur.DoBlur(bgTexture, BlurAmount.Value(), (BackgroundColor.Value().Value *opacity) * ((BlurAmount.Value() / Solids.MaxBlur)), tmp.ToRectangle, ScissorRect, clip, NoisePerc.Value());
            }

            if (BackgroundColor.Value().HasValue&& FillTexture.Value() == null)
            {
                spriteBatch.DrawSolidRectangle(tmp, BackgroundColor.Value().Value *opacity, clip);
            }

            if (FillTexture.Value() != null)
            {
                using (new SmartSpriteBatchManager(Solids.Instance.SpriteBatch))
                {
                    spriteBatch.DrawTexturedRectangle(tmp, BackgroundColor.Value().Value *opacity, Solids.Instance.AssetLibrary.GetTexture(FillTexture.Value()), TilingMode.Value, clip);
                }
            }

            if (BrushSize.Value() > 0)
            {
                spriteBatch.DrawBorder(tmp, BorderColor.Value() * opacity, BrushSize.Value(), clip);
            }

            this.ActualSize = new Vector2(Position.Value().Width, Position.Value().Height).PadForMargin(Margin);

            SetChildrenOriginToMyOrigin();
        }
Beispiel #3
0
    public void OnGUI()
    {
        EditorGUI.DrawPreviewTexture(new Rect(10, 10, 280, 60), WorldIcon);
        GUILayout.BeginArea(new Rect(10, 70, 280, 120));
        if (Selection.gameObjects.Length > 0)
        {
            SourceGOs = Selection.gameObjects;

            if (isRootSelected() == false)
            {
                HelpMessage = "Mesh conversion will only work properly if the root of all selected prefabs are selected. Do not select children.";
            }
            else
            {
                HelpMessage = "Brighten by Color adds the color to the final vertex colors of all selected GameObjects. Use the Color swatch in the material change the color as well. Combine Materials will apply one new material to the each new prefab. Alternate Coloring applies Bilinear Filtering. Blur Amount selects a mipmap within the diffuse texture chain.";

                if (SourceGOs.Length == 1)
                {
                    GUILayout.Label("GameObject Selected: " + SourceGOs[0].name);
                }
                else
                {
                    GUILayout.Label("GameObject Selected: Multiple");
                }
                brightenColor = EditorGUILayout.ColorField("Brighten by Color: ", brightenColor, null);
                //combineMats = EditorGUILayout.Toggle("Combine Materials", combineMats);
                filterBilinear = EditorGUILayout.Toggle("Alternate Coloring", filterBilinear);
                blurAmount     = (BlurAmount)EditorGUILayout.EnumPopup("Blur Amount: ", blurAmount);

                if (GUILayout.Button("Convert to PolyWorld Mesh"))
                {
                    List <GameObject> badGOs       = new List <GameObject>(); //stores a list of selected gameobjects that have no mesh. Just for error checking.
                    List <string>     badMeshNames = CheckTriLimit(SourceGOs);
                    List <string>     badMats      = CheckMaterials(SourceGOs);
                    List <string>     badTerrains  = CheckforTerrain(SourceGOs);
                    List <string>     notPrefab    = CheckforPrefab(SourceGOs);

                    if (badMats.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Material Warning", "Some shaders assigned to the selected meshes don't use the _MainTex and/or _Color variable name.To fix, switch these materials to use the standard Diffuse shader.\n\nCheck the Console for the material names.", "OK");
                        foreach (string s in badMats)
                        {
                            Debug.LogError("The shader assigned to the material named " + s + " does not use the _MainTex and/or _Color variable. To fix, switch it to the standard Diffuse shader.");
                        }
                    }
                    else if (badTerrains.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Terrains in Selection", "There is a terrain in the selection. This script will not convert terrains. Use the PolyWorld Terrain script located in Window->Quantum Theory->PolyWorld Terrain.", "OK");
                    }
                    else if (notPrefab.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Not a Prefab", "Some GameObjects in the selection are not a prefab. Create a prefab first, then run the conversion script.\n\nCheck the Console for the Gameobjects that are not prefabs.", "OK");
                        foreach (string s in notPrefab)
                        {
                            Debug.LogError("GameObject named " + s + " is not a prefab.");
                        }
                    }
                    else
                    {
                        if (badMeshNames.Count == 0)
                        {
                            foreach (GameObject g in SourceGOs)                                                                                     //for every GO you have selected
                            {
                                GameObject WorkingGO = (GameObject)(PrefabUtility.InstantiatePrefab((GameObject)PrefabUtility.GetPrefabParent(g))); //instantiate it and work on it.
                                WorkingGO.name = WorkingGO.name.Replace("(Clone)", "");
                                MeshRenderer[]        MRs  = WorkingGO.GetComponentsInChildren <MeshRenderer>(true);                                //get all the MR components in the children.
                                MeshFilter[]          MFs  = WorkingGO.GetComponentsInChildren <MeshFilter>(true);
                                SkinnedMeshRenderer[] SMRs = WorkingGO.GetComponentsInChildren <SkinnedMeshRenderer>(true);                         //get all the SMR components in the children.
                                //now get all the gameobjects with meshes in it
                                GameObject[] MeshGOs = GetMeshGOs(MRs, SMRs);
                                if (MeshGOs.Length > 0)
                                {
                                    ConvertMesh(WorkingGO, MeshGOs, MFs, MRs, SMRs);
                                }
                                else
                                {
                                    badGOs.Add(WorkingGO);
                                }
                                GameObject.DestroyImmediate(WorkingGO);
                            }
                            EditorUtility.ClearProgressBar();
                            EditorUtility.DisplayDialog("Conversion Complete", "Success! All new content is located in:\n\nAssets/-Faceted Meshes", "OK");
                        }
                        else
                        {
                            EditorUtility.DisplayDialog("Triangle Count Exceeded", "Meshes that exceed 21845 triangles have been found in this selection. Please either reduce the triangle count on the model, or break it apart into seperate meshes.\n\nThe debug console will now output which meshes are too high poly.\n\nConversion aborted.", "OK");
                            foreach (string s in badMeshNames)
                            {
                                Debug.LogWarning(s + " has too many triangles. Please reduce the triangle count or break it apart into seperate meshes.");
                            }
                        }
                    }
                    if (badGOs.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Meshes Not Found", "Some GameObjects in the selection had no meshes. Check the debug log. ", "OK");
                        foreach (GameObject g in badGOs)
                        {
                            Debug.LogWarning(g.name + " does not have a Mesh Filter or Skinned Mesh Filter, nor does it have children with these components, and did not get converted.");
                        }
                    }
                }
            }
        }
        else
        {
            HelpMessage = "In the Scene View, select the character or prop prefab that has a diffuse texture assigned to it. This script converts the prefab parent of the selected objects. Multiple objects are supported.";
        }

        GUILayout.EndArea();
        EditorGUI.HelpBox(new Rect(5, 185, 290, 95), HelpMessage, MessageType.Info);
    }
    public void OnGUI()
    {
        EditorGUI.DrawPreviewTexture(new Rect(10, 10, 280, 60), WorldIcon);
        GUILayout.BeginArea(new Rect(10, 70, 280, 220));
        if (Selection.gameObjects.Length > 0)
        {
            SourceGOs = Selection.gameObjects;

            if (isRootSelected() == false)
            {
                HelpMessage = "Mesh conversion will only work properly if the root of all selected prefabs is selected. Do not select children.";
            }
            else
            {
                HelpMessage = "Brighten by Color adds the color to the final vertex colors of all selected GameObjects. Use the Color swatch in the material change the color as well. Combine Materials will apply one new material to the each new prefab. Alternate Coloring applies Bilinear Filtering. Blur Amount selects a mipmap within the diffuse texture chain.";

                if (SourceGOs.Length == 1)
                {
                    GUILayout.Label("GameObject Selected: " + SourceGOs[0].name);
                }
                else
                {
                    GUILayout.Label("GameObject Selected: Multiple");
                }
                brightenColor  = EditorGUILayout.ColorField("Brighten by Color: ", brightenColor, null);
                blurAmount     = (BlurAmount)EditorGUILayout.EnumPopup("Blur: ", blurAmount);
                filterBilinear = EditorGUILayout.Toggle("Alternate Coloring", filterBilinear);

                EditorGUILayout.Separator();

                EditorGUILayout.BeginHorizontal();
                GUILayout.Label("Export Folder:");

                //make the string fit..

                if (exportAssetFolder.Length >= 13)
                {
                    tempExportFolder = exportAssetFolder.Remove(11, exportAssetFolder.Length - 11) + "..";
                }
                else
                {
                    tempExportFolder = exportAssetFolder;
                }
                GUILayout.TextArea(tempExportFolder, 13);
                if (GUILayout.Button("..."))
                {
                    exportWindowsFolder = EditorUtility.SaveFolderPanel("Export Data", exportAssetFolder, "");
                    exportAssetFolder   = exportWindowsFolder.Replace(Application.dataPath, "Assets");
                    if (exportAssetFolder.Equals(""))
                    {
                        exportAssetFolder = "Assets";
                    }
                    else if (!exportAssetFolder.Contains("Assets"))
                    {
                        exportAssetFolder = "Assets";
                    }
                    AssetDatabase.Refresh();
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label("Suffix:");
                meshSuffix = GUILayout.TextField(meshSuffix, 10);


                EditorGUILayout.EndHorizontal();
                overwriteMeshes = EditorGUILayout.Toggle("Overwrite Exported Data", overwriteMeshes);
                recalcLMUVs     = EditorGUILayout.Toggle("Recalculate Lightmap UVs", recalcLMUVs);

                if (GUILayout.Button("Convert to PolyWorld Mesh"))
                {
                    List <GameObject> badGOs       = new List <GameObject>(); //stores a list of selected gameobjects that have no mesh. Just for error checking.
                    List <string>     badMeshNames = CheckTriLimit(SourceGOs);
                    List <string>     badMats      = CheckMaterials(SourceGOs);
                    List <string>     badTerrains  = CheckforTerrain(SourceGOs);
                    List <string>     notPrefab    = CheckforPrefab(SourceGOs);

                    if (exportAssetFolder.Equals("Assets"))
                    {
                        EditorUtility.DisplayDialog("Invalid Folder", "Please do not export data into the root assets folder. Create a subfolder and export into that.", "OK");
                    }
                    else if (badMats.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Materials Error", "Material verification failed. Please check the debug console window for details.\n\nAborting.", "OK");
                    }
                    else if (badTerrains.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Terrains in Selection", "There is a terrain in the selection. This script will not convert terrains. Use the PolyWorld Terrain script located in Window->Quantum Theory->PolyWorld Terrain.", "OK");
                    }
                    else if (notPrefab.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Not a Prefab", "Some GameObjects in the selection are not a prefab. Create a prefab first, then run the conversion script.\n\nCheck the Console for the Gameobjects that are not prefabs.", "OK");
                        foreach (string s in notPrefab)
                        {
                            Debug.LogError("GameObject named " + s + " is not a prefab.");
                        }
                    }
                    else
                    {
                        if (badMeshNames.Count == 0)
                        {
                            foreach (GameObject g in SourceGOs)                                                                                     //for every GO you have selected
                            {
                                GameObject WorkingGO = (GameObject)(PrefabUtility.InstantiatePrefab((GameObject)PrefabUtility.GetPrefabParent(g))); //instantiate it and work on it.
                                WorkingGO.name = WorkingGO.name.Replace("(Clone)", "");
                                MeshRenderer[]        MRs  = WorkingGO.GetComponentsInChildren <MeshRenderer>(true);                                //get all the MR components in the children.
                                MeshFilter[]          MFs  = WorkingGO.GetComponentsInChildren <MeshFilter>(true);
                                SkinnedMeshRenderer[] SMRs = WorkingGO.GetComponentsInChildren <SkinnedMeshRenderer>(true);                         //get all the SMR components in the children.
                                //now get all the gameobjects with meshes in it
                                GameObject[] MeshGOs = GetMeshGOs(MRs, SMRs);
                                if (MeshGOs.Length > 0)
                                {
                                    ConvertMesh(WorkingGO, MeshGOs, MFs, MRs, SMRs);
                                }
                                else
                                {
                                    badGOs.Add(WorkingGO);
                                }
                                GameObject.DestroyImmediate(WorkingGO);
                            }
                            EditorUtility.ClearProgressBar();
                            EditorUtility.DisplayDialog("Conversion Complete", "Success! All new content is located in:\n" + exportAssetFolder, "OK");
                        }
                        else
                        {
                            EditorUtility.DisplayDialog("Triangle Count Exceeded", "Meshes that exceed 21845 triangles have been found in this selection. Please either reduce the triangle count on the model, or break it apart into seperate meshes.\n\nThe debug console will now output which meshes are too high poly.\n\nConversion aborted.", "OK");
                            foreach (string s in badMeshNames)
                            {
                                Debug.LogWarning(s + " has too many triangles. Please reduce the triangle count or break it apart into seperate meshes.");
                            }
                        }
                    }
                    if (badGOs.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Meshes Not Found", "Some GameObjects in the selection had no meshes. Check the debug log. ", "OK");
                        foreach (GameObject g in badGOs)
                        {
                            Debug.LogWarning(g.name + " does not have a Mesh Filter or Skinned Mesh Filter, nor does it have children with these components, and did not get converted.");
                        }
                    }
                }
                if (GUILayout.Button("Help"))
                {
                    Application.OpenURL("http://qt-ent.com/PolyWorld-Woodland/scripts/");
                }
            }
            GUILayout.EndArea();
        }
        else
        {
            GUILayout.EndArea();
            HelpMessage = "In the Scene View, select the character or prop prefab that has a diffuse texture assigned to it. This script converts the prefab parent of the selected objects. Multiple objects are supported.";
            EditorGUI.HelpBox(new Rect(10, 115, 280, 60), HelpMessage, MessageType.Info);
        }
    }
    public void OnGUI()
    {
        EditorGUI.DrawPreviewTexture(new Rect(10, 10, 280, 60), WorldIcon);
        GUILayout.BeginArea(new Rect(10, 70, 280, 220));
        if (Selection.gameObjects.Length > 0)
        {
            SourceGOs = Selection.gameObjects;

            if (isRootSelected() == false)
                HelpMessage = "Mesh conversion will only work properly if the root of all selected prefabs is selected. Do not select children.";
            else
            {
                HelpMessage = "Brighten by Color adds the color to the final vertex colors of all selected GameObjects. Use the Color swatch in the material change the color as well. Combine Materials will apply one new material to the each new prefab. Alternate Coloring applies Bilinear Filtering. Blur Amount selects a mipmap within the diffuse texture chain.";

                if (SourceGOs.Length == 1)
                    GUILayout.Label("GameObject Selected: " + SourceGOs[0].name);
                else
                    GUILayout.Label("GameObject Selected: Multiple");
                brightenColor = EditorGUILayout.ColorField("Brighten by Color: ", brightenColor, null);
                blurAmount = (BlurAmount)EditorGUILayout.EnumPopup("Blur: ", blurAmount);
                filterBilinear = EditorGUILayout.Toggle("Alternate Coloring", filterBilinear);

                EditorGUILayout.Separator();

                EditorGUILayout.BeginHorizontal();
                GUILayout.Label("Export Folder:");

                //make the string fit..

                if (exportAssetFolder.Length >= 13)
                    tempExportFolder = exportAssetFolder.Remove(11, exportAssetFolder.Length - 11) + "..";
                else
                    tempExportFolder = exportAssetFolder;
                GUILayout.TextArea(tempExportFolder, 13);
                if (GUILayout.Button("..."))
                {
                    exportWindowsFolder = EditorUtility.SaveFolderPanel("Export Data", exportAssetFolder, "");
                    exportAssetFolder = exportWindowsFolder.Replace(Application.dataPath, "Assets");
                    if (exportAssetFolder.Equals(""))
                        exportAssetFolder = "Assets";
                    else if (!exportAssetFolder.Contains("Assets"))
                        exportAssetFolder = "Assets";
                    AssetDatabase.Refresh();
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label("Suffix:");
                meshSuffix = GUILayout.TextField(meshSuffix, 10);

                EditorGUILayout.EndHorizontal();
                overwriteMeshes = EditorGUILayout.Toggle("Overwrite Exported Data", overwriteMeshes);
                recalcLMUVs = EditorGUILayout.Toggle("Recalculate Lightmap UVs", recalcLMUVs);
                combineSubMeshes = EditorGUILayout.Toggle("Combine SubMeshes", combineSubMeshes);

                if (GUILayout.Button("Convert to PolyWorld Mesh"))
                {

                    List<GameObject> badGOs = new List<GameObject>(); //stores a list of selected gameobjects that have no mesh. Just for error checking.
                    List<string> badMeshNames = CheckTriLimit(SourceGOs);
                    List<string> badMats = CheckMaterials(SourceGOs);
                    List<string> badTerrains = CheckforTerrain(SourceGOs);
                    List<string> notPrefab = CheckforPrefab(SourceGOs);

                    if (exportAssetFolder.Equals("Assets"))
                        EditorUtility.DisplayDialog("Invalid Folder", "Please do not export data into the root assets folder. Create a subfolder and export into that.", "OK");
                    else if (badMats.Count > 0)
                        EditorUtility.DisplayDialog("Materials Error", "Material verification failed. Please check the debug console window for details.\n\nAborting.", "OK");
                    else if (badTerrains.Count > 0)
                        EditorUtility.DisplayDialog("Terrains in Selection", "There is a terrain in the selection. This script will not convert terrains. Use the PolyWorld Terrain script located in Window->Quantum Theory->PolyWorld Terrain.", "OK");
                    else if (notPrefab.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Not a Prefab", "Some GameObjects in the selection are not a prefab. Create a prefab first, then run the conversion script.\n\nCheck the Console for the Gameobjects that are not prefabs.", "OK");
                        foreach (string s in notPrefab)
                            Debug.LogError("GameObject named " + s + " is not a prefab.");
                    }
                    else
                    {
                        if (badMeshNames.Count == 0)
                        {

                            foreach (GameObject g in SourceGOs) //for every GO you have selected
                            {
                                GameObject WorkingGO = (GameObject)(PrefabUtility.InstantiatePrefab((GameObject)PrefabUtility.GetPrefabParent(g)));//instantiate it and work on it.
                                WorkingGO.name = WorkingGO.name.Replace("(Clone)", "");
                                MeshRenderer[] MRs = WorkingGO.GetComponentsInChildren<MeshRenderer>(true); //get all the MR components in the children.
                                MeshFilter[] MFs = WorkingGO.GetComponentsInChildren<MeshFilter>(true);
                                SkinnedMeshRenderer[] SMRs = WorkingGO.GetComponentsInChildren<SkinnedMeshRenderer>(true);//get all the SMR components in the children.
                                //now get all the gameobjects with meshes in it
                                GameObject[] MeshGOs = GetMeshGOs(MRs, SMRs);
                                if (MeshGOs.Length > 0)
                                    ConvertMesh(WorkingGO, MeshGOs, MFs, MRs, SMRs);
                                else
                                    badGOs.Add(WorkingGO);
                                GameObject.DestroyImmediate(WorkingGO);
                            }
                            EditorUtility.ClearProgressBar();
                            EditorUtility.DisplayDialog("Conversion Complete", "Success! All new content is located in:\n" + exportAssetFolder, "OK");

                       }
                        else
                        {
                            EditorUtility.DisplayDialog("Vertex Count Exceeded", "After conversion, the vertex count for certain meshes in the selection will exceed the amount allowed by Unity (65536). Please either reduce the triangle count on the model, or break it apart into seperate meshes.\n\nThe debug console will now output which meshes are too high poly.\n\nConversion aborted.", "OK");
                            foreach (string s in badMeshNames)
                                Debug.LogWarning(s + " has too many vertices\t. Please reduce the triangle count or break it apart into seperate meshes.");

                        }
                    }
                    if (badGOs.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Meshes Not Found", "Some GameObjects in the selection had no meshes. Check the debug log. ", "OK");
                        foreach (GameObject g in badGOs)
                            Debug.LogWarning(g.name + " does not have a Mesh Filter or Skinned Mesh Filter, nor does it have children with these components, and did not get converted.");
                    }
                }
                if (GUILayout.Button("Help"))
                    Application.OpenURL("http://qt-ent.com/PolyWorld/scripts/");
            }
            GUILayout.EndArea();
        }
        else
        {
            GUILayout.EndArea();
            HelpMessage = "In the Scene View, select the character or prop prefab that has a diffuse texture assigned to it. This script converts the prefab parent of the selected objects. Multiple objects are supported.";
            EditorGUI.HelpBox(new Rect(10, 115, 280, 60), HelpMessage, MessageType.Info);
        }
    }
Beispiel #6
0
    public void OnGUI()
    {
        EditorGUI.DrawPreviewTexture(new Rect(10, 10, 280, 60), WorldIcon);
        GUILayout.BeginArea(new Rect(10, 70, 280, 120));
        if (Selection.gameObjects.Length > 0)
        {
            SourceGOs = Selection.gameObjects;

            if (isRootSelected()==false)
                HelpMessage = "Mesh conversion will only work properly if the root of all selected prefabs are selected. Do not select children.";
            else
            {
                HelpMessage = "Brighten by Color adds the color to the final vertex colors of all selected GameObjects. Use the Color swatch in the material change the color as well. Combine Materials will apply one new material to the each new prefab. Alternate Coloring applies Bilinear Filtering. Blur Amount selects a mipmap within the diffuse texture chain.";

                if (SourceGOs.Length == 1)
                    GUILayout.Label("GameObject Selected: " + SourceGOs[0].name);
                else
                    GUILayout.Label("GameObject Selected: Multiple");
                brightenColor = EditorGUILayout.ColorField("Brighten by Color: ", brightenColor, null);
                //combineMats = EditorGUILayout.Toggle("Combine Materials", combineMats);
                filterBilinear = EditorGUILayout.Toggle("Alternate Coloring", filterBilinear);
                blurAmount = (BlurAmount)EditorGUILayout.EnumPopup("Blur Amount: ", blurAmount);

                if (GUILayout.Button("Convert to PolyWorld Mesh"))
                {

                    List<GameObject> badGOs = new List<GameObject>(); //stores a list of selected gameobjects that have no mesh. Just for error checking.
                    List<string> badMeshNames = CheckTriLimit(SourceGOs);
                    List<string> badMats = CheckMaterials(SourceGOs);
                    List<string> badTerrains = CheckforTerrain(SourceGOs);
                    List<string> notPrefab = CheckforPrefab(SourceGOs);

                    if (badMats.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Material Warning", "Some shaders assigned to the selected meshes don't use the _MainTex and/or _Color variable name.To fix, switch these materials to use the standard Diffuse shader.\n\nCheck the Console for the material names.", "OK");
                        foreach (string s in badMats)
                            Debug.LogError("The shader assigned to the material named " + s + " does not use the _MainTex and/or _Color variable. To fix, switch it to the standard Diffuse shader.");
                    }
                    else if (badTerrains.Count > 0)
                        EditorUtility.DisplayDialog("Terrains in Selection", "There is a terrain in the selection. This script will not convert terrains. Use the PolyWorld Terrain script located in Window->Quantum Theory->PolyWorld Terrain.", "OK");
                    else if (notPrefab.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Not a Prefab", "Some GameObjects in the selection are not a prefab. Create a prefab first, then run the conversion script.\n\nCheck the Console for the Gameobjects that are not prefabs.", "OK");
                        foreach (string s in notPrefab)
                            Debug.LogError("GameObject named " + s + " is not a prefab.");
                    }
                    else
                    {
                        if (badMeshNames.Count == 0)
                        {

                            foreach (GameObject g in SourceGOs) //for every GO you have selected
                            {
                                GameObject WorkingGO = (GameObject)(PrefabUtility.InstantiatePrefab((GameObject)PrefabUtility.GetPrefabParent(g)));//instantiate it and work on it.
                                WorkingGO.name = WorkingGO.name.Replace("(Clone)", "");
                                MeshRenderer[] MRs = WorkingGO.GetComponentsInChildren<MeshRenderer>(true); //get all the MR components in the children.
                                MeshFilter[] MFs = WorkingGO.GetComponentsInChildren<MeshFilter>(true);
                                SkinnedMeshRenderer[] SMRs = WorkingGO.GetComponentsInChildren<SkinnedMeshRenderer>(true);//get all the SMR components in the children.
                                //now get all the gameobjects with meshes in it
                                GameObject[] MeshGOs = GetMeshGOs(MRs, SMRs);
                                if (MeshGOs.Length > 0)
                                    ConvertMesh(WorkingGO, MeshGOs, MFs, MRs, SMRs);
                                else
                                    badGOs.Add(WorkingGO);
                                GameObject.DestroyImmediate(WorkingGO);
                            }
                            EditorUtility.ClearProgressBar();
                            EditorUtility.DisplayDialog("Conversion Complete", "Success! All new content is located in:\n\nAssets/-Faceted Meshes", "OK");

                        }
                        else
                        {
                            EditorUtility.DisplayDialog("Triangle Count Exceeded", "Meshes that exceed 21845 triangles have been found in this selection. Please either reduce the triangle count on the model, or break it apart into seperate meshes.\n\nThe debug console will now output which meshes are too high poly.\n\nConversion aborted.", "OK");
                            foreach (string s in badMeshNames)
                                Debug.LogWarning(s + " has too many triangles. Please reduce the triangle count or break it apart into seperate meshes.");

                        }
                    }
                    if (badGOs.Count > 0)
                    {
                        EditorUtility.DisplayDialog("Meshes Not Found", "Some GameObjects in the selection had no meshes. Check the debug log. ", "OK");
                        foreach (GameObject g in badGOs)
                            Debug.LogWarning(g.name + " does not have a Mesh Filter or Skinned Mesh Filter, nor does it have children with these components, and did not get converted.");
                    }
                }
            }
        }
        else
           HelpMessage="In the Scene View, select the character or prop prefab that has a diffuse texture assigned to it. This script converts the prefab parent of the selected objects. Multiple objects are supported.";

        GUILayout.EndArea();
        EditorGUI.HelpBox(new Rect(5, 185, 290,95), HelpMessage,MessageType.Info);
    }