This commit is contained in:
CortexCore
2025-03-14 21:04:19 +08:00
parent ff8670c453
commit 757ffe79ee
1282 changed files with 104378 additions and 3 deletions

View File

@@ -0,0 +1,477 @@
#if GRIFFIN
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using Pinwheel.Griffin;
using Pinwheel.Griffin.PaintTool;
using Pinwheel.Griffin.SplineTool;
using Pinwheel.Griffin.StampTool;
using Pinwheel.Griffin.GroupTool;
using Pinwheel.Griffin.ErosionTool;
namespace Pinwheel.Griffin.Wizard
{
public static class GCreateLevelTabDrawer
{
internal static Vector2 scrollPos;
internal static MenuCommand menuCmd;
private class GBaseGUI
{
public static readonly GUIContent INSTRUCTION = new GUIContent("Follow the steps below to create your level. Hover on labels for instruction.");
}
internal static void Draw()
{
EditorGUILayout.LabelField(GBaseGUI.INSTRUCTION, GEditorCommon.BoldLabel);
GEditorCommon.DrawCommonLinks();
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
DrawPolaris3GUI();
if (GCommon.CurrentRenderPipeline == GRenderPipelineType.Universal)
{
DrawRenderPipelineSettingGUI();
}
DrawCreateTerrainsGUI();
DrawTerrainsManagementGUI();
DrawSculptingGUI();
DrawTexturingGUI();
DrawVertexColorTexturingGUI();
DrawSimulationGUI();
DrawFoliageAndObjectSpawningGUI();
DrawCreateSplineGUI();
DrawWaterSkyGUI();
DrawUtilitiesGUI();
EditorGUILayout.EndScrollView();
}
private class Polaris3GUI
{
public static readonly string LABEL = "Polaris 3 is here";
public static readonly string ID = "wizard-polaris-3";
public static readonly string TEXT = "Polaris 3 is available for upgrade with new features and several improvements.";
public static readonly string BUTTON_TEXT = "View on Asset Store";
}
private static void DrawPolaris3GUI()
{
GEditorCommon.Foldout(Polaris3GUI.LABEL, true, Polaris3GUI.ID, () =>
{
EditorGUILayout.LabelField(Polaris3GUI.TEXT);
if (GUILayout.Button(Polaris3GUI.BUTTON_TEXT))
{
Application.OpenURL(GAssetLink.POLARIS_3);
}
});
}
private class GRenderPipelineGUI
{
public static readonly string LABEL = "0. Universal Render Pipeline Setup";
public static readonly string ID = "wizard-rp-setup";
public static readonly GUIContent INSTRUCTION = new GUIContent("Install additional package for Universal Render Pipeline");
public static readonly GUIContent STATUS_INSTALLED = new GUIContent("Status: INSTALLED");
public static readonly GUIContent STATUS_NOT_INSTALLED = new GUIContent("Status: NOT INSTALLED");
public static readonly GUIContent INSTALL_BTN = new GUIContent("Install");
}
private static void DrawRenderPipelineSettingGUI()
{
GEditorCommon.Foldout(GRenderPipelineGUI.LABEL, true, GRenderPipelineGUI.ID, () =>
{
EditorGUILayout.LabelField(GRenderPipelineGUI.INSTRUCTION, GEditorCommon.WordWrapLeftLabel);
EditorGUILayout.LabelField(GPackageInitializer.isUrpSupportInstalled ? GRenderPipelineGUI.STATUS_INSTALLED : GRenderPipelineGUI.STATUS_NOT_INSTALLED, GEditorCommon.WordWrapLeftLabel);
if (GCommon.CurrentRenderPipeline == GRenderPipelineType.Universal)
{
if (GUILayout.Button(GRenderPipelineGUI.INSTALL_BTN))
{
GUrpPackageImporter.Import();
#if GRIFFIN_URP
Griffin.URP.GGriffinUrpInstaller.Install();
#endif
}
}
});
}
private class GCreateTerrainGUI
{
public static readonly string LABEL = "1. Create Terrains";
public static readonly string ID = "wizard-create-terrains";
public static readonly string PHYSICAL_HEADER = "Physical";
public static readonly GUIContent ORIGIN = new GUIContent("Origin", "Position of the first terrain in the grid.");
public static readonly GUIContent TILE_SIZE = new GUIContent("Tile Size", "Size of each terrain tile in world space.");
public static readonly GUIContent TILE_X = new GUIContent("Tile Count X", "Number of tiles along X-axis.");
public static readonly GUIContent TILE_Z = new GUIContent("Tile Count Z", "Number of tiles along Z-axis.");
public static readonly GUIContent WORLD_SIZE = new GUIContent("World Size", "Size of the terrain grid in world space.");
public static readonly string MATERIAL_HEADER = "Material";
public static readonly string UTILITIES_HEADER = "Utilities";
public static readonly GUIContent NAME_PREFIX = new GUIContent("Name Prefix", "The beginning of each terrain's name. Useful for some level streaming system.");
public static readonly GUIContent GROUP_ID = new GUIContent("Group Id", "An integer for grouping and connecting adjacent terrain tiles.");
public static readonly string DATA_HEADER = "Data";
public static readonly GUIContent DIRECTORY = new GUIContent("Directory", "Where to store created terrain data. A sub-folder of Assets/ is recommended.");
public static readonly GUIContent CREATE_BTN = new GUIContent("Create");
}
private static void DrawCreateTerrainsGUI()
{
GEditorCommon.Foldout(GCreateTerrainGUI.LABEL, true, GCreateTerrainGUI.ID, () =>
{
GEditorSettings.WizardToolsSettings settings = GEditorSettings.Instance.wizardTools;
GEditorCommon.Header(GCreateTerrainGUI.PHYSICAL_HEADER);
settings.origin = GEditorCommon.InlineVector3Field(GCreateTerrainGUI.ORIGIN, settings.origin);
settings.tileSize = GEditorCommon.InlineVector3Field(GCreateTerrainGUI.TILE_SIZE, settings.tileSize);
settings.tileSize = new Vector3(
Mathf.Max(1, settings.tileSize.x),
Mathf.Max(1, settings.tileSize.y),
Mathf.Max(1, settings.tileSize.z));
settings.tileCountX = EditorGUILayout.IntField(GCreateTerrainGUI.TILE_X, settings.tileCountX);
settings.tileCountX = Mathf.Max(1, settings.tileCountX);
settings.tileCountZ = EditorGUILayout.IntField(GCreateTerrainGUI.TILE_Z, settings.tileCountZ);
settings.tileCountZ = Mathf.Max(1, settings.tileCountZ);
float worldSizeX = settings.tileCountX * settings.tileSize.x;
float worldSizeY = settings.tileSize.y;
float worldSizeZ = settings.tileCountZ * settings.tileSize.z;
GUIContent worldSizeContent = new GUIContent($"{worldSizeX}m x {worldSizeY}m x {worldSizeZ}m");
EditorGUILayout.LabelField(GCreateTerrainGUI.WORLD_SIZE, worldSizeContent);
GEditorCommon.Header(GCreateTerrainGUI.MATERIAL_HEADER);
GWizardEditorCommon.DrawMaterialSettingsGUI();
GEditorCommon.Header(GCreateTerrainGUI.UTILITIES_HEADER);
settings.terrainNamePrefix = EditorGUILayout.TextField(GCreateTerrainGUI.NAME_PREFIX, settings.terrainNamePrefix);
settings.groupId = EditorGUILayout.IntField(GCreateTerrainGUI.NAME_PREFIX, settings.groupId);
GEditorCommon.Header(GCreateTerrainGUI.DATA_HEADER);
string dir = settings.dataDirectory;
GEditorCommon.BrowseFolder(GCreateTerrainGUI.DIRECTORY, ref dir);
if (string.IsNullOrEmpty(dir))
{
dir = "Assets/";
}
settings.dataDirectory = dir;
if (GUILayout.Button(GCreateTerrainGUI.CREATE_BTN))
{
GameObject environmentRoot = null;
if (menuCmd != null && menuCmd.context != null)
{
environmentRoot = menuCmd.context as GameObject;
}
if (environmentRoot == null)
{
environmentRoot = new GameObject("Low Poly Environment");
environmentRoot.transform.position = settings.origin;
}
GWizard.CreateTerrains(environmentRoot);
}
});
}
private class GTerrainManagementGUI
{
public static readonly string LABEL = "2. Terrains Management";
public static readonly string ID = "wizard-terrains-management";
public static readonly string INSTRUCTION_1 = "Edit properties of an individual terrain by selecting it and use the Inspector.";
public static readonly string INSTRUCTION_2 = string.Format("Use context menus ({0}) in the terrain Inspector to perform additional tasks.", GEditorCommon.contextIconText);
public static readonly string INSTRUCTION_3 = "Use the Group Tool to edit properties of multiple terrains at once.";
public static readonly GUIContent CREATE_BTN = new GUIContent("Create Group Tool");
}
private static void DrawTerrainsManagementGUI()
{
GEditorCommon.Foldout(GTerrainManagementGUI.LABEL, false, GTerrainManagementGUI.ID, () =>
{
EditorGUILayout.LabelField(
GTerrainManagementGUI.INSTRUCTION_1,
GEditorCommon.WordWrapLeftLabel);
EditorGUILayout.LabelField(
GTerrainManagementGUI.INSTRUCTION_2,
GEditorCommon.WordWrapLeftLabel);
EditorGUILayout.LabelField(
GTerrainManagementGUI.INSTRUCTION_3,
GEditorCommon.WordWrapLeftLabel);
if (GUILayout.Button(GTerrainManagementGUI.CREATE_BTN))
{
GTerrainGroup group = GWizard.CreateGroupTool();
EditorGUIUtility.PingObject(group);
Selection.activeGameObject = group.gameObject;
}
});
}
private class GSculptingGUI
{
public static readonly string LABEL = "3. Sculpting";
public static readonly string ID = "wizard-sculpting";
public static readonly GUIContent SELECT_WORKFLOW = new GUIContent("Select the workflow you prefer.");
public static readonly string PAINTING_HEADER = "Painting";
public static readonly GUIContent PAINTING_INSTRUCTION = new GUIContent("Use a set of painters for hand sculpting terrain shape.");
public static readonly GUIContent CREATE_PAINTER_BTN = new GUIContent("Create Geometry - Texture Painter");
public static readonly string STAMPING_HEADER = "Stamping";
public static readonly GUIContent STAMPING_INSTRUCTION = new GUIContent("Use grayscale textures to stamp mountains, plateaus, rivers, etc. and blend using some math operations.");
public static readonly GUIContent CREATE_STAMPER_BTN = new GUIContent("Create Geometry Stamper");
}
private static void DrawSculptingGUI()
{
GEditorCommon.Foldout(GSculptingGUI.LABEL, false, GSculptingGUI.ID, () =>
{
EditorGUILayout.LabelField(GSculptingGUI.SELECT_WORKFLOW, GEditorCommon.WordWrapLeftLabel);
GEditorCommon.Header(GSculptingGUI.PAINTING_HEADER);
EditorGUILayout.LabelField(GSculptingGUI.PAINTING_INSTRUCTION, GEditorCommon.WordWrapLeftLabel);
if (GUILayout.Button(GSculptingGUI.CREATE_PAINTER_BTN))
{
GTerrainTexturePainter painter = GWizard.CreateGeometryTexturePainter();
EditorGUIUtility.PingObject(painter.gameObject);
Selection.activeGameObject = painter.gameObject;
}
GEditorCommon.Header(GSculptingGUI.STAMPING_HEADER);
EditorGUILayout.LabelField(GSculptingGUI.STAMPING_INSTRUCTION, GEditorCommon.WordWrapLeftLabel);
if (GUILayout.Button(GSculptingGUI.CREATE_STAMPER_BTN))
{
GGeometryStamper stamper = GWizard.CreateGeometryStamper();
EditorGUIUtility.PingObject(stamper.gameObject);
Selection.activeGameObject = stamper.gameObject;
}
});
}
private class GTexturingGUI
{
public static readonly string LABEL = "4. Texturing";
public static readonly string ID = "wizard-texturing";
public static readonly GUIContent SELECT_WORKFLOW = new GUIContent("Select the workflow you prefer.");
public static readonly string PAINTING_HEADER = "Painting";
public static readonly GUIContent PAINTING_INSTRUCTION = new GUIContent("Use a set of painters for hand painting terrain color.");
public static readonly GUIContent CREATE_PAINTER_BTN = new GUIContent("Create Geometry - Texture Painter");
public static readonly string STAMPING_HEADER = "Stamping";
public static readonly GUIContent STAMPING_INSTRUCTION = new GUIContent("Use stamper to color the terrain procedurally with some rules such as height, normal vector and noise.");
public static readonly GUIContent CREATE_STAMPER_BTN = new GUIContent("Create Texture Stamper");
}
private static void DrawTexturingGUI()
{
GEditorCommon.Foldout(GTexturingGUI.LABEL, false, GTexturingGUI.ID, () =>
{
EditorGUILayout.LabelField(GTexturingGUI.SELECT_WORKFLOW, GEditorCommon.WordWrapLeftLabel);
GEditorCommon.Header(GTexturingGUI.PAINTING_HEADER);
EditorGUILayout.LabelField(GTexturingGUI.PAINTING_INSTRUCTION, GEditorCommon.WordWrapLeftLabel);
if (GUILayout.Button(GTexturingGUI.CREATE_PAINTER_BTN))
{
GTerrainTexturePainter painter = GWizard.CreateGeometryTexturePainter();
EditorGUIUtility.PingObject(painter.gameObject);
Selection.activeGameObject = painter.gameObject;
}
GEditorCommon.Header(GTexturingGUI.STAMPING_HEADER);
EditorGUILayout.LabelField(GTexturingGUI.STAMPING_INSTRUCTION, GEditorCommon.WordWrapLeftLabel);
if (GUILayout.Button(GTexturingGUI.CREATE_STAMPER_BTN))
{
GTextureStamper stamper = GWizard.CreateTextureStamper();
EditorGUIUtility.PingObject(stamper.gameObject);
Selection.activeGameObject = stamper.gameObject;
}
});
}
private class GVertexColorTexturingGUI
{
public static readonly string LABEL = "4.1. Vertex Color Texturing";
public static readonly string ID = "wizard-vertex-color-texturing";
public static readonly GUIContent INSTRUCTION_1 = new GUIContent("To enable vertex coloring, do the following steps.");
public static readonly GUIContent INSTRUCTION_2 = new GUIContent("Set <i>terrain> Geometry> Albedo To Vertex Color</i> to Sharp or Smooth");
public static readonly GUIContent INSTRUCTION_3 = new GUIContent("For Painting workflow: Select the Geometry - Texture Painter and enable <i>Force Update Geometry</i>, then use Albedo mode to paint.");
public static readonly GUIContent INSTRUCTION_4 = new GUIContent("For Stamping workflow: Stamp to Albedo map and regenerate terrain meshes by select <i>terrain> Geometry> CONTEXT (≡)> Update</i>");
}
private static void DrawVertexColorTexturingGUI()
{
GEditorCommon.Foldout(GVertexColorTexturingGUI.LABEL, false, GVertexColorTexturingGUI.ID, () =>
{
EditorGUILayout.LabelField(
GVertexColorTexturingGUI.INSTRUCTION_1, GEditorCommon.WordWrapLeftLabel);
EditorGUILayout.LabelField(
GVertexColorTexturingGUI.INSTRUCTION_2, GEditorCommon.RichTextLabel);
EditorGUILayout.LabelField(
GVertexColorTexturingGUI.INSTRUCTION_3, GEditorCommon.RichTextLabel);
EditorGUILayout.LabelField(
GVertexColorTexturingGUI.INSTRUCTION_4, GEditorCommon.RichTextLabel);
});
}
private class GSimulationGUI
{
public static readonly string LABEL = "5. Simulation";
public static readonly string ID = "wizard-simulation";
public static readonly string INSTRUCTION = "Simulate natural effect such as hydraulic and thermal erosion on the terrain surface.";
public static readonly string CREATE_SIMULATOR_LABEL = "Create Erosion Simulator";
}
private static void DrawSimulationGUI()
{
GEditorCommon.Foldout(GSimulationGUI.LABEL, false, GSimulationGUI.ID, () =>
{
EditorGUILayout.LabelField(GSimulationGUI.INSTRUCTION, GEditorCommon.WordWrapItalicLabel);
if (GUILayout.Button(GSimulationGUI.CREATE_SIMULATOR_LABEL))
{
GErosionSimulator simulator = GWizard.CreateErosionSimulator();
EditorGUIUtility.PingObject(simulator);
Selection.activeGameObject = simulator.gameObject;
}
});
}
private class GSpawningGUI
{
public static readonly string LABEL = "6. Foliage & Object Spawning";
public static readonly string ID = "wizard-foliage-object-spawning";
public static readonly GUIContent SELECT_WORKFLOW = new GUIContent("Select the workflow you prefer.");
public static readonly string PAINTING_HEADER = "Painting";
public static readonly GUIContent PAINTING_INSTRUCTION = new GUIContent("Place trees, grasses and game objects by painting.");
public static readonly GUIContent CREATE_PAINTER_BTN = new GUIContent("Create Foliage Painter & Object Painter");
public static readonly string STAMPING_HEADER = "Stamping";
public static readonly GUIContent STAMPING_INSTRUCTION = new GUIContent("Procedurally spawn trees, grasses and game objects using some rules such as height, normal vector and noise.");
public static readonly GUIContent CREATE_STAMPER_BTN = new GUIContent("Create Foliage Stamper & Object Stamper");
}
private static void DrawFoliageAndObjectSpawningGUI()
{
GEditorCommon.Foldout(GSpawningGUI.LABEL, false, GSpawningGUI.ID, () =>
{
EditorGUILayout.LabelField(GSpawningGUI.SELECT_WORKFLOW, GEditorCommon.WordWrapLeftLabel);
GEditorCommon.Header(GSpawningGUI.PAINTING_HEADER);
EditorGUILayout.LabelField(GSpawningGUI.PAINTING_INSTRUCTION, GEditorCommon.WordWrapLeftLabel);
if (GUILayout.Button(GSpawningGUI.CREATE_PAINTER_BTN))
{
GFoliagePainter fPainter = GWizard.CreateFoliagePainter();
GObjectPainter oPainter = GWizard.CreateObjectPainter();
EditorGUIUtility.PingObject(fPainter);
Selection.objects = new GameObject[] { fPainter.gameObject, oPainter.gameObject };
Selection.activeGameObject = fPainter.gameObject;
}
GEditorCommon.Header(GSpawningGUI.STAMPING_HEADER);
EditorGUILayout.LabelField(GSpawningGUI.STAMPING_INSTRUCTION, GEditorCommon.WordWrapLeftLabel);
if (GUILayout.Button(GSpawningGUI.CREATE_STAMPER_BTN))
{
GFoliageStamper fStamper = GWizard.CreateFoliageStamper();
GObjectStamper oStamper = GWizard.CreateObjectStamper();
EditorGUIUtility.PingObject(fStamper);
Selection.objects = new GameObject[] { fStamper.gameObject, oStamper.gameObject };
Selection.activeGameObject = fStamper.gameObject;
}
});
}
private class GCreateSplineGUI
{
public static readonly string LABEL = "7. Create Roads, Ramps, Rivers, etc.";
public static readonly string ID = "wizard-spline";
public static readonly GUIContent INSTRUCTION = new GUIContent("Use Spline Tool to paint roads, make ramps and riverbeds, etc.");
public static readonly GUIContent CREATE_BTN = new GUIContent("Create Spline Tool");
}
private static void DrawCreateSplineGUI()
{
GEditorCommon.Foldout(GCreateSplineGUI.LABEL, false, GCreateSplineGUI.ID, () =>
{
EditorGUILayout.LabelField(GCreateSplineGUI.INSTRUCTION, GEditorCommon.WordWrapLeftLabel);
if (GUILayout.Button(GCreateSplineGUI.CREATE_BTN))
{
GSplineCreator spline = GWizard.CreateSplineTool();
EditorGUIUtility.PingObject(spline);
Selection.activeGameObject = spline.gameObject;
}
});
}
private class GWaterSkyGUI
{
public static readonly string LABEL = "8. Adding Water & Sky";
public static readonly string ID = "wizard-id";
public static readonly string WATER_HEADER = "Water";
public static readonly GUIContent WATER_INSTRUCTION = new GUIContent("Poseidon is a low poly water system with high visual quality and performance.");
public static readonly GUIContent GET_POSEIDON_BTN = new GUIContent("Get Poseidon");
public static readonly string SKY_HEADER = "Sky";
public static readonly GUIContent SKY_INSTRUCTION = new GUIContent("Jupiter is a single pass sky shader with day night cycle support.");
public static readonly GUIContent GET_JUPITER_BTN = new GUIContent("Get Jupiter");
}
private static void DrawWaterSkyGUI()
{
GEditorCommon.Foldout(GWaterSkyGUI.LABEL, false, GWaterSkyGUI.ID, () =>
{
GEditorCommon.Header(GWaterSkyGUI.WATER_HEADER);
EditorGUILayout.LabelField(GWaterSkyGUI.WATER_INSTRUCTION, GEditorCommon.WordWrapLeftLabel);
if (GUILayout.Button(GWaterSkyGUI.GET_POSEIDON_BTN))
{
Application.OpenURL(GAssetLink.POSEIDON);
}
GEditorCommon.Header(GWaterSkyGUI.SKY_HEADER);
EditorGUILayout.LabelField(
GWaterSkyGUI.SKY_INSTRUCTION, GEditorCommon.WordWrapLeftLabel);
if (GUILayout.Button(GWaterSkyGUI.GET_JUPITER_BTN))
{
Application.OpenURL(GAssetLink.JUPITER);
}
});
}
private class GUtilitiesGUI
{
public static readonly string LABEL = "9. Utilities";
public static readonly string ID = "wizard-utilities";
public static readonly string WIND_ZONE_HEADER = "Wind Zone";
public static readonly GUIContent WIND_ZONE_INSTRUCTION = new GUIContent("Adding Wind Zone to customize how grass react to wind in this level.");
public static readonly GUIContent CREATE_WIND_ZONE_BTN = new GUIContent("Create Wind Zone");
}
private static void DrawUtilitiesGUI()
{
GEditorCommon.Foldout(GUtilitiesGUI.LABEL, false, GUtilitiesGUI.ID, () =>
{
GEditorCommon.Header(GUtilitiesGUI.WIND_ZONE_HEADER);
EditorGUILayout.LabelField(GUtilitiesGUI.WIND_ZONE_INSTRUCTION);
if (GUILayout.Button(GUtilitiesGUI.CREATE_WIND_ZONE_BTN))
{
GWindZone wind = GWizard.CreateWindZone();
EditorGUIUtility.PingObject(wind.gameObject);
Selection.activeGameObject = wind.gameObject;
}
});
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 07076b6937e9ad14ca6c056024824c82
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,164 @@
#if GRIFFIN
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using Pinwheel.Griffin.ExtensionSystem;
using System.Reflection;
namespace Pinwheel.Griffin.Wizard
{
public static class GExtensionTabDrawer
{
private static Vector2 scrollPos;
private static string searchString;
private static string SearchString
{
get
{
if (searchString == null)
{
searchString = string.Empty;
}
return searchString;
}
set
{
searchString = value;
}
}
public static void ReloadExtension()
{
GExtensionManager.ReloadExtensions();
}
public static void Draw()
{
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
List<GExtensionInfo> extensions = GExtensionManager.Extensions;
for (int i = 0; i < extensions.Count; ++i)
{
if (extensions[i].Publisher.Equals(GCommon.PINWHEEL_STUDIO))
{
DrawExtension(extensions[i]);
}
}
for (int i = 0; i < extensions.Count; ++i)
{
if (!extensions[i].Publisher.Equals(GCommon.PINWHEEL_STUDIO))
{
DrawExtension(extensions[i]);
}
}
EditorGUILayout.EndScrollView();
}
private class GExtensionGUI
{
public static readonly string ID_PREFIX = "griffin-extension";
public static readonly string PUBLISHER = "Publisher";
public static readonly string VERSION = "Version";
public static readonly string DESCRIPTION = "Description";
public static readonly string LINK = "Link";
public static readonly string SUPPORT = "Support";
public static readonly string USER_GUIDE = "User Guide";
}
private static void DrawExtension(GExtensionInfo ex)
{
GUI.enabled = !EditorApplication.isCompiling;
string filter = SearchString.ToLower();
if (!ex.Name.ToLower().Contains(filter) &&
!ex.Publisher.ToLower().Contains(filter) &&
!ex.Description.ToLower().Contains(filter))
return;
string id = GExtensionGUI.ID_PREFIX + ex.Name + ex.Publisher;
string label = ex.Name;
GEditorCommon.Foldout(label, false, id, () =>
{
try
{
EditorGUILayout.LabelField(GExtensionGUI.PUBLISHER, ex.Publisher);
EditorGUILayout.LabelField(GExtensionGUI.VERSION, ex.Version);
EditorGUILayout.LabelField(GExtensionGUI.DESCRIPTION, ex.Description, GEditorCommon.WordWrapLeftLabel);
if (ex.OpenUserGuideMethod != null || ex.OpenSupportLinkMethod != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel(GExtensionGUI.LINK);
using (EditorGUI.IndentLevelScope level = new EditorGUI.IndentLevelScope(-1))
{
Rect r = EditorGUILayout.GetControlRect();
List<string> linkLabels = new List<string>();
linkLabels.Add(GExtensionGUI.SUPPORT);
if (ex.OpenUserGuideMethod != null)
{
linkLabels.Add(GExtensionGUI.USER_GUIDE);
}
List<Rect> linkRects = EditorGUIUtility.GetFlowLayoutedRects(r, EditorStyles.label, 7, 0, linkLabels);
for (int i = 0; i < linkRects.Count; ++i)
{
EditorGUIUtility.AddCursorRect(linkRects[i], MouseCursor.Link);
}
if (GUI.Button(linkRects[0], GExtensionGUI.SUPPORT, EditorStyles.label))
{
ex.OpenSupportLinkMethod.Invoke(null, null);
}
GEditorCommon.DrawBottomLine(linkRects[0], EditorStyles.label.normal.textColor);
if (ex.OpenUserGuideMethod != null)
{
if (GUI.Button(linkRects[1], GExtensionGUI.USER_GUIDE, EditorStyles.label))
{
ex.OpenUserGuideMethod.Invoke(null, null);
}
GEditorCommon.DrawBottomLine(linkRects[1], EditorStyles.label.normal.textColor);
}
}
EditorGUILayout.EndHorizontal();
}
if (ex.ButtonMethods.Count > 0)
{
GEditorCommon.Separator();
for (int i = 0; i < ex.ButtonMethods.Count; ++i)
{
MethodInfo method = ex.ButtonMethods[i];
if (method == null)
continue;
string buttonLabel = ObjectNames.NicifyVariableName(method.Name.Substring(GExtensionInfo.BUTTON_METHOD_PREFIX.Length));
if (GUILayout.Button(buttonLabel))
{
method.Invoke(null, null);
}
}
}
if (ex.GuiMethod != null)
{
GEditorCommon.Separator();
ex.GuiMethod.Invoke(null, null);
}
}
catch (System.Exception e)
{
EditorGUILayout.LabelField(string.Format("<color=red>Error: {0}</color>", e.ToString()), GEditorCommon.RichTextLabel);
Debug.LogException(e);
}
});
GUI.enabled = true;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 72658afd13479fd45ad3ed611a68a533
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,49 @@
#if GRIFFIN
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
namespace Pinwheel.Griffin.Wizard
{
public static class GSetShaderTabDrawer
{
private class GSetShaderTabGUI
{
public static readonly GUIContent GROUP_ID = new GUIContent("Group Id", "Id of the terrain group to change the material");
public static readonly GUIContent TERRAIN = new GUIContent("Terrain", "The terrain to change its material");
public static readonly GUIContent SET_BTN = new GUIContent("Set");
}
internal static bool bulkSetShader = true;
internal static void Draw()
{
GEditorSettings.WizardToolsSettings settings = GEditorSettings.Instance.wizardTools;
if (bulkSetShader)
{
settings.setShaderGroupId = GEditorCommon.ActiveTerrainGroupPopupWithAllOption(GSetShaderTabGUI.GROUP_ID, settings.setShaderGroupId);
}
else
{
settings.setShaderTerrain = EditorGUILayout.ObjectField(GSetShaderTabGUI.TERRAIN, settings.setShaderTerrain, typeof(GStylizedTerrain), true) as GStylizedTerrain;
}
GWizardEditorCommon.DrawMaterialSettingsGUI();
if (GUILayout.Button(GSetShaderTabGUI.SET_BTN))
{
if (bulkSetShader)
{
GWizard.SetShader(settings.setShaderGroupId);
}
else
{
GWizard.SetShader(settings.setShaderTerrain);
}
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fd09b4bdabf8cfa45a2700a6b4b7bdab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
#if GRIFFIN
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor.Callbacks;
using UnityEditor;
namespace Pinwheel.Griffin.Wizard
{
public static class GUrpPackageImporter
{
public static void Import()
{
string packagePath = GEditorSettings.Instance.renderPipelines.GetUrpPackagePath();
if (string.IsNullOrEmpty(packagePath))
{
Debug.Log("URP Support package not found. Please re-install Polaris.");
return;
}
AssetDatabase.ImportPackage(packagePath, false);
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 75bb59d6b5f8d3a46913436a89267be8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,475 @@
#if GRIFFIN
#if UNITY_EDITOR
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
#if UNITY_EDITOR
using UnityEditor;
#endif
using Pinwheel.Griffin;
using Pinwheel.Griffin.Physic;
using Pinwheel.Griffin.GroupTool;
using Pinwheel.Griffin.HelpTool;
using Pinwheel.Griffin.PaintTool;
using Pinwheel.Griffin.StampTool;
using Pinwheel.Griffin.SplineTool;
using Pinwheel.Griffin.ErosionTool;
using System;
using Object = UnityEngine.Object;
namespace Pinwheel.Griffin.Wizard
{
public static class GWizard
{
public static List<GStylizedTerrain> CreateTerrains(GameObject root)
{
GEditorSettings.WizardToolsSettings settings = GEditorSettings.Instance.wizardTools;
List<GStylizedTerrain> terrains = new List<GStylizedTerrain>();
#if UNITY_EDITOR
if (!Application.isPlaying)
{
GUtilities.EnsureDirectoryExists(settings.dataDirectory);
}
#endif
try
{
float totalTile = settings.tileCountX * settings.tileCountZ;
float tileCount = 0;
for (int z = 0; z < settings.tileCountZ; ++z)
{
for (int x = 0; x < settings.tileCountX; ++x)
{
tileCount += 1;
#if UNITY_EDITOR
GCommonGUI.CancelableProgressBar(
"Creating Terrains",
string.Format("Creating tile ({0},{1})", x, z),
tileCount / totalTile);
#endif
GameObject g = new GameObject();
g.transform.parent = root.transform;
g.transform.position = new Vector3(x * settings.tileSize.x, 0, z * settings.tileSize.z) + settings.origin;
g.transform.rotation = Quaternion.identity;
g.transform.localScale = Vector3.one;
g.name = string.Format("{0}_({1},{2})", settings.terrainNamePrefix, x, z);
GTerrainData data = ScriptableObject.CreateInstance<GTerrainData>();
if (Application.isPlaying) //Reset() only called in edit mode
{
data.Reset();
data.Geometry.Reset();
data.Shading.Reset();
data.Rendering.Reset();
data.Foliage.Reset();
data.Mask.Reset();
}
data.name = string.Format("TerrainData_{0}", data.Id);
data.Geometry.Width = settings.tileSize.x;
data.Geometry.Height = settings.tileSize.y;
data.Geometry.Length = settings.tileSize.z;
if (settings.texturingModel == GTexturingModel.VertexColor)
{
data.Geometry.AlbedoToVertexColorMode = GAlbedoToVertexColorMode.Sharp;
}
#if UNITY_EDITOR
if (!Application.isPlaying)
{
string dataAssetPath = Path.Combine(settings.dataDirectory, data.name + ".asset");
AssetDatabase.CreateAsset(data, dataAssetPath);
}
#endif
Material material = GRuntimeSettings.Instance.terrainRendering.GetClonedMaterial(
GCommon.CurrentRenderPipeline,
settings.lightingModel,
settings.texturingModel,
settings.splatsModel);
if (material != null)
{
material.name = string.Format("TerrainMaterial_{0}", data.Id);
#if UNITY_EDITOR
if (!Application.isPlaying)
{
string materialAssetPath = Path.Combine(settings.dataDirectory, material.name + ".mat");
AssetDatabase.CreateAsset(material, materialAssetPath);
}
#endif
}
data.Shading.CustomMaterial = material;
if (material.HasProperty(data.Shading.ColorByHeightPropertyName) ||
material.HasProperty(data.Shading.ColorByNormalPropertyName) ||
material.HasProperty(data.Shading.ColorBlendPropertyName))
{
data.Shading.UpdateLookupTextures();
}
data.Shading.UpdateMaterials();
GStylizedTerrain terrain = g.AddComponent<GStylizedTerrain>();
terrain.GroupId = settings.groupId;
terrain.TerrainData = data;
#if UNITY_EDITOR
Undo.RegisterCreatedObjectUndo(g, "Creating Low Poly Terrain");
#endif
GameObject colliderGO = new GameObject("Tree Collider");
colliderGO.transform.parent = g.transform;
colliderGO.transform.localPosition = Vector3.zero;
colliderGO.transform.localRotation = Quaternion.identity;
colliderGO.transform.localScale = Vector3.one;
GTreeCollider collider = colliderGO.AddComponent<GTreeCollider>();
collider.Terrain = terrain;
}
}
}
catch (GProgressCancelledException)
{
}
GStylizedTerrain.ConnectAdjacentTiles();
#if UNITY_EDITOR
GCommonGUI.ClearProgressBar();
#endif
return terrains;
}
public static GStylizedTerrain CreateTerrainFromSource(GTerrainData srcData)
{
GEditorSettings.WizardToolsSettings settings = GEditorSettings.Instance.wizardTools;
GameObject g = new GameObject("Low Poly Terrain");
g.transform.localPosition = Vector3.zero;
g.transform.localRotation = Quaternion.identity;
g.transform.localScale = Vector3.one;
GTerrainData terrainData = GTerrainData.CreateInstance<GTerrainData>();
terrainData.Reset();
#if UNITY_EDITOR
string assetName = "TerrainData_" + terrainData.Id;
GUtilities.EnsureDirectoryExists(settings.dataDirectory);
AssetDatabase.CreateAsset(terrainData, Path.Combine(settings.dataDirectory, assetName + ".asset"));
#endif
srcData.CopyTo(terrainData);
Material mat = null;
if (srcData != null && srcData.Shading.CustomMaterial != null)
{
mat = UnityEngine.Object.Instantiate(srcData.Shading.CustomMaterial);
}
if (mat != null)
{
string matName = "TerrainMaterial_" + terrainData.Id;
mat.name = matName;
#if UNITY_EDITOR
GUtilities.EnsureDirectoryExists(settings.dataDirectory);
AssetDatabase.CreateAsset(mat, Path.Combine(settings.dataDirectory, matName + ".mat"));
#endif
terrainData.Shading.CustomMaterial = mat;
}
GStylizedTerrain terrain = g.AddComponent<GStylizedTerrain>();
terrain.GroupId = 0;
terrain.TerrainData = terrainData;
#if UNITY_EDITOR
Undo.RegisterCreatedObjectUndo(g, "Creating Low Poly Terrain");
#endif
GameObject colliderGO = new GameObject("Tree Collider");
colliderGO.transform.parent = terrain.transform;
colliderGO.transform.localPosition = Vector3.zero;
colliderGO.transform.localRotation = Quaternion.identity;
colliderGO.transform.localScale = Vector3.one;
GTreeCollider collider = colliderGO.AddComponent<GTreeCollider>();
collider.Terrain = terrain;
#if UNITY_EDITOR
Selection.activeGameObject = g;
#endif
return terrain;
}
public static GameObject GetTerrainToolsRoot()
{
GTerrainTools tools = Object.FindObjectOfType<GTerrainTools>();
if (tools != null)
{
return tools.gameObject;
}
else
{
return null;
}
}
public static GameObject CreateTerrainToolsRoot()
{
GameObject root = new GameObject("Polaris Tools");
root.AddComponent<GTerrainTools>();
root.hideFlags = HideFlags.HideInInspector;
GameObject helpGO = new GameObject("Help");
helpGO.transform.parent = root.transform;
helpGO.transform.position = Vector3.zero;
helpGO.transform.rotation = Quaternion.identity;
helpGO.transform.localScale = Vector3.one;
GHelpComponent h = helpGO.AddComponent<GHelpComponent>();
GameObject assetExplorerGO = new GameObject("Asset Explorer");
assetExplorerGO.transform.parent = root.transform;
assetExplorerGO.transform.position = Vector3.zero;
assetExplorerGO.transform.rotation = Quaternion.identity;
assetExplorerGO.transform.localScale = Vector3.one;
GAssetExplorer a = assetExplorerGO.AddComponent<GAssetExplorer>();
return root;
}
public static GTerrainGroup CreateGroupTool()
{
GameObject root = GetTerrainToolsRoot();
if (root == null)
{
root = CreateTerrainToolsRoot();
}
GameObject g = new GameObject("Group Tool");
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;
GTerrainGroup group = g.AddComponent<GTerrainGroup>();
return group;
}
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 GFoliagePainter CreateFoliagePainter()
{
GameObject root = GetTerrainToolsRoot();
if (root == null)
{
root = CreateTerrainToolsRoot();
}
GameObject g = new GameObject("Foliage 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;
GFoliagePainter painter = g.AddComponent<GFoliagePainter>();
g.AddComponent<GRotationRandomizeFilter>();
g.AddComponent<GScaleRandomizeFilter>();
return painter;
}
public static GObjectPainter CreateObjectPainter()
{
GameObject root = GetTerrainToolsRoot();
if (root == null)
{
root = CreateTerrainToolsRoot();
}
GameObject g = new GameObject("Object 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;
GObjectPainter painter = g.AddComponent<GObjectPainter>();
g.AddComponent<GRotationRandomizeFilter>();
g.AddComponent<GScaleRandomizeFilter>();
return painter;
}
public static GGeometryStamper CreateGeometryStamper()
{
GameObject root = GetTerrainToolsRoot();
if (root == null)
{
root = CreateTerrainToolsRoot();
}
GameObject g = new GameObject("Geometry 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;
GGeometryStamper stamper = g.AddComponent<GGeometryStamper>();
return 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;
}
public static GErosionSimulator CreateErosionSimulator()
{
GameObject root = GetTerrainToolsRoot();
if (root == null)
{
root = CreateTerrainToolsRoot();
}
GameObject g = new GameObject("Erosion Simulator");
g.transform.parent = root.transform;
g.transform.position = Vector3.zero;
g.transform.rotation = Quaternion.identity;
g.transform.localScale = Vector3.one*100;
GErosionSimulator simulator = g.AddComponent<GErosionSimulator>();
return simulator;
}
public static GFoliageStamper CreateFoliageStamper()
{
GameObject root = GetTerrainToolsRoot();
if (root == null)
{
root = CreateTerrainToolsRoot();
}
GameObject g = new GameObject("Foliage 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;
GFoliageStamper stamper = g.AddComponent<GFoliageStamper>();
return stamper;
}
public static GObjectStamper CreateObjectStamper()
{
GameObject root = GetTerrainToolsRoot();
if (root == null)
{
root = CreateTerrainToolsRoot();
}
GameObject g = new GameObject("Object 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;
GObjectStamper stamper = g.AddComponent<GObjectStamper>();
return stamper;
}
public static GSplineCreator CreateSplineTool()
{
GameObject root = GetTerrainToolsRoot();
if (root == null)
{
root = CreateTerrainToolsRoot();
}
GameObject g = new GameObject("Spline");
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;
GSplineCreator spline = g.AddComponent<GSplineCreator>();
return spline;
}
public static GWindZone CreateWindZone()
{
GameObject g = new GameObject("Wind Zone");
g.transform.position = Vector3.zero;
g.transform.rotation = Quaternion.identity;
g.transform.localScale = Vector3.one;
GWindZone wind = g.AddComponent<GWindZone>();
return wind;
}
public static void SetShader(GStylizedTerrain terrain)
{
GEditorSettings.WizardToolsSettings settings = GEditorSettings.Instance.wizardTools;
SetShader(terrain, settings.lightingModel, settings.texturingModel, settings.splatsModel);
}
public static void SetShader(GStylizedTerrain terrain, GLightingModel lighting, GTexturingModel texturing, GSplatsModel splats = GSplatsModel.Splats4)
{
if (terrain.TerrainData == null)
{
throw new NullReferenceException("The selected terrain doesn't have terrain data.");
}
if (terrain.TerrainData.Shading.CustomMaterial == null)
{
throw new NullReferenceException("The selected terrain doesn't have material. Make sure you've assigned a material for it.");
}
Material mat = GRuntimeSettings.Instance.terrainRendering.GetClonedMaterial(
GCommon.CurrentRenderPipeline,
lighting,
texturing,
splats);
if (mat == null)
{
throw new Exception("Fail to get template material. Try re-install render pipeline extension package.");
}
terrain.TerrainData.Shading.CustomMaterial.shader = mat.shader;
terrain.TerrainData.Shading.UpdateMaterials();
GUtilities.DestroyObject(mat);
}
public static void SetShader(int groupId)
{
GEditorSettings.WizardToolsSettings settings = GEditorSettings.Instance.wizardTools;
GCommon.ForEachTerrain(groupId, (t) =>
{
SetShader(t, settings.lightingModel, settings.texturingModel, settings.splatsModel);
});
}
}
}
#endif
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6a347cbba9b0e2b458555fe4e902cce4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,61 @@
#if GRIFFIN
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
namespace Pinwheel.Griffin.Wizard
{
public static class GWizardEditorCommon
{
private class GMaterialSettingsGUI
{
public static readonly GUIContent RP_LABEL = new GUIContent("Render Pipeline", "The render pipeline currently in used.");
public static readonly GUIContent LIGHT_MODEL_BUILTIN = new GUIContent(
"Lighting Model",
"Lighting model to use.\n" +
"- PBR: Best visual quality with metallic & smoothness setup.\n" +
"- Lambert: Simple shading with no specularity.\n" +
"- Blinn-Phong: Simple shading with specularity.");
public static readonly GUIContent LIGHT_MODEL_URP = new GUIContent(
"Lighting Model",
"Lighting model to use.\n" +
"Universal Render Pipeline only use PBR model which yield high visual quality yet still performant.");
public static readonly GUIContent TEXTURING_MODEL = new GUIContent(
"Texturing Model",
"Terrain texturing/coloring method to use.\n" +
"- Gradient Lookup: use Gradients and Curves to shade the vertex based on it height and normal vector.\n" +
"- Color Map: Use a single Albedo map for the whole terrain. Fast but only suitable for small terrain.\n" +
"- Splats: Blend between multiple textures stacked on top of each others. Similar to Unity terrain.\n" +
"- Vertex Color: Use the color of each vertex to shade the terrain.");
public static readonly GUIContent SPLAT_MODEL = new GUIContent(
"Splats Model",
"Number of texture layers and whether to use normal maps or not.");
}
public static void DrawMaterialSettingsGUI()
{
EditorGUILayout.LabelField(GMaterialSettingsGUI.RP_LABEL, new GUIContent(GCommon.CurrentRenderPipeline.ToString()));
GUI.enabled = GCommon.CurrentRenderPipeline == GRenderPipelineType.Builtin;
GEditorSettings.Instance.wizardTools.lightingModel = (GLightingModel)EditorGUILayout.EnumPopup(
GCommon.CurrentRenderPipeline == GRenderPipelineType.Builtin ?
GMaterialSettingsGUI.LIGHT_MODEL_BUILTIN :
GMaterialSettingsGUI.LIGHT_MODEL_URP,
GEditorSettings.Instance.wizardTools.lightingModel);
if (GCommon.CurrentRenderPipeline == GRenderPipelineType.Universal)
{
GEditorSettings.Instance.wizardTools.lightingModel = GLightingModel.PBR;
}
GUI.enabled = true;
GEditorSettings.Instance.wizardTools.texturingModel = (GTexturingModel)EditorGUILayout.EnumPopup(GMaterialSettingsGUI.TEXTURING_MODEL, GEditorSettings.Instance.wizardTools.texturingModel);
if (GEditorSettings.Instance.wizardTools.texturingModel == GTexturingModel.Splat)
{
GEditorSettings.Instance.wizardTools.splatsModel = (GSplatsModel)EditorGUILayout.EnumPopup(GMaterialSettingsGUI.SPLAT_MODEL, GEditorSettings.Instance.wizardTools.splatsModel);
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb8df5b24cb8da34cafbdf272c30a69a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,120 @@
#if GRIFFIN
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using Pinwheel.Griffin.GroupTool;
using Pinwheel.Griffin.PaintTool;
using Pinwheel.Griffin.SplineTool;
using Pinwheel.Griffin.StampTool;
namespace Pinwheel.Griffin.Wizard
{
public class GWizardWindow : EditorWindow
{
private const int TAB_CREATE = 0;
private const int TAB_SET_SHADER = 1;
private const int TAB_EXTENSION = 2;
private int selectedTab;
private readonly string[] tabLabels = new string[]
{
"Create Level",
"Set Shader",
"Extension"
};
private void OnEnable()
{
GExtensionTabDrawer.ReloadExtension();
CheckForUrpFirstTimeImport();
}
private static GWizardWindow CreateWindow()
{
GWizardWindow window = GetWindow<GWizardWindow>();
Texture2D icon = EditorGUIUtility.isProSkin ?
GEditorSkin.Instance.GetTexture("IconWhite") :
GEditorSkin.Instance.GetTexture("IconBlack");
window.titleContent = new GUIContent(" " + GVersionInfo.ProductNameAndVersionShort, icon);
window.minSize = new Vector2(600, 500);
return window;
}
public static void ShowCreateLevelTab(MenuCommand menuCmd)
{
GWizardWindow window = CreateWindow();
GCreateLevelTabDrawer.menuCmd = menuCmd;
window.selectedTab = TAB_CREATE;
window.Show();
}
public static void ShowSetShaderTab(GStylizedTerrain terrain)
{
GEditorSettings.Instance.wizardTools.setShaderTerrain = terrain;
GWizardWindow window = CreateWindow();
window.selectedTab = TAB_SET_SHADER;
GSetShaderTabDrawer.bulkSetShader = false;
window.Show();
}
public static void ShowSetShaderTab(int groupId)
{
GEditorSettings.Instance.wizardTools.setShaderGroupId = groupId;
GWizardWindow window = CreateWindow();
window.selectedTab = TAB_SET_SHADER;
GSetShaderTabDrawer.bulkSetShader = true;
window.Show();
}
public static void ShowExtensionTab()
{
GWizardWindow window = CreateWindow();
window.selectedTab = TAB_EXTENSION;
window.Show();
}
public void OnGUI()
{
DrawTabs();
if (selectedTab == TAB_CREATE)
{
GCreateLevelTabDrawer.Draw();
EditorUtility.SetDirty(GEditorSettings.Instance);
}
else if (selectedTab == TAB_SET_SHADER)
{
GSetShaderTabDrawer.Draw();
EditorUtility.SetDirty(GEditorSettings.Instance);
}
else if (selectedTab == TAB_EXTENSION)
{
GExtensionTabDrawer.Draw();
}
}
private void DrawTabs()
{
GEditorCommon.Space();
selectedTab = GEditorCommon.Tabs(selectedTab, tabLabels);
GEditorCommon.Space();
}
private void CheckForUrpFirstTimeImport()
{
if (Application.isPlaying || EditorApplication.isPlayingOrWillChangePlaymode)
return;
if (GCommon.CurrentRenderPipeline == GRenderPipelineType.Universal)
{
if (!GPackageInitializer.isUrpSupportInstalled)
{
GUrpPackageImporter.Import();
}
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6af0b7c704da1b641931758010e70223
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: