public override void OnInspectorGUI()
    {
        // Let the default inspecter draw all the values
        DrawDefaultInspector();

        // Spawn buttons

        if (GUILayout.Button("Apply Blur effect to the Texture to Blur"))
        {
            targetScript.ApplyBlur();
        }

        if (GUILayout.Button("Apply your own effect to the Texture to Blur"))
        {
            targetScript.ApplyYourOwnEffect();
        }

        /*
         *
         * if (GUILayout.Button("Generate 2D Data")) {
         *  targetScript.Generate2DData();
         * }
         *
         * if (GUILayout.Button("Generate 3D Data")) {
         *  targetScript.Generate3DDataFrom2DData();
         * }
         *
         */

        if (GUILayout.Button("Generate a terrain with the chosen visualisation method"))
        {
            targetScript.GenerateMesh();
        }

        if (GUILayout.Button("Color the terrain with the current settings"))
        {
            targetScript.ColorMesh();
        }

        if (GUILayout.Button("Save the terrain as a mesh"))
        {
            AssetDatabase.CreateAsset(targetScript.GeneratedMesh, targetScript.GenerateSavePath());
            AssetDatabase.SaveAssets();
        }

        if (GUILayout.Button("Save settings to file"))
        {
            targetScript.SaveSettings();
        }

        if (GUILayout.Button("Load settings from file"))
        {
            targetScript.LoadSettings();
        }
    }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        // Let the default inspecter draw all the values
        DrawDefaultInspector();

        // Spawn buttons

        if (GUILayout.Button("Apply Blur effect to the Texture to Blur"))
        {
            if (targetScript.InputTexture != null && !AssetDatabase.Contains(targetScript.InputTexture))
            {
                Texture2D.DestroyImmediate(targetScript.InputTexture);
                Resources.UnloadUnusedAssets();
            }
            targetScript.ApplyBlur();
        }

        if (GUILayout.Button("Apply your own effect to the Texture to Blur"))
        {
            if (targetScript.InputTexture != null && !AssetDatabase.Contains(targetScript.InputTexture))
            {
                Texture2D.DestroyImmediate(targetScript.InputTexture);
                Resources.UnloadUnusedAssets();
            }
            targetScript.ApplyYourOwnEffect();
        }

        if (GUILayout.Button("Generate a terrain with the chosen visualisation method"))
        {
            if (targetScript.GeneratedMesh != null && !AssetDatabase.Contains(targetScript.GeneratedMesh))
            {
                Mesh.DestroyImmediate(targetScript.GeneratedMesh);
                Resources.UnloadUnusedAssets();
            }
            targetScript.GenerateMesh();
        }

        if (GUILayout.Button("Recalculate image data for new settings."))
        {
            targetScript.Generate2DData();
            targetScript.Generate3DDataFrom2DData();
        }

        if (GUILayout.Button("Color the terrain with the current settings"))
        {
            targetScript.ColorMesh();
        }

        if (GUILayout.Button("Save the terrain as a mesh"))
        {
            AssetDatabase.CreateAsset(targetScript.GeneratedMesh, targetScript.GenerateSavePath());
            AssetDatabase.SaveAssets();
        }

        if (GUILayout.Button("Save settings to file"))
        {
            targetScript.SaveSettings();
        }

        if (GUILayout.Button("Load settings from file"))
        {
            targetScript.LoadSettings();
        }
    }