Exemplo n.º 1
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;
                }
            });
        }
Exemplo n.º 2
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;
                }
            });
        }
        public static void CreateTexturePainter(MenuCommand menuCmd)
        {
            GameObject g = new GameObject("Geometry & Texture Painter");

            if (menuCmd != null)
            {
                GameObjectUtility.SetParentAndAlign(g, menuCmd.context as GameObject);
            }
            g.transform.localPosition = Vector3.zero;
            g.transform.hideFlags     = HideFlags.HideInInspector;
            GTerrainTexturePainter painter = g.AddComponent <GTerrainTexturePainter>();

            painter.GroupId = -1;

            Selection.activeGameObject = g;
            Undo.RegisterCreatedObjectUndo(g, "Creating Texture Painter");
        }
        public static GTerrainTexturePainter CreateGeometryTexturePainter()
        {
            GameObject root = GetTerrainToolsRoot();

            if (root == null)
            {
                root = CreateTerrainToolsRoot();
            }
            GameObject g = new GameObject("Geometry - Texture Painter");

            g.transform.parent     = root.transform;
            g.transform.position   = Vector3.zero;
            g.transform.rotation   = Quaternion.identity;
            g.transform.localScale = Vector3.one;
            g.transform.hideFlags  = HideFlags.HideInInspector;

            GTerrainTexturePainter painter = g.AddComponent <GTerrainTexturePainter>();

            return(painter);
        }
        public static void CreateTerrainTools(MenuCommand menuCmd)
        {
            GameObject g = new GameObject("Polaris V2 Tools");

            if (menuCmd != null)
            {
                GameObjectUtility.SetParentAndAlign(g, menuCmd.context as GameObject);
            }
            g.transform.localPosition = Vector3.zero;
            g.transform.localRotation = Quaternion.identity;
            g.transform.localScale    = Vector3.one;
            g.transform.hideFlags     = HideFlags.HideInInspector;

            GTerrainTools tools = g.AddComponent <GTerrainTools>();

            tools.hideFlags = HideFlags.HideInInspector;

            GameObject terrainGroup = new GameObject("Terrain Group");

            GUtilities.ResetTransform(terrainGroup.transform, g.transform);
            terrainGroup.transform.hideFlags = HideFlags.HideInInspector;
            GTerrainGroup group = terrainGroup.AddComponent <GTerrainGroup>();

            group.GroupId = -1;

            GameObject texturePainter = new GameObject("Geometry & Texture Painter");

            GUtilities.ResetTransform(texturePainter.transform, g.transform);
            texturePainter.transform.hideFlags = HideFlags.HideInInspector;
            GTerrainTexturePainter texturePainterComponent = texturePainter.AddComponent <GTerrainTexturePainter>();

            texturePainterComponent.GroupId = -1;

            GameObject foliagePainter = new GameObject("Foliage Painter");

            GUtilities.ResetTransform(foliagePainter.transform, g.transform);
            foliagePainter.transform.hideFlags = HideFlags.HideInInspector;
            GFoliagePainter foliagePainterComponent = foliagePainter.AddComponent <GFoliagePainter>();

            foliagePainterComponent.GroupId = -1;
            foliagePainterComponent.gameObject.AddComponent <GRotationRandomizeFilter>();
            foliagePainterComponent.gameObject.AddComponent <GScaleRandomizeFilter>();

            GameObject objectPainter = new GameObject("Object Painter");

            GUtilities.ResetTransform(objectPainter.transform, g.transform);
            objectPainter.transform.hideFlags = HideFlags.HideInInspector;
            GObjectPainter objectPainterComponent = objectPainter.AddComponent <GObjectPainter>();

            objectPainterComponent.GroupId = -1;
            objectPainterComponent.gameObject.AddComponent <GRotationRandomizeFilter>();
            objectPainterComponent.gameObject.AddComponent <GScaleRandomizeFilter>();

            GameObject assetExplorer = new GameObject("Asset Explorer");

            GUtilities.ResetTransform(assetExplorer.transform, g.transform);
            assetExplorer.transform.hideFlags = HideFlags.HideInInspector;
            assetExplorer.AddComponent <GAssetExplorer>();

            GameObject helpTool = new GameObject("Help");

            GUtilities.ResetTransform(helpTool.transform, g.transform);
            helpTool.transform.hideFlags = HideFlags.HideInInspector;
            helpTool.AddComponent <GHelpComponent>();

            Selection.activeGameObject = terrainGroup;
            Undo.RegisterCreatedObjectUndo(g, "Creating Terrain Tools");
        }