internal static void Draw()
        {
            GEditorSettings.WizardToolsSettings settings = GEditorSettings.Instance.wizardTools;
            if (bulkSetShader)
            {
                settings.setShaderGroupId = GEditorCommon.ActiveTerrainGroupPopupWithAllOption("Group Id", settings.setShaderGroupId);
            }
            else
            {
                settings.setShaderTerrain = EditorGUILayout.ObjectField("Terrain", settings.setShaderTerrain, typeof(GStylizedTerrain), true) as GStylizedTerrain;
            }
            GWizardEditorCommon.DrawMaterialSettingsGUI();

            if (GUILayout.Button("Set"))
            {
                if (bulkSetShader)
                {
                    GWizard.SetShader(settings.setShaderGroupId);
                }
                else
                {
                    GWizard.SetShader(settings.setShaderTerrain);
                }
            }
        }
Beispiel #2
0
        private static void DrawCreateTerrainsGUI()
        {
            string label = "1. Create Terrains";
            string id    = "wizard-create-terrains";

            GEditorCommon.Foldout(label, true, id, () =>
            {
                GEditorSettings.WizardToolsSettings settings = GEditorSettings.Instance.wizardTools;

                GEditorCommon.Header("Physical");

                GUIContent originLabel = new GUIContent(
                    "Origin", "Position of the first terrain in the grid.");
                settings.origin = GEditorCommon.InlineVector3Field(originLabel, settings.origin);

                GUIContent tileSizeLabel = new GUIContent(
                    "Tile Size", "Size of each terrain tile in world space.");
                settings.tileSize = GEditorCommon.InlineVector3Field(tileSizeLabel, settings.tileSize);
                settings.tileSize = new Vector3(
                    Mathf.Max(1, settings.tileSize.x),
                    Mathf.Max(1, settings.tileSize.y),
                    Mathf.Max(1, settings.tileSize.z));

                GUIContent tileXLabel = new GUIContent(
                    "Tile Count X", "Number of tiles along X-axis.");
                settings.tileCountX = EditorGUILayout.IntField(tileXLabel, settings.tileCountX);
                settings.tileCountX = Mathf.Max(1, settings.tileCountX);

                GUIContent tileZLabel = new GUIContent(
                    "Tile Count Z", "Number of tiles along Z-axis.");
                settings.tileCountZ = EditorGUILayout.IntField(tileZLabel, settings.tileCountZ);
                settings.tileCountZ = Mathf.Max(1, settings.tileCountZ);

                GEditorCommon.Header("Material");
                GWizardEditorCommon.DrawMaterialSettingsGUI();

                GEditorCommon.Header("Utilities");

                GUIContent namePrefixLabel = new GUIContent(
                    "Name Prefix",
                    "The beginning of each terrain's name. Useful for some level streaming system.");
                settings.terrainNamePrefix = EditorGUILayout.TextField(namePrefixLabel, settings.terrainNamePrefix);

                GUIContent groupIdLabel = new GUIContent(
                    "Group Id",
                    "An integer for grouping and connecting adjacent terrain tiles.");
                settings.groupId = EditorGUILayout.IntField(groupIdLabel, settings.groupId);

                GEditorCommon.Header("Data");

                GUIContent directoryLabel = new GUIContent(
                    "Directory",
                    "Where to store created terrain data. A sub-folder of Assets/ is recommended.");
                string dir = settings.dataDirectory;
                GEditorCommon.BrowseFolder(directoryLabel, ref dir);
                if (string.IsNullOrEmpty(dir))
                {
                    dir = "Assets/";
                }
                settings.dataDirectory = dir;

                if (GUILayout.Button("Create"))
                {
                    GameObject environmentRoot = null;
                    if (menuCmd != null && menuCmd.context != null)
                    {
                        environmentRoot = menuCmd.context as GameObject;
                    }
                    if (environmentRoot == null)
                    {
                        environmentRoot = new GameObject("Low Poly Environment");
                        environmentRoot.transform.position = settings.origin;
                    }
                    GWizard.CreateTerrains(environmentRoot);
                }
            });
        }