Пример #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;
                }
            });
        }
        public static void CreateTextureStamper(MenuCommand menuCmd)
        {
            GameObject textureStamperGO = new GameObject("Texture Stamper");

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

            texStamper.GroupId = -1;

            Selection.activeGameObject = textureStamperGO;
            Undo.RegisterCreatedObjectUndo(textureStamperGO, "Creating Texture Stamper");
        }
        public static GTextureStamper CreateTextureStamper()
        {
            GameObject root = GetTerrainToolsRoot();

            if (root == null)
            {
                root = CreateTerrainToolsRoot();
            }
            GameObject g = new GameObject("Texture Stamper");

            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;

            GTextureStamper stamper = g.AddComponent <GTextureStamper>();

            return(stamper);
        }