public static void ShowWindow(MenuCommand menuCmd = null)
        {
            GTerrainWizardWindow window = ScriptableObject.CreateInstance <GTerrainWizardWindow>();

            window.titleContent = new GUIContent("Wizard");
            window.minSize      = new Vector2(400, 100);
            window.menuCmd      = menuCmd;
            window.mode         = MODE_CREATE;
            window.ShowUtility();
        }
        public static void ShowWindowSetShaderForTerrainGroupMode(int groupId)
        {
            GTerrainWizardWindow window = ScriptableObject.CreateInstance <GTerrainWizardWindow>();

            window.titleContent         = new GUIContent("Wizard");
            window.minSize              = new Vector2(400, 100);
            window.maxSize              = new Vector2(401, 101);
            window.mode                 = MODE_SET_SHADER;
            window.BulkSetShader        = true;
            window.BulkSetShaderGroupId = groupId;
            window.ShowUtility();
        }
        public static void ShowWindowSetShaderMode(GTerrainData terrainData)
        {
            if (terrainData == null)
            {
                return;
            }
            GTerrainWizardWindow window = ScriptableObject.CreateInstance <GTerrainWizardWindow>();

            window.titleContent = new GUIContent("Wizard");
            window.minSize      = new Vector2(400, 100);
            window.terrainData  = terrainData;
            window.mode         = MODE_SET_SHADER;
            window.ShowUtility();
        }
Exemplo n.º 4
0
        private void DrawShadingGUI()
        {
            string label = "Shading";
            string id    = "shading" + data.Id;

            GenericMenu menu = new GenericMenu();

            menu.AddItem(
                new GUIContent("Reset"),
                false,
                () => { data.Shading.ResetFull(); });
            menu.AddItem(
                new GUIContent("Refresh"),
                false,
                () => { data.Shading.UpdateLookupTextures(); data.Shading.UpdateMaterials(); });
            menu.AddItem(
                new GUIContent("Set Shader"),
                false,
                () => { GTerrainWizardWindow.ShowWindowSetShaderMode(data); });

#if __MICROSPLAT_POLARIS__
            if (microSplatSetupMenu != null)
            {
                menu.AddSeparator(null);
                menu.AddItem(
                    new GUIContent(microSplatSetupMenu.Name),
                    microSplatSetupMenu.IsOn,
                    microSplatSetupMenu.Action);
            }
#endif

            GEditorCommon.Foldout(label, false, id, () =>
            {
                GShading settings = data.Shading;
                EditorGUI.BeginChangeCheck();

#if __MICROSPLAT_POLARIS__
                settings.ShadingSystem = (GShadingSystem)EditorGUILayout.EnumPopup("Shading System", settings.ShadingSystem);
#endif

                settings.CustomMaterial = EditorGUILayout.ObjectField("Material", settings.CustomMaterial, typeof(Material), false) as Material;
                if (settings.CustomMaterial != null)
                {
                    GUI.enabled = false;
                    EditorGUILayout.LabelField("Shader", settings.CustomMaterial.shader.name);
                    GUI.enabled = true;
                }

                settings.AlbedoMapResolution   = EditorGUILayout.DelayedIntField("Albedo Map Resolution", settings.AlbedoMapResolution);
                settings.MetallicMapResolution = EditorGUILayout.DelayedIntField("Metallic Map Resolution", settings.MetallicMapResolution);
                if (EditorGUI.EndChangeCheck())
                {
                    data.SetDirty(GTerrainData.DirtyFlags.Shading);
                }

                EditorGUI.BeginChangeCheck();
                SerializedObject so = new SerializedObject(settings);
                SerializedProperty colorByNormalProps = so.FindProperty("colorByNormal");
                EditorGUILayout.PropertyField(colorByNormalProps);
                settings.ColorBlendCurve = EditorGUILayout.CurveField("Blend By Height", settings.ColorBlendCurve, Color.red, new Rect(0, 0, 1, 1));
                SerializedProperty colorByHeightProps = so.FindProperty("colorByHeight");
                EditorGUILayout.PropertyField(colorByHeightProps);
                if (EditorGUI.EndChangeCheck())
                {
                    so.ApplyModifiedProperties();
                    settings.UpdateLookupTextures();
                    data.SetDirty(GTerrainData.DirtyFlags.Shading);
                }
                colorByHeightProps.Dispose();
                colorByNormalProps.Dispose();
                so.Dispose();

                EditorGUI.BeginChangeCheck();
                settings.Splats = EditorGUILayout.ObjectField("Splats", settings.Splats, typeof(GSplatPrototypeGroup), false) as GSplatPrototypeGroup;
                settings.SplatControlResolution = EditorGUILayout.DelayedIntField("Splat Control Resolution", settings.SplatControlResolution);
                DrawAdvancedShading();
                if (EditorGUI.EndChangeCheck())
                {
                    data.SetDirty(GTerrainData.DirtyFlags.Shading);
                }
            }, menu);
        }
 public static void ShowCreateTerrainWizard(MenuCommand menuCmd)
 {
     GTerrainWizardWindow.ShowWindow(menuCmd);
 }