Example #1
0
        public void Editor_DrawCustomParamsGUI()
        {
#if UNITY_EDITOR
            string label = "Noise Painting";
            string id    = "noise-painter";

            GCommonGUI.Foldout(label, true, id, () =>
            {
                GNoisePainterParams param = GTexturePainterCustomParams.Instance.Noise;

                EditorGUILayout.GetControlRect(GUILayout.Height(1));
                Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(200));
                RenderTexture preview = GTerrainTexturePainter.Internal_GetRenderTexture(null, 200, 0);
                RenderNoiseTexture(preview, null);
                EditorGUI.DrawPreviewTexture(r, preview, null, ScaleMode.ScaleToFit);
                EditorGUILayout.GetControlRect(GUILayout.Height(1));

                param.Type          = (GNoiseType)EditorGUILayout.EnumPopup("Type", param.Type);
                param.Origin        = GCommonGUI.InlineVector2Field("Origin", param.Origin);
                param.Frequency     = EditorGUILayout.FloatField("Frequency", param.Frequency);
                param.Lacunarity    = EditorGUILayout.FloatField("Lacunarity", param.Lacunarity);
                param.Persistence   = EditorGUILayout.FloatField("Persistence", param.Persistence);
                param.Octaves       = EditorGUILayout.IntField("Octaves", param.Octaves);
                param.Seed          = EditorGUILayout.FloatField("Seed", param.Seed);
                param.UseWorldSpace = EditorGUILayout.Toggle("World Space", param.UseWorldSpace);

                GTexturePainterCustomParams.Instance.Noise = param;

                EditorUtility.SetDirty(GTexturePainterCustomParams.Instance);
            });
#endif
        }