Initial commit
This commit is contained in:
1 parent
ee9615239e
commit
16feac691f
4093 files changed
+1030491
No files matched your search
@@ -0,0 +1,396 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using static Gaia.GaiaConstants;
|
||||
|
||||
#if !GAIA_PRO_PRESENT
|
||||
|
||||
namespace Gaia
|
||||
{
|
||||
//public enum CurrentlyViewing { Unknown, Terrain, WorldMap }
|
||||
|
||||
[InitializeOnLoad]
|
||||
class Gaia2TopPanel
|
||||
{
|
||||
static Gaia2TopPanel()
|
||||
{
|
||||
SceneView.duringSceneGui -= RenderSceneGUI;
|
||||
SceneView.duringSceneGui += RenderSceneGUI;
|
||||
m_lastActiveScene = SceneManager.GetActiveScene();
|
||||
CheckForSessionManager();
|
||||
}
|
||||
|
||||
private static void CheckForSessionManager()
|
||||
{
|
||||
if (SessionManager != null)
|
||||
{
|
||||
m_sessionManagerExits = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sessionManagerExits = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool m_sessionManagerExits = false;
|
||||
private static Scene m_lastActiveScene;
|
||||
|
||||
private static GUIStyle GUIStylePanel;
|
||||
private static GUIStyle GUIStyleHeader;
|
||||
|
||||
|
||||
private static GaiaSessionManager m_sessionManager;
|
||||
private static Vector2 m_terrainOpScrollPos;
|
||||
//private static EditorUtils m_editorUtils;
|
||||
private static GaiaSessionManager SessionManager {
|
||||
get {
|
||||
if (m_sessionManager == null)
|
||||
{
|
||||
m_sessionManager = GaiaSessionManager.GetSessionManager(false,false);
|
||||
if (m_sessionManager == null)
|
||||
{
|
||||
m_sessionManagerExits = false;
|
||||
}
|
||||
}
|
||||
return m_sessionManager;
|
||||
}
|
||||
}
|
||||
|
||||
private static GaiaSettings m_gaiaSettings;
|
||||
private static GaiaSettings GaiaSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_gaiaSettings == null)
|
||||
{
|
||||
m_gaiaSettings = GaiaUtils.GetGaiaSettings();
|
||||
}
|
||||
return m_gaiaSettings;
|
||||
}
|
||||
}
|
||||
|
||||
private static Terrain m_worldMapTerrain;
|
||||
|
||||
private static Terrain WorldMapTerrain
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_worldMapTerrain == null)
|
||||
{
|
||||
m_worldMapTerrain = TerrainHelper.GetWorldMapTerrain();
|
||||
}
|
||||
return m_worldMapTerrain;
|
||||
}
|
||||
}
|
||||
|
||||
public static void RenderSceneGUI(SceneView sceneview)
|
||||
{
|
||||
if (m_lastActiveScene != SceneManager.GetActiveScene())
|
||||
{
|
||||
CheckForSessionManager();
|
||||
m_lastActiveScene = SceneManager.GetActiveScene();
|
||||
}
|
||||
|
||||
if (!m_sessionManagerExits)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (SessionManager == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (GUIStyleHeader == null)
|
||||
{
|
||||
GUIStyleHeader = new GUIStyle(GUI.skin.label);
|
||||
GUIStyleHeader.alignment = TextAnchor.MiddleCenter;
|
||||
GUIStyleHeader.fontStyle = FontStyle.Bold;
|
||||
}
|
||||
|
||||
if (GUIStylePanel == null)
|
||||
{
|
||||
GUIStylePanel = new GUIStyle();
|
||||
GUIStylePanel.padding = new RectOffset(0, 0, 0, 0);
|
||||
GUIStylePanel.margin = new RectOffset(0, 0, 0, 0);
|
||||
GUIStylePanel.alignment = TextAnchor.MiddleCenter;
|
||||
GUIStylePanel.border = new RectOffset(2, 2, 2, 2);
|
||||
GUIStylePanel.imagePosition = ImagePosition.ImageOnly;
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
GUIStylePanel.normal.background = GaiaSettings.m_originUIProBackgroundPro;
|
||||
GUIStylePanel.normal.textColor = Color.white;
|
||||
}
|
||||
else
|
||||
{
|
||||
GUIStylePanel.normal.background = GaiaSettings.m_originUIBackground;
|
||||
GUIStylePanel.normal.textColor = Color.black;
|
||||
}
|
||||
}
|
||||
|
||||
Handles.BeginGUI();
|
||||
|
||||
if (TerrainLoaderManager.Instance.TerrainSceneStorage.m_hasWorldMap)
|
||||
{
|
||||
DrawTopPanel();
|
||||
}
|
||||
Handles.EndGUI();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void DrawTopPanel()
|
||||
{
|
||||
bool currentGUIState = GUI.enabled;
|
||||
|
||||
float dpiScalingFactor = (96 / Screen.dpi);
|
||||
float scaledScreenWidth = (Camera.current.pixelRect.size.x * dpiScalingFactor);
|
||||
float scaledScreenHeight = (Camera.current.pixelRect.size.y * dpiScalingFactor);
|
||||
|
||||
|
||||
float sizeX = GaiaSettings.m_gaiaPanelSizeType == PositionType.Relative ? scaledScreenWidth * GaiaSettings.m_gaiaPanelSize.x / 100f : GaiaSettings.m_gaiaPanelSize.x;
|
||||
float sizeY = GaiaSettings.m_gaiaPanelSizeType == PositionType.Relative ? scaledScreenHeight * GaiaSettings.m_gaiaPanelSize.y / 100f : GaiaSettings.m_gaiaPanelSize.y;
|
||||
float x = GaiaSettings.m_gaiaPanelPositionType == PositionType.Relative ? (scaledScreenWidth * GaiaSettings.m_gaiaPanelPosition.x / 100f) - (sizeX + 50f) / 2f : GaiaSettings.m_gaiaPanelPosition.x;
|
||||
float y = GaiaSettings.m_gaiaPanelPositionType == PositionType.Relative ? (scaledScreenHeight * GaiaSettings.m_gaiaPanelPosition.y / 100f) : GaiaSettings.m_gaiaPanelPosition.y;
|
||||
|
||||
GUILayout.BeginArea(new Rect(x, y, sizeX+50, sizeY));
|
||||
float leftSpace = 6f;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.FlexibleSpace();
|
||||
EditorGUILayout.BeginVertical(GUIStylePanel, GUILayout.MaxWidth(sizeX));
|
||||
{
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Space(leftSpace);
|
||||
if (GUILayout.Button("Manager", GUILayout.Height(15), GUILayout.Width(70)))
|
||||
{
|
||||
var manager = EditorWindow.GetWindow<Gaia.GaiaManagerEditor>(false, "Gaia Manager");
|
||||
//Manager can be null if the dependency package installation is started upon opening the manager window.
|
||||
if (manager != null)
|
||||
{
|
||||
Vector2 initialSize = new Vector2(650f, 450f);
|
||||
manager.position = new Rect(new Vector2(Screen.currentResolution.width / 2f - initialSize.x / 2f, Screen.currentResolution.height / 2f - initialSize.y / 2f), initialSize);
|
||||
manager.Show();
|
||||
}
|
||||
}
|
||||
|
||||
if (TerrainLoaderManager.Instance.TerrainSceneStorage.m_hasWorldMap)
|
||||
{
|
||||
GUILayout.Label("Gaia", GUIStyleHeader, GUILayout.MaxHeight(16));
|
||||
if (WorldMapTerrain != null)
|
||||
{
|
||||
if (!GaiaUtils.HasTerrains())
|
||||
{
|
||||
GUI.enabled = false;
|
||||
}
|
||||
if (GUILayout.Button("Terrain", GUILayout.Height(15), GUILayout.Width(75)))
|
||||
{
|
||||
TerrainLoaderManager.Instance.SwitchToLocalMap();
|
||||
}
|
||||
GUI.enabled = currentGUIState;
|
||||
|
||||
|
||||
if (GUILayout.Button("Designer", GUILayout.Height(15), GUILayout.Width(75)))
|
||||
{
|
||||
TerrainLoaderManager.Instance.SwitchToWorldMap();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//GUILayout.Space(200);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(-50);
|
||||
GUILayout.Label("Gaia", GUIStyleHeader, GUILayout.MaxHeight(16));
|
||||
if (!TerrainLoaderManager.Instance.ShowLocalTerrain)
|
||||
{
|
||||
TerrainLoaderManager.Instance.SwitchToLocalMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
#if GAIA_PRO_PRESENT
|
||||
if (SessionManager.m_showSceneViewPanel)
|
||||
{
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label("Go To Terrain:", GUILayout.Width(100));
|
||||
GUILayout.Label("X", GUILayout.Width(coordLabelWidth));
|
||||
GaiaTerrainLoaderManager.Instance.m_originTargetTileX = EditorGUILayout.DelayedIntField(GaiaTerrainLoaderManager.Instance.m_originTargetTileX, GUILayout.Width(coordInputWidth));
|
||||
GUILayout.Space(84);
|
||||
GUILayout.Label("Z", GUILayout.Width(coordLabelWidth));
|
||||
GaiaTerrainLoaderManager.Instance.m_originTargetTileZ = EditorGUILayout.DelayedIntField(GaiaTerrainLoaderManager.Instance.m_originTargetTileZ, GUILayout.Width(coordInputWidth));
|
||||
if (GUILayout.Button("Go", GUILayout.Height(15), GUILayout.Width(52)))
|
||||
{
|
||||
GaiaTerrainLoaderManager.Instance.SetOriginByTargetTile();
|
||||
range = GaiaTerrainLoaderManager.Instance.GetLoadingRange();
|
||||
currentPos = GaiaTerrainLoaderManager.Instance.GetOrigin();
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label("Selected:", GUILayout.Width(100));
|
||||
if (Selection.activeObject != null)
|
||||
{
|
||||
if (Selection.activeObject.GetType() == typeof(GameObject))
|
||||
{
|
||||
GameObject selectedObject = (GameObject)Selection.activeObject;
|
||||
if (selectedObject.scene != null)
|
||||
{
|
||||
|
||||
GUILayout.Label("X", GUILayout.Width(coordLabelWidth));
|
||||
GUILayout.Label((selectedObject.transform.position.x + currentPos.x).ToString(), GUILayout.Width(coordInputWidth));
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label("Y", GUILayout.Width(coordLabelWidth));
|
||||
GUILayout.Label((selectedObject.transform.position.y + currentPos.y).ToString(), GUILayout.Width(coordInputWidth));
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label("Z", GUILayout.Width(coordLabelWidth));
|
||||
GUILayout.Label((selectedObject.transform.position.z + currentPos.z).ToString(), GUILayout.Width(coordInputWidth));
|
||||
GUI.enabled = !Application.isPlaying;
|
||||
if (GUILayout.Button("Center", GUILayout.Height(15)))
|
||||
{
|
||||
currentPos = new Vector3Double(selectedObject.transform.position.x + currentPos.x, selectedObject.transform.position.y + currentPos.y, selectedObject.transform.position.z + currentPos.z);
|
||||
bool needsShift = true;
|
||||
|
||||
//Check if we should shift the selected object around as well
|
||||
if (selectedObject.scene != SessionManager.gameObject.scene)
|
||||
{
|
||||
//in a separate scene from session manager -> should be shifted automatically
|
||||
needsShift = false;
|
||||
}
|
||||
|
||||
if (needsShift && selectedObject.transform.GetComponentInParent<Terrain>() != null)
|
||||
{
|
||||
//child of a terrain -> should be shifted automatically
|
||||
needsShift = false;
|
||||
}
|
||||
|
||||
if (needsShift && selectedObject.transform.GetComponentInParent<FloatingPointFixMember>() != null)
|
||||
{
|
||||
//is child of a floating point fix member -> should be shifted automatically
|
||||
needsShift = false;
|
||||
}
|
||||
|
||||
if (needsShift)
|
||||
{
|
||||
//still needs to be shifted -> ask the user if they wish to add a floating point fix
|
||||
if (EditorUtility.DisplayDialog("Shift centered object?", "You are about to center on an object that does not seem to be set up to be shifted together with the world origin. Do you want to add a Floating Point Fix Member component on this object so that it will be shifted with the world, or do you want the object not to be affected by the shift?", "Add component", "Leave object in place"))
|
||||
{
|
||||
selectedObject.AddComponent<FloatingPointFixMember>();
|
||||
}
|
||||
}
|
||||
}
|
||||
GUI.enabled = currentGUIState;
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
{
|
||||
GUI.enabled = !Application.isPlaying;
|
||||
GUILayout.Label("Origin:", GUILayout.Width(100));
|
||||
GUILayout.Label("X", GUILayout.Width(coordLabelWidth));
|
||||
currentPos.x = EditorGUILayout.DelayedDoubleField(currentPos.x, GUILayout.Width(coordInputWidth));
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label("Y", GUILayout.Width(coordLabelWidth));
|
||||
currentPos.y = EditorGUILayout.DelayedDoubleField(currentPos.y, GUILayout.Width(coordInputWidth));
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label("Z", GUILayout.Width(coordLabelWidth));
|
||||
currentPos.z = EditorGUILayout.DelayedDoubleField(currentPos.z, GUILayout.Width(coordInputWidth));
|
||||
GUILayout.Space(56);
|
||||
GUI.enabled = currentGUIState;
|
||||
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUI.enabled = !Application.isPlaying;
|
||||
{
|
||||
GUILayout.Label("Loading Range:", GUILayout.Width(115));
|
||||
range = EditorGUILayout.DelayedDoubleField(range, GUILayout.Width(60));
|
||||
GUILayout.Space(25);
|
||||
SessionManager.m_showOriginLoadingBounds = EditorGUILayout.Toggle("Show Loading Range", SessionManager.m_showOriginLoadingBounds);
|
||||
}
|
||||
GUI.enabled = currentGUIState;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
{
|
||||
if (GUILayout.Button("Show Loader Manager...", GUILayout.Height(15), GUILayout.Width(180)))
|
||||
{
|
||||
GameObject loaderObj = GaiaUtils.GetTerrainLoaderManagerObject();
|
||||
Selection.activeObject = loaderObj;
|
||||
}
|
||||
GUILayout.Space(25);
|
||||
SessionManager.m_showOriginTerrainBoxes = EditorGUILayout.Toggle("Show Terrain Boxes", SessionManager.m_showOriginTerrainBoxes);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// GUILayout.Space(Camera.current.pixelRect.size.x / 2f + 188);
|
||||
//}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
GUIContent buttonContent = null;
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
if (SessionManager.m_showSceneViewPanel)
|
||||
{
|
||||
buttonContent = new GUIContent(GaiaSettings.m_originUIProUnfoldUp, "Hide Gaia Panel");
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonContent = new GUIContent(GaiaSettings.m_originUIProUnfoldDown, "Show Gaia Panel");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SessionManager.m_showSceneViewPanel)
|
||||
{
|
||||
buttonContent = new GUIContent(GaiaSettings.m_originUIUnfoldUp, "Hide Gaia Panel");
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonContent = new GUIContent(GaiaSettings.m_originUIUnfoldDown, "Show Gaia Panel");
|
||||
}
|
||||
}
|
||||
if (GUILayout.Button(new GUIContent(buttonContent), GUIStylePanel, GUILayout.Width(20), GUILayout.Height(20)))
|
||||
{
|
||||
SessionManager.m_showSceneViewPanel = !SessionManager.m_showSceneViewPanel;
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
#else
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
#endif
|
||||
GUILayout.EndArea();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d713f54456bdd6044823775fb6fa6be7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+588
@@ -0,0 +1,588 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using PWCommon4;
|
||||
using Gaia.Internal;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.Profiling;
|
||||
|
||||
namespace Gaia
|
||||
{
|
||||
[CustomEditor(typeof(TerrainLoaderManager))]
|
||||
public class TerrainLoaderManagerEditor : PWEditor, IPWEditor
|
||||
{
|
||||
private TerrainLoaderManager m_terrainLoaderManager;
|
||||
#if GAIA_PRO_PRESENT
|
||||
private TerrainLoader[] m_terrainLoaders;
|
||||
#endif
|
||||
private EditorUtils m_editorUtils;
|
||||
private GUIStyle m_terrainBoxStyle;
|
||||
private Terrain m_ingestTerrain;
|
||||
private static List<Texture2D> m_tempTextureList = new List<Texture2D>();
|
||||
private GUIStyle redStyle;
|
||||
private GUIStyle greenStyle;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
m_terrainLoaderManager = (TerrainLoaderManager)target;
|
||||
#if GAIA_PRO_PRESENT
|
||||
m_terrainLoaders = Resources.FindObjectsOfTypeAll<TerrainLoader>();
|
||||
#endif
|
||||
//m_placeHolders = Resources.FindObjectsOfTypeAll<GaiaTerrainPlaceHolder>();
|
||||
//m_placeHolders = m_placeHolders.OrderBy(x => x.name).ToArray();
|
||||
//foreach (GaiaTerrainPlaceHolder placeHolder in m_placeHolders)
|
||||
//{
|
||||
// placeHolder.UpdateLoadState();
|
||||
//}
|
||||
|
||||
//Init editor utils
|
||||
if (m_editorUtils == null)
|
||||
{
|
||||
// Get editor utils for this
|
||||
m_editorUtils = PWApp.GetEditorUtils(this);
|
||||
}
|
||||
|
||||
m_terrainLoaderManager.LookUpLoadingScreen();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
for (int i = 0; i < m_tempTextureList.Count; i++)
|
||||
{
|
||||
UnityEngine.Object.DestroyImmediate(m_tempTextureList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (redStyle == null || redStyle.normal.background == null || greenStyle == null || greenStyle.normal.background == null)
|
||||
{
|
||||
redStyle = new GUIStyle();
|
||||
redStyle.normal.background = GaiaUtils.GetBGTexture(Color.red, m_tempTextureList);
|
||||
|
||||
greenStyle = new GUIStyle();
|
||||
greenStyle.normal.background = GaiaUtils.GetBGTexture(Color.green, m_tempTextureList);
|
||||
}
|
||||
|
||||
|
||||
//Init editor utils
|
||||
if (m_editorUtils == null)
|
||||
{
|
||||
// Get editor utils for this
|
||||
m_editorUtils = PWApp.GetEditorUtils(this);
|
||||
}
|
||||
m_editorUtils.Initialize(); // Do not remove this!
|
||||
if (GaiaUtils.HasDynamicLoadedTerrains())
|
||||
{
|
||||
m_editorUtils.Panel("GeneralSettings", DrawGeneralSettings, true);
|
||||
m_editorUtils.Panel("LoaderPanel", DrawLoaders, false);
|
||||
m_editorUtils.Panel("PlaceholderPanel", DrawTerrains, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoTerrainLoadingMessage"),MessageType.Info);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawGeneralSettings(bool helpEnabled)
|
||||
{
|
||||
m_terrainLoaderManager.TerrainSceneStorage = (TerrainSceneStorage)m_editorUtils.ObjectField("TerrainSceneStorage", m_terrainLoaderManager.TerrainSceneStorage, typeof(TerrainSceneStorage), false, helpEnabled);
|
||||
|
||||
bool oldLoadingEnabled = m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled;
|
||||
m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled = m_editorUtils.Toggle("TerrainLoadingEnabled", m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled, helpEnabled);
|
||||
if (!oldLoadingEnabled && m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled)
|
||||
{
|
||||
//User re-enabled the loaders
|
||||
m_terrainLoaderManager.UpdateTerrainLoadState();
|
||||
}
|
||||
if (oldLoadingEnabled != m_terrainLoaderManager.TerrainSceneStorage.m_terrainLoadingEnabled)
|
||||
{
|
||||
//Value was changed, dirty the object to make sure the value is being saved
|
||||
EditorUtility.SetDirty(m_terrainLoaderManager.TerrainSceneStorage);
|
||||
}
|
||||
|
||||
bool originalGUIState = GUI.enabled;
|
||||
|
||||
m_terrainLoaderManager.m_terrainLoadingTresholdMS = m_editorUtils.IntField("LoadingTimeTreshold", m_terrainLoaderManager.m_terrainLoadingTresholdMS, helpEnabled);
|
||||
m_terrainLoaderManager.m_trackLoadingProgressTimeOut = m_editorUtils.LongField("LoadingProgressTimeout", m_terrainLoaderManager.m_trackLoadingProgressTimeOut, helpEnabled);
|
||||
GUILayout.Space(10);
|
||||
m_editorUtils.Heading("SceneViewLoading");
|
||||
m_terrainLoaderManager.CenterSceneViewLoadingOn = (CenterSceneViewLoadingOn)m_editorUtils.EnumPopup("CenterSceneViewLoadingOn", m_terrainLoaderManager.CenterSceneViewLoadingOn, helpEnabled);
|
||||
double loadingRange = m_editorUtils.DoubleField("SceneViewLoadingRange", m_terrainLoaderManager.GetLoadingRange(), helpEnabled);
|
||||
double impostorLoadingRange = m_terrainLoaderManager.GetImpostorLoadingRange();
|
||||
if (GaiaUtils.HasImpostorTerrains())
|
||||
{
|
||||
impostorLoadingRange = m_editorUtils.DoubleField("SceneViewImpostorLoadingRange", m_terrainLoaderManager.GetImpostorLoadingRange(), helpEnabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
m_editorUtils.Label("SceneViewImpostorLoadingRange");
|
||||
//offer button to create impostors setup
|
||||
if (m_editorUtils.Button("OpenTerrainMeshExporterForImpostors", GUILayout.Width(EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 38)))
|
||||
{
|
||||
ExportTerrain exportTerrainWindow = EditorWindow.GetWindow<ExportTerrain>();
|
||||
exportTerrainWindow.FindAndSetPreset("Create Impostors");
|
||||
exportTerrainWindow.m_settings.m_customSettingsFoldedOut = false;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
}
|
||||
|
||||
if (loadingRange != m_terrainLoaderManager.GetLoadingRange() || impostorLoadingRange != m_terrainLoaderManager.GetImpostorLoadingRange())
|
||||
{
|
||||
m_terrainLoaderManager.SetLoadingRange(loadingRange, impostorLoadingRange);
|
||||
}
|
||||
|
||||
GUILayout.Space(10);
|
||||
m_editorUtils.Heading("CachingSettings");
|
||||
m_editorUtils.InlineHelp("CachingSettings", helpEnabled);
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_terrainLoaderManager.m_cacheInRuntime = m_editorUtils.Toggle("CacheInRuntime", m_terrainLoaderManager.m_cacheInRuntime, helpEnabled);
|
||||
m_terrainLoaderManager.m_cacheInEditor = m_editorUtils.Toggle("CacheInEditor", m_terrainLoaderManager.m_cacheInEditor, helpEnabled);
|
||||
string allocatedMegabytes = (Math.Round(Profiler.GetTotalAllocatedMemoryLong() / Math.Pow(1024, 2))).ToString();
|
||||
string availableMegabytes = SystemInfo.systemMemorySize.ToString();
|
||||
allocatedMegabytes = allocatedMegabytes.PadLeft(allocatedMegabytes.Length + (availableMegabytes.Length - allocatedMegabytes.Length) * 3 , ' ');
|
||||
|
||||
GUIStyle style = new GUIStyle(GUI.skin.label);
|
||||
|
||||
if (m_terrainLoaderManager.m_cacheMemoryThreshold < Profiler.GetTotalAllocatedMemoryLong())
|
||||
{
|
||||
style = redStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
style = greenStyle;
|
||||
}
|
||||
m_editorUtils.LabelField("MemoryAvailable", new GUIContent(availableMegabytes), helpEnabled);
|
||||
m_editorUtils.LabelField("MemoryAllocated", new GUIContent(allocatedMegabytes), style, helpEnabled);
|
||||
|
||||
//GUI.color = originalGUIColor;
|
||||
|
||||
if (m_terrainLoaderManager.m_cacheInRuntime || m_terrainLoaderManager.m_cacheInEditor)
|
||||
{
|
||||
m_terrainLoaderManager.m_cacheMemoryThresholdPreset = (CacheSizePreset)m_editorUtils.EnumPopup("CacheMemoryThreshold", m_terrainLoaderManager.m_cacheMemoryThresholdPreset, helpEnabled);
|
||||
if (m_terrainLoaderManager.m_cacheMemoryThresholdPreset == CacheSizePreset.Custom)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
m_terrainLoaderManager.m_cacheMemoryThreshold = m_editorUtils.LongField("ThresholdInBytes", m_terrainLoaderManager.m_cacheMemoryThreshold, helpEnabled);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
int cacheKeepAliveSeconds = (int)m_terrainLoaderManager.m_cacheKeepAliveTime / 1000;
|
||||
cacheKeepAliveSeconds = m_editorUtils.IntField("CacheKeepAliveSeconds", cacheKeepAliveSeconds, helpEnabled);
|
||||
m_terrainLoaderManager.m_cacheKeepAliveTime = cacheKeepAliveSeconds * 1000;
|
||||
}
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
if (m_terrainLoaderManager.m_cacheMemoryThresholdPreset != CacheSizePreset.Custom)
|
||||
{
|
||||
m_terrainLoaderManager.m_cacheMemoryThreshold = (long)((int)m_terrainLoaderManager.m_cacheMemoryThresholdPreset * Math.Pow(1024, 3));
|
||||
}
|
||||
m_terrainLoaderManager.UpdateCaching();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
if (!GaiaUtils.HasColliderTerrains())
|
||||
{
|
||||
GUI.enabled = false;
|
||||
}
|
||||
|
||||
m_editorUtils.Heading("ColliderOnlyLoadingHeader");
|
||||
//This flag is special in so far as that when the user switches it, we must first perform a scene unload while the old value is still active
|
||||
//then change the flag in the terrain scene storage and then do a refresh with the new setting applied.
|
||||
bool colliderLoadingEnabled = m_terrainLoaderManager.TerrainSceneStorage.m_colliderOnlyLoading;
|
||||
colliderLoadingEnabled = m_editorUtils.Toggle("ColliderOnlyLoadingEnabled", colliderLoadingEnabled, helpEnabled);
|
||||
if (colliderLoadingEnabled != m_terrainLoaderManager.TerrainSceneStorage.m_colliderOnlyLoading)
|
||||
{
|
||||
//User changed the flag, do an unload with the old setting
|
||||
m_terrainLoaderManager.UnloadAll(true);
|
||||
//then change the actual flag in storage
|
||||
m_terrainLoaderManager.TerrainSceneStorage.m_colliderOnlyLoading = colliderLoadingEnabled;
|
||||
//now do a refresh under the new setting
|
||||
m_terrainLoaderManager.RefreshSceneViewLoadingRange();
|
||||
|
||||
//Add the required scenes to build settings
|
||||
if (colliderLoadingEnabled)
|
||||
{
|
||||
GaiaSessionManager.AddOnlyColliderScenesToBuildSettings(TerrainLoaderManager.TerrainScenes);
|
||||
}
|
||||
else
|
||||
{
|
||||
GaiaSessionManager.AddTerrainScenesToBuildSettings(TerrainLoaderManager.TerrainScenes);
|
||||
}
|
||||
}
|
||||
|
||||
GUI.enabled = originalGUIState;
|
||||
|
||||
if (colliderLoadingEnabled)
|
||||
{
|
||||
EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("ColliderOnlyLoadingInfo"), MessageType.Info);
|
||||
m_editorUtils.Heading("DeactivateRuntimeHeader");
|
||||
EditorGUI.indentLevel++;
|
||||
m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimePlayer = m_editorUtils.Toggle("DeactivateRuntimePlayer", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimePlayer, helpEnabled);
|
||||
m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeLighting = m_editorUtils.Toggle("DeactivateRuntimeLighting", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeLighting, helpEnabled);
|
||||
m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeAudio = m_editorUtils.Toggle("DeactivateRuntimeAudio", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeAudio, helpEnabled);
|
||||
m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWeather = m_editorUtils.Toggle("DeactivateRuntimeWeather", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWeather, helpEnabled);
|
||||
m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWater = m_editorUtils.Toggle("DeactivateRuntimeWater", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeWater, helpEnabled);
|
||||
m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeScreenShotter = m_editorUtils.Toggle("DeactivateRuntimeScreenShotter", m_terrainLoaderManager.TerrainSceneStorage.m_deactivateRuntimeScreenShotter, helpEnabled);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
{
|
||||
//offer button to create collider setup
|
||||
if (m_editorUtils.Button("OpenTerrainMeshExporterForColliders"))
|
||||
{
|
||||
ExportTerrain exportTerrainWindow = EditorWindow.GetWindow<ExportTerrain>();
|
||||
exportTerrainWindow.FindAndSetPreset("Collider");
|
||||
exportTerrainWindow.m_settings.m_customSettingsFoldedOut = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawTerrains(bool helpEnabled)
|
||||
{
|
||||
bool originalGUIState = GUI.enabled;
|
||||
|
||||
#if GAIA_PRO_PRESENT
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
m_editorUtils.Label("IngestTerrain", GUILayout.Width(100));
|
||||
m_ingestTerrain = (Terrain)EditorGUILayout.ObjectField(m_ingestTerrain, typeof(Terrain), true);
|
||||
if (m_editorUtils.Button("Ingest"))
|
||||
{
|
||||
////Try to find the X and Z coordinate for the scene name
|
||||
//double minX = m_terrainLoaderManager.TerrainSceneStorage.m_terrainScenes.Select(x => x.m_pos.x).Min();
|
||||
//double maxX = m_terrainLoaderManager.TerrainSceneStorage.m_terrainScenes.Select(x => x.m_pos.x).Max();
|
||||
//double minZ = m_terrainLoaderManager.TerrainSceneStorage.m_terrainScenes.Select(x => x.m_pos.z).Min();
|
||||
//double maxZ = m_terrainLoaderManager.TerrainSceneStorage.m_terrainScenes.Select(x => x.m_pos.z).Max();
|
||||
GaiaSessionManager sessionManager = GaiaSessionManager.GetSessionManager();
|
||||
WorldCreationSettings worldCreationSettings = new WorldCreationSettings()
|
||||
{
|
||||
m_autoUnloadScenes = false,
|
||||
m_applyFloatingPointFix = TerrainLoaderManager.Instance.TerrainSceneStorage.m_useFloatingPointFix,
|
||||
m_isWorldMap = false
|
||||
};
|
||||
TerrainScene newScene = TerrainSceneCreator.CreateTerrainScene(m_ingestTerrain.gameObject.scene, TerrainLoaderManager.Instance.TerrainSceneStorage, sessionManager.m_session, m_ingestTerrain.gameObject, worldCreationSettings);
|
||||
TerrainLoaderManager.Instance.TerrainSceneStorage.m_terrainScenes.Add(newScene);
|
||||
TerrainLoaderManager.Instance.SaveStorageData();
|
||||
GaiaSessionManager.AddTerrainScenesToBuildSettings(new List<TerrainScene>() { newScene});
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
GUILayout.Space(EditorGUIUtility.singleLineHeight);
|
||||
#endif
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (m_editorUtils.Button("AddToBuildSettings"))
|
||||
{
|
||||
if (TerrainLoaderManager.ColliderOnlyLoadingActive)
|
||||
{
|
||||
if (EditorUtility.DisplayDialog(m_editorUtils.GetTextValue("AddColliderScenesToBuildSettingsPopupTitle"), m_editorUtils.GetTextValue("AddColliderScenesToBuildSettingsPopupText"), m_editorUtils.GetTextValue("Continue"), m_editorUtils.GetTextValue("Cancel")))
|
||||
{
|
||||
#if GAIA_PRO_PRESENT
|
||||
GaiaSessionManager.AddOnlyColliderScenesToBuildSettings(m_terrainLoaderManager.TerrainSceneStorage.m_terrainScenes);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EditorUtility.DisplayDialog(m_editorUtils.GetTextValue("AddToBuildSettingsPopupTitle"), m_editorUtils.GetTextValue("AddToBuildSettingsPopupText"), m_editorUtils.GetTextValue("Continue"), m_editorUtils.GetTextValue("Cancel")))
|
||||
{
|
||||
#if GAIA_PRO_PRESENT
|
||||
GaiaSessionManager.AddTerrainScenesToBuildSettings(m_terrainLoaderManager.TerrainSceneStorage.m_terrainScenes);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (m_editorUtils.Button("UnloadAll"))
|
||||
{
|
||||
m_terrainLoaderManager.SetLoadingRange(0, 0);
|
||||
m_terrainLoaderManager.UnloadAll(true);
|
||||
}
|
||||
if (m_editorUtils.Button("LoadAll"))
|
||||
{
|
||||
if (EditorUtility.DisplayDialog(m_editorUtils.GetTextValue("LoadAllPopupTitle"), m_editorUtils.GetTextValue("LoadAllPopupText"), m_editorUtils.GetTextValue("Continue"), m_editorUtils.GetTextValue("Cancel")))
|
||||
{
|
||||
foreach (TerrainScene terrainScene in m_terrainLoaderManager.TerrainSceneStorage.m_terrainScenes)
|
||||
{
|
||||
m_terrainLoaderManager.SetLoadingRange(100000, m_terrainLoaderManager.GetImpostorLoadingRange());
|
||||
terrainScene.AddRegularReference(m_terrainLoaderManager.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (!GaiaUtils.HasImpostorTerrains())
|
||||
{
|
||||
GUI.enabled = false;
|
||||
}
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (m_editorUtils.Button("UnloadAllImpostors"))
|
||||
{
|
||||
m_terrainLoaderManager.SetLoadingRange(m_terrainLoaderManager.GetLoadingRange(), 0);
|
||||
m_terrainLoaderManager.UnloadAllImpostors(true);
|
||||
}
|
||||
if (m_editorUtils.Button("LoadAllImpostors"))
|
||||
{
|
||||
if (EditorUtility.DisplayDialog(m_editorUtils.GetTextValue("LoadAllPopupTitle"), m_editorUtils.GetTextValue("LoadAllImpostorsPopupText"), m_editorUtils.GetTextValue("Continue"), m_editorUtils.GetTextValue("Cancel")))
|
||||
{
|
||||
m_terrainLoaderManager.SetLoadingRange(m_terrainLoaderManager.GetLoadingRange(), 100000);
|
||||
foreach (TerrainScene terrainScene in m_terrainLoaderManager.TerrainSceneStorage.m_terrainScenes)
|
||||
{
|
||||
terrainScene.AddImpostorReference(m_terrainLoaderManager.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
GUI.enabled = originalGUIState;
|
||||
|
||||
GUILayout.Space(EditorGUIUtility.singleLineHeight);
|
||||
|
||||
float buttonWidth1 = 110;
|
||||
float buttonWidth2 = 60;
|
||||
|
||||
if (m_terrainBoxStyle == null || m_terrainBoxStyle.normal.background == null)
|
||||
{
|
||||
m_terrainBoxStyle = new GUIStyle(EditorStyles.helpBox);
|
||||
m_terrainBoxStyle.margin = new RectOffset(0, 0, 0, 0);
|
||||
m_terrainBoxStyle.padding = new RectOffset(3, 3, 3, 3);
|
||||
}
|
||||
|
||||
int removeIndex = -99;
|
||||
int currentIndex = 0;
|
||||
|
||||
foreach (TerrainScene terrainScene in m_terrainLoaderManager.TerrainSceneStorage.m_terrainScenes)
|
||||
{
|
||||
EditorGUILayout.BeginVertical(m_terrainBoxStyle);
|
||||
{
|
||||
EditorGUILayout.LabelField(terrainScene.GetTerrainName());
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
bool isLoaded = terrainScene.m_regularLoadState == LoadState.Loaded && terrainScene.TerrainObj != null && terrainScene.TerrainObj.activeInHierarchy;
|
||||
bool isImpostorLoaded = terrainScene.m_impostorLoadState == LoadState.Loaded || terrainScene.m_impostorLoadState == LoadState.Cached;
|
||||
|
||||
bool currentGUIState = GUI.enabled;
|
||||
GUI.enabled = isLoaded;
|
||||
if (m_editorUtils.Button("SelectPlaceholder", GUILayout.Width(buttonWidth1)))
|
||||
{
|
||||
Selection.activeGameObject = GameObject.Find(terrainScene.GetTerrainName());
|
||||
EditorGUIUtility.PingObject(Selection.activeObject);
|
||||
}
|
||||
GUI.enabled = currentGUIState;
|
||||
if (isLoaded)
|
||||
{
|
||||
if (m_editorUtils.Button("UnloadPlaceholder", GUILayout.Width(buttonWidth2)))
|
||||
{
|
||||
if (ResetToWorldOriginLoading())
|
||||
{
|
||||
terrainScene.RemoveAllReferences(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_editorUtils.Button("LoadPlaceholder", GUILayout.Width(buttonWidth2)))
|
||||
{
|
||||
if (ResetToWorldOriginLoading())
|
||||
{
|
||||
terrainScene.AddRegularReference(m_terrainLoaderManager.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(terrainScene.m_impostorScenePath))
|
||||
{
|
||||
GUI.enabled = false;
|
||||
}
|
||||
|
||||
if (isImpostorLoaded)
|
||||
{
|
||||
if (m_editorUtils.Button("UnLoadImpostor", GUILayout.Width(buttonWidth1)))
|
||||
{
|
||||
if (ResetToWorldOriginLoading())
|
||||
{
|
||||
terrainScene.RemoveImpostorReference(m_terrainLoaderManager.gameObject, 0, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_editorUtils.Button("LoadImpostor", GUILayout.Width(buttonWidth1)))
|
||||
{
|
||||
if (ResetToWorldOriginLoading())
|
||||
{
|
||||
terrainScene.AddImpostorReference(m_terrainLoaderManager.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUI.enabled = originalGUIState;
|
||||
|
||||
if (m_editorUtils.Button("RemoveScene"))
|
||||
{
|
||||
if (EditorUtility.DisplayDialog(m_editorUtils.GetTextValue("RemoveSceneTitle"), m_editorUtils.GetTextValue("RemoveSceneText"), m_editorUtils.GetTextValue("Continue"), m_editorUtils.GetTextValue("Cancel")))
|
||||
{
|
||||
removeIndex = currentIndex;
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (terrainScene.RegularReferences.Count > 0)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
terrainScene.m_isFoldedOut = m_editorUtils.Foldout(terrainScene.m_isFoldedOut, "ShowTerrainReferences");
|
||||
if (terrainScene.m_isFoldedOut)
|
||||
{
|
||||
|
||||
foreach (GameObject go in terrainScene.RegularReferences)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Space(20);
|
||||
m_editorUtils.Label(new GUIContent(go.name, m_editorUtils.GetTextValue("TerrainReferenceToolTip")));
|
||||
if (m_editorUtils.Button("TerrainReferenceSelect", GUILayout.Width(buttonWidth1)))
|
||||
{
|
||||
Selection.activeObject = go;
|
||||
SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
if (m_editorUtils.Button("TerrainReferenceRemove", GUILayout.Width(buttonWidth2)))
|
||||
{
|
||||
terrainScene.RemoveRegularReference(go);
|
||||
}
|
||||
GUILayout.Space(100);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
if (terrainScene.ImpostorReferences.Count > 0)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
terrainScene.m_isFoldedOut = m_editorUtils.Foldout(terrainScene.m_isFoldedOut, "ShowImpostorReferences");
|
||||
if (terrainScene.m_isFoldedOut)
|
||||
{
|
||||
|
||||
foreach (GameObject go in terrainScene.ImpostorReferences)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Space(20);
|
||||
m_editorUtils.Label(new GUIContent(go.name, m_editorUtils.GetTextValue("TerrainReferenceToolTip")));
|
||||
if (m_editorUtils.Button("TerrainReferenceSelect", GUILayout.Width(buttonWidth1)))
|
||||
{
|
||||
Selection.activeObject = go;
|
||||
SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
if (m_editorUtils.Button("TerrainReferenceRemove", GUILayout.Width(buttonWidth2)))
|
||||
{
|
||||
terrainScene.RemoveImpostorReference(go);
|
||||
}
|
||||
GUILayout.Space(100);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.Space(5f);
|
||||
currentIndex++;
|
||||
}
|
||||
|
||||
if (removeIndex != -99)
|
||||
{
|
||||
AssetDatabase.DeleteAsset(m_terrainLoaderManager.TerrainSceneStorage.m_terrainScenes[removeIndex].m_scenePath);
|
||||
m_terrainLoaderManager.TerrainSceneStorage.m_terrainScenes.RemoveAt(removeIndex);
|
||||
m_terrainLoaderManager.SaveStorageData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the scene view loading is currently set to center on world origin, if not, prompts the user to switch.
|
||||
/// Used when loading in and out single terrains which would clash with the scene view camera loading mode.
|
||||
/// </summary>
|
||||
/// <returns>True if the scene was already on World Origin mode, or if the switch was performed.</returns>
|
||||
private bool ResetToWorldOriginLoading()
|
||||
{
|
||||
if (m_terrainLoaderManager.CenterSceneViewLoadingOn != CenterSceneViewLoadingOn.WorldOrigin)
|
||||
{
|
||||
if (EditorUtility.DisplayDialog(m_editorUtils.GetTextValue("ManualLoadPopUpTitle"), m_editorUtils.GetTextValue("ManualLoadPopUpText"), m_editorUtils.GetTextValue("Continue"), m_editorUtils.GetTextValue("Cancel")))
|
||||
{
|
||||
m_terrainLoaderManager.CenterSceneViewLoadingOn = CenterSceneViewLoadingOn.WorldOrigin;
|
||||
m_terrainLoaderManager.SetLoadingRange(0,0);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawLoaders(bool helpEnabled)
|
||||
{
|
||||
bool originalGUIState = GUI.enabled;
|
||||
EditorGUIUtility.labelWidth = 20;
|
||||
#if GAIA_PRO_PRESENT
|
||||
foreach (TerrainLoader terrainLoader in m_terrainLoaders)
|
||||
{
|
||||
if (terrainLoader != null)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(terrainLoader.name);
|
||||
terrainLoader.LoadMode = (LoadMode)EditorGUILayout.EnumPopup(terrainLoader.LoadMode);
|
||||
if (m_editorUtils.Button("SelectLoader", GUILayout.MaxWidth(100)))
|
||||
{
|
||||
Selection.activeGameObject = terrainLoader.gameObject;
|
||||
EditorGUIUtility.PingObject(Selection.activeObject);
|
||||
|
||||
//Try to find out which kind of Gaia Tool that is, and open / highlight the terrain loading settings where appropiate
|
||||
Stamper stamper = terrainLoader.gameObject.GetComponent<Stamper>();
|
||||
if (stamper != null)
|
||||
{
|
||||
stamper.HighlightLoadingSettings();
|
||||
}
|
||||
|
||||
BiomeController biomeController = terrainLoader.gameObject.GetComponent<BiomeController>();
|
||||
if (biomeController != null)
|
||||
{
|
||||
biomeController.HighlightLoadingSettings();
|
||||
}
|
||||
|
||||
Spawner spawner = terrainLoader.gameObject.GetComponent<Spawner>();
|
||||
if (spawner != null)
|
||||
{
|
||||
spawner.HighlightLoadingSettings();
|
||||
}
|
||||
|
||||
MaskMapExport maskMapExport = terrainLoader.gameObject.GetComponent<MaskMapExport>();
|
||||
if (maskMapExport != null)
|
||||
{
|
||||
maskMapExport.HighlightLoadingSettings();
|
||||
}
|
||||
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ef4daf994caeab43b0085217c3ea4bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user