Пример #1
0
        private static void DrawFoliageAndObjectSpawningGUI()
        {
            string label = "5. Foliage & Object Spawning";
            string id    = "wizard-foliage-object-spawning";

            GEditorCommon.Foldout(label, false, id, () =>
            {
                EditorGUILayout.LabelField("Select the workflow you prefer.", GEditorCommon.WordWrapLeftLabel);

                GEditorCommon.Header("Painting");
                EditorGUILayout.LabelField("Place trees, grasses and game objects by painting.", GEditorCommon.WordWrapLeftLabel);
                if (GUILayout.Button("Create Foliage Painter & Object Painter"))
                {
                    GFoliagePainter fPainter = GWizard.CreateFoliagePainter();
                    GObjectPainter oPainter  = GWizard.CreateObjectPainter();
                    EditorGUIUtility.PingObject(fPainter);
                    Selection.objects          = new GameObject[] { fPainter.gameObject, oPainter.gameObject };
                    Selection.activeGameObject = fPainter.gameObject;
                }

                GEditorCommon.Header("Stamping");
                EditorGUILayout.LabelField("Procedurally spawn trees, grasses and game objects using some rules such as height, normal vector and noise.", GEditorCommon.WordWrapLeftLabel);
                if (GUILayout.Button("Create Foliage Stamper & Object Stamper"))
                {
                    GFoliageStamper fStamper = GWizard.CreateFoliageStamper();
                    GObjectStamper oStamper  = GWizard.CreateObjectStamper();
                    EditorGUIUtility.PingObject(fStamper);
                    Selection.objects          = new GameObject[] { fStamper.gameObject, oStamper.gameObject };
                    Selection.activeGameObject = fStamper.gameObject;
                }
            });
        }
Пример #2
0
        private static void DrawTexturingGUI()
        {
            string label = "4. Texturing";
            string id    = "wizard-texturing";

            GEditorCommon.Foldout(label, false, id, () =>
            {
                EditorGUILayout.LabelField("Select the workflow you prefer.", GEditorCommon.WordWrapLeftLabel);

                GEditorCommon.Header("Painting");
                EditorGUILayout.LabelField("Use a set of painters for hand painting terrain color.", GEditorCommon.WordWrapLeftLabel);
                if (GUILayout.Button("Create Geometry - Texture Painter"))
                {
                    GTerrainTexturePainter painter = GWizard.CreateGeometryTexturePainter();
                    EditorGUIUtility.PingObject(painter.gameObject);
                    Selection.activeGameObject = painter.gameObject;
                }

                GEditorCommon.Header("Stamping");
                EditorGUILayout.LabelField("Use stamper to color the terrain procedurally with some rules such as height, normal vector and noise.", GEditorCommon.WordWrapLeftLabel);
                if (GUILayout.Button("Create Texture Stamper"))
                {
                    GTextureStamper stamper = GWizard.CreateTextureStamper();
                    EditorGUIUtility.PingObject(stamper.gameObject);
                    Selection.activeGameObject = stamper.gameObject;
                }
            });
        }
Пример #3
0
        private static void DrawSculptingGUI()
        {
            string label = "3. Sculpting";
            string id    = "wizard-sculpting";

            GEditorCommon.Foldout(label, false, id, () =>
            {
                EditorGUILayout.LabelField("Select the workflow you prefer.", GEditorCommon.WordWrapLeftLabel);

                GEditorCommon.Header("Painting");
                EditorGUILayout.LabelField("Use a set of painters for hand sculpting terrain shape.", GEditorCommon.WordWrapLeftLabel);
                if (GUILayout.Button("Create Geometry - Texture Painter"))
                {
                    GTerrainTexturePainter painter = GWizard.CreateGeometryTexturePainter();
                    EditorGUIUtility.PingObject(painter.gameObject);
                    Selection.activeGameObject = painter.gameObject;
                }

                GEditorCommon.Header("Stamping");
                EditorGUILayout.LabelField("Use grayscale textures to stamp mountains, plateaus, rivers, etc. and blend using some math operations.", GEditorCommon.WordWrapLeftLabel);
                if (GUILayout.Button("Create Geometry Stamper"))
                {
                    GGeometryStamper stamper = GWizard.CreateGeometryStamper();
                    EditorGUIUtility.PingObject(stamper.gameObject);
                    Selection.activeGameObject = stamper.gameObject;
                }
            });
        }
Пример #4
0
        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);
                }
            }
        }
Пример #5
0
        private static void DrawCreateSplineGUI()
        {
            string label = "6. Create Roads, Ramps, Rivers, etc.";
            string id    = "wizard-spline";

            GEditorCommon.Foldout(label, false, id, () =>
            {
                EditorGUILayout.LabelField("Use Spline Tool to paint roads, make ramps and riverbeds, etc.", GEditorCommon.WordWrapLeftLabel);
                if (GUILayout.Button("Create Spline Tool"))
                {
                    GSplineCreator spline = GWizard.CreateSplineTool();
                    EditorGUIUtility.PingObject(spline);
                    Selection.activeGameObject = spline.gameObject;
                }
            });
        }
Пример #6
0
        private static void DrawUtilitiesGUI()
        {
            string label = "8. Utilities";
            string id    = "wizard-utilities";

            GEditorCommon.Foldout(label, false, id, () =>
            {
                GEditorCommon.Header("Wind Zone");
                EditorGUILayout.LabelField("Adding Wind Zone to customize how grass react to wind in this level.");
                if (GUILayout.Button("Create Wind Zone"))
                {
                    GWindZone wind = GWizard.CreateWindZone();
                    EditorGUIUtility.PingObject(wind.gameObject);
                    Selection.activeGameObject = wind.gameObject;
                }
            });
        }
Пример #7
0
        private static void DrawTerrainsManagementGUI()
        {
            string label = "2. Terrains Management";
            string id    = "wizard-terrains-management";

            GEditorCommon.Foldout(label, false, id, () =>
            {
                EditorGUILayout.LabelField(
                    "Edit properties of an individual terrain by selecting it and use the Inspector.",
                    GEditorCommon.WordWrapLeftLabel);
                EditorGUILayout.LabelField(
                    string.Format("Use context menus ({0}) in the terrain Inspector to perform additional tasks.", GEditorCommon.contextIconText),
                    GEditorCommon.WordWrapLeftLabel);
                EditorGUILayout.LabelField(
                    "Use the Group Tool to edit properties of multiple terrains at once.",
                    GEditorCommon.WordWrapLeftLabel);
                if (GUILayout.Button("Create Group Tool"))
                {
                    GTerrainGroup group = GWizard.CreateGroupTool();
                    EditorGUIUtility.PingObject(group);
                    Selection.activeGameObject = group.gameObject;
                }
            });
        }
Пример #8
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);
                }
            });
        }