Example #1
0
        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);
            }
        }
Example #2
0
        private void GlobalSettings(bool helpEnabled)
        {
#if GAIA_PRO_PRESENT
            if (m_renderpipeline == GaiaConstants.EnvironmentRenderer.BuiltIn)
            {
                //EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("BuiltInHelpText"), MessageType.Info);
                m_editorUtils.TextNonLocalized(m_editorUtils.GetTextValue("BuiltInHelpText"));
                if (ProceduralWorldsGlobalWeather.Instance != null)
                {
                    if (ProceduralWorldsGlobalWeather.Instance.m_modifyPostProcessing)
                    {
                        //if (GUILayout.Button(new GUIContent("Disable Post FX In Weather", "Disables the post processing fx to be used/synced in the PW Sky weather and time of day system")))
                        if (m_editorUtils.Button("DisablePostFXInWeather"))
                        {
                            m_profile.DisableWeatherPostFX();
                        }
                    }
                    else
                    {
                        //if (GUILayout.Button(new GUIContent("Enable Post FX In Weather", "Enables the post processing fx to be used/synced in the PW Sky weather and time of day system")))
                        if (m_editorUtils.Button("EnablePostFXInWeather"))
                        {
                            m_profile.EnableWeatherPostFX();
                        }
                    }
                }
            }
            else
            {
                //EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("SRPHelpText"), MessageType.Info);
                m_editorUtils.TextNonLocalized(m_editorUtils.GetTextValue("SRPHelpText"));
            }
#endif
        }
Example #3
0
        private void TerrainLoadingSettings(bool helpEnabled)
        {
#if GAIA_PRO_PRESENT
            EditorGUI.BeginChangeCheck();
            if (!TerrainLoaderManager.Instance.TerrainSceneStorage.m_terrainLoadingEnabled)
            {
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("AutoLoadTerrainsDisabled"), MessageType.Warning);
                GUI.enabled = false;
            }

            if (TerrainLoaderManager.ColliderOnlyLoadingActive)
            {
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("ColliderOnlyLoadingWarning"), MessageType.Warning);
            }

            m_profile.m_terrainLoaderLoadMode = (LoadMode)m_editorUtils.EnumPopup("LoadMode", m_profile.m_terrainLoaderLoadMode, helpEnabled);
            if (m_profile.m_terrainLoaderLoadMode == LoadMode.RuntimeAlways)
            {
                EditorGUI.indentLevel++;
                m_editorUtils.InlineHelp("RefreshRates", helpEnabled);
                m_profile.m_terrainLoaderMinRefreshDistance = m_editorUtils.FloatField("MinRefreshDistance", m_profile.m_terrainLoaderMinRefreshDistance, helpEnabled);
                m_profile.m_terrainLoaderMaxRefreshDistance = m_editorUtils.FloatField("MaxRefreshDistance", m_profile.m_terrainLoaderMaxRefreshDistance, helpEnabled);
                m_profile.m_terrainLoaderMinRefreshMS       = m_editorUtils.FloatField("MinRefreshMS", m_profile.m_terrainLoaderMinRefreshMS, helpEnabled);
                m_profile.m_terrainLoaderMaxRefreshMS       = m_editorUtils.FloatField("MaxRefreshMS", m_profile.m_terrainLoaderMaxRefreshMS, helpEnabled);
                EditorGUI.indentLevel--;
            }
            m_editorUtils.Heading("LoadRange");
            EditorGUI.indentLevel++;
            m_profile.m_terrainLoaderFollowTransform = m_editorUtils.Toggle("FollowTransform", m_profile.m_terrainLoaderFollowTransform, helpEnabled);
            if (TerrainLoaderManager.ColliderOnlyLoadingActive)
            {
                if (!m_profile.m_terrainLoaderFollowTransform)
                {
                    m_profile.m_terrainLoaderLoadingBoundsCollider.center = m_editorUtils.Vector3Field("LoadingBoundsColliderCenter", m_profile.m_terrainLoaderLoadingBoundsCollider.center, helpEnabled);
                }
                m_profile.m_terrainLoaderLoadingBoundsCollider.extents = m_editorUtils.Vector3Field("LoadingBoundsColliderExtents", m_profile.m_terrainLoaderLoadingBoundsCollider.extents, helpEnabled);
            }
            else
            {
                if (!m_profile.m_terrainLoaderFollowTransform)
                {
                    m_profile.m_terrainLoaderLoadingBoundsRegular.center = m_editorUtils.Vector3Field("LoadingBoundsCenter", m_profile.m_terrainLoaderLoadingBoundsRegular.center, helpEnabled);
                }
                m_profile.m_terrainLoaderLoadingBoundsRegular.extents = m_editorUtils.Vector3Field("LoadingBoundsExtents", m_profile.m_terrainLoaderLoadingBoundsRegular.extents, helpEnabled);
                if (!m_profile.m_terrainLoaderFollowTransform)
                {
                    m_profile.m_terrainLoaderLoadingBoundsImpostor.center = m_editorUtils.Vector3Field("LoadingBoundsImpostorCenter", m_profile.m_terrainLoaderLoadingBoundsImpostor.center, helpEnabled);
                }
                m_profile.m_terrainLoaderLoadingBoundsImpostor.extents = m_editorUtils.Vector3Field("LoadingBoundsImpostorExtents", m_profile.m_terrainLoaderLoadingBoundsImpostor.extents, helpEnabled);
            }
            EditorGUI.indentLevel--;
            if (EditorGUI.EndChangeCheck())
            {
                TerrainLoader tl = ((GaiaScenePlayer)target).GetComponentInChildren <TerrainLoader>();
                m_profile.UpdateTerrainLoaderFromProfile(ref tl);
            }
#endif
        }
Example #4
0
        public override void OnInspectorGUI()
        {
            m_editorUtils.Initialize(); // Do not remove this!
            m_spawnerSettings = (SpawnerSettings)target;

            string message = m_editorUtils.GetTextValue("Intro");;

            EditorGUILayout.HelpBox(message, MessageType.Info, true);

            if (GUILayout.Button(m_editorUtils.GetContent("AddToScene")))
            {
                m_spawnerSettings.CreateSpawner();
            }

            GUILayout.Label(m_editorUtils.GetContent("SpawnRulePreview"), m_editorUtils.Styles.heading);

            GaiaResource resource = m_spawnerSettings.m_resources;// (GaiaResource)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(m_spawnerSettings.m_resourcesGUID), typeof(GaiaResource));

            foreach (SpawnRule rule in m_spawnerSettings.m_spawnerRules)
            {
                m_editorUtils.LabelField("Name", new GUIContent(rule.m_name));
                m_editorUtils.LabelField("Type", new GUIContent(rule.m_resourceType.ToString()));


                Texture2D resourceTexture = SpawnerEditor.GetSpawnRulePreviewTexture(rule, resource);

                if (resourceTexture != null)
                {
                    m_editorUtils.Image(resourceTexture, 100, 100);
                }
            }
        }
Example #5
0
        private void GlobalPanel(bool helpEnabled)
        {
            EditorGUI.BeginChangeCheck();

            m_editorUtils.Heading("GlobalSettings");
            HDR        = m_bufferManager.m_allowHDR;
            HDR        = m_editorUtils.Toggle("AllowHDR", HDR, helpEnabled);
            RenderSize = m_bufferManager.m_renderSize;
            RenderSize = (PW_RENDER_SIZE)m_editorUtils.EnumPopup("RenderResolution", RenderSize, helpEnabled);
            EditorGUILayout.Space();
            m_editorUtils.Heading("RefreactionSettings");
            RefractionCameraEvent = m_bufferManager.m_cameraEventRefraction;
            if (Application.isPlaying)
            {
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("CantBeChangedAtRunTime"), MessageType.Info);
                GUI.enabled = false;
            }
            RefractionCameraEvent = (CameraEvent)m_editorUtils.EnumPopup("RefractionCameraEvent", RefractionCameraEvent, helpEnabled);
            GUI.enabled           = true;

            if (EditorGUI.EndChangeCheck())
            {
                if (ChangesMade())
                {
                    m_bufferManager.ClearBuffers();
                    m_bufferManager.m_allowHDR              = HDR;
                    m_bufferManager.m_renderSize            = RenderSize;
                    m_bufferManager.m_cameraEventRefraction = RefractionCameraEvent;
                    m_bufferManager.RebuildBuffers(false);
                    EditorUtility.SetDirty(m_bufferManager);
                }
            }
        }
Example #6
0
        private void GlobalPanel(bool helpEnabled)
        {
            if (Application.isPlaying)
            {
                if (GaiaUtils.CheckIfSceneProfileExists())
                {
                    if (m_profile.m_locationProfile.m_currentControllerType != GaiaGlobal.Instance.SceneProfile.m_controllerType)
                    {
                        EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("ControllerHasChanged"), MessageType.Warning);
                    }
                }
            }

            if (m_profile == null)
            {
                EditorGUILayout.HelpBox("Location manager allows you to track camera position at runtime and create bookmarks to load locations", MessageType.Info);
                if (m_editorUtils.Button("AddLocationManager"))
                {
                    m_profile = AddLocationSystem();
                }
            }
            else
            {
                EditorGUI.BeginChangeCheck();

                m_editorUtils.Panel("Setup", Setup);
                if (m_profile.m_locationProfile != null)
                {
                    GUI.enabled = true;
                }
                else
                {
                    GUI.enabled = false;
                }
                m_editorUtils.Panel("Controls", RuntimeControls);
                m_editorUtils.Panel("BookmarkSetup", BookmarkSetup, true);

                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(m_profile);
                    if (m_profile.m_locationProfile != null)
                    {
                        EditorUtility.SetDirty(m_profile.m_locationProfile);
                    }
                }
            }
        }
Example #7
0
 private void CreateWorldMap(bool obj)
 {
     if (m_worldMap.m_worldMapTerrain == null)
     {
         EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("TerrainMissing"), MessageType.Warning);
     }
     else
     {
         EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("CreateTerrainInfo"), MessageType.Info);
     }
     m_worldMap.m_worldMapTileSize    = (GaiaConstants.EnvironmentSize)m_editorUtils.EnumPopup("TileSize", m_worldMap.m_worldMapTileSize);
     m_worldMap.m_heightmapResolution = (GaiaConstants.HeightmapResolution)m_editorUtils.EnumPopup("HeightmapResolution", m_worldMap.m_heightmapResolution);
     if (m_editorUtils.ButtonAutoIndent("CreateTerrainButton"))
     {
         m_worldMap.CreateWorldMapTerrain();
         m_worldMap.LookAtWorldMap();
     }
     return;
 }
Example #8
0
        private void DrawBiomeSettings(bool helpEnabled)
        {
            m_biomePreset.m_orderNumber = m_editorUtils.IntField("OrderNumber", m_biomePreset.m_orderNumber, helpEnabled);
            Rect listRect = EditorGUILayout.GetControlRect(true, m_spawnerPresetList.GetHeight());

            m_spawnerPresetList.DoList(listRect);
            m_editorUtils.InlineHelp("SpawnerAdded", helpEnabled);


            if (m_biomePreset.m_spawnerPresetList.Count == 0)
            {
                GUILayout.Space(EditorGUIUtility.singleLineHeight);
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoSpawnersYet"), MessageType.Warning);
                GUILayout.Space(10);
                if (m_editorUtils.Button("CreateFirstSpawner"))
                {
                    GameObject spawnerObj = new GameObject("New Spawner");
                    Spawner    spawner    = spawnerObj.AddComponent <Spawner>();
                    spawner.m_createdfromBiomePreset = true;
                    Selection.activeGameObject       = spawnerObj;
                }
                GUILayout.Space(20);
            }
            else
            {
                GUILayout.Space(10);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (m_editorUtils.Button("CreateAdditionalSpawner", GUILayout.MaxWidth(200)))
                {
                    GameObject spawnerObj = new GameObject("New Spawner");
                    Spawner    spawner    = spawnerObj.AddComponent <Spawner>();
                    spawner.m_createdfromBiomePreset = true;
                    Selection.activeGameObject       = spawnerObj;
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
            GUILayout.Space(EditorGUIUtility.singleLineHeight);
            m_biomePreset.GaiaSceneCullingProfile = (GaiaSceneCullingProfile)m_editorUtils.ObjectField("GaiaSceneCullingProfile", m_biomePreset.GaiaSceneCullingProfile, typeof(GaiaSceneCullingProfile), false, helpEnabled);

#if UNITY_POST_PROCESSING_STACK_V2
            GUILayout.Space(EditorGUIUtility.singleLineHeight);
            m_biomePreset.postProcessProfile = (PostProcessProfile)m_editorUtils.ObjectField("PostProcessingProfile", m_biomePreset.postProcessProfile, typeof(PostProcessProfile), false, helpEnabled);
#endif
            GUILayout.Space(EditorGUIUtility.singleLineHeight);


            serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(m_biomePreset);
        }
Example #9
0
        public override void OnInspectorGUI()
        {
#if GAIA_PRO_PRESENT
            m_editorUtils.Initialize(); // Do not remove this!
            m_maskMapExportSettings = (MaskMapExportSettings)target;

            string message = m_editorUtils.GetTextValue("Intro");;
            EditorGUILayout.HelpBox(message, MessageType.Info, true);
            if (m_editorUtils.Button("AddToScene"))
            {
                GameObject sessionTempObj     = GaiaUtils.GetTempSessionToolsObject();
                GameObject maskMapExporterObj = new GameObject("Mask Map Exporter");
                maskMapExporterObj.transform.parent = sessionTempObj.transform;
                MaskMapExport maskMapExport = maskMapExporterObj.AddComponent <MaskMapExport>();
                maskMapExport.LoadSettings(m_maskMapExportSettings);
            }
            m_editorUtils.Heading("Stored Settings");
            DrawDefaultInspector();
            // Update is called once per frame
#else
            string message = m_editorUtils.GetTextValue("GaiaProInfo");;
            EditorGUILayout.HelpBox(message, MessageType.Info, true);
#endif
        }
Example #10
0
        private void GlobalPanel(bool helpEnabled)
        {
            EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("WindManagerInfo"), MessageType.Info);
            m_manager.windGlobalMaxDist = m_editorUtils.Slider("GlobalWindDistance", m_manager.windGlobalMaxDist, 100f, 10000f, helpEnabled);
            EditorGUILayout.Space();

            m_editorUtils.Heading("WindSettings");
            m_manager.m_useWindAudio = m_editorUtils.Toggle("UseWindAudio", m_manager.m_useWindAudio, helpEnabled);
            if (m_manager.m_useWindAudio)
            {
                EditorGUI.indentLevel++;
                m_manager.m_windTransitionTime = m_editorUtils.FloatField("WindTransitionTime", m_manager.m_windTransitionTime, helpEnabled);
                if (m_manager.m_windTransitionTime < 0.1f)
                {
                    m_manager.m_windTransitionTime = 0.1f;
                }
                m_manager.m_windAudioClip = (AudioClip)m_editorUtils.ObjectField("WindAudioClip", m_manager.m_windAudioClip, typeof(AudioClip), false, helpEnabled);
                EditorGUI.indentLevel--;
            }
        }
Example #11
0
        private void SelectStampPanel(bool helpEnabled)
        {
            m_editorUtils.InlineHelp("Help", helpEnabled);


            if (m_editedImageMask == null && m_editedStamperSettings == null)
            {
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoConnectedImageMask"), MessageType.Warning, true);
            }

            m_editorUtils.Label("StampPreview");
            EditorGUILayout.BeginVertical();
            if (m_previewTexture != null && m_validStampInCategory)
            {
                m_editorUtils.Image(m_previewTexture, position.width - 25, position.width - 25);
                m_editorUtils.Label(new GUIContent(m_previewTexture.name));
            }
            else
            {
                if (!m_validStampInCategory)
                {
                    GUILayout.Space(71);
                    EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoValidStampInCategory"), MessageType.Info, true);
                }
                else if (m_previewTexture == null)
                {
                    GUILayout.Space(67);
                    EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoTexture"), MessageType.Info, true);
                }
                GUILayout.Space(155);
            }
            GUILayout.Space(EditorGUIUtility.singleLineHeight);

            Rect rect = EditorGUILayout.GetControlRect();

            if (GUI.Button(new Rect(rect.x, rect.y, 50, EditorGUIUtility.singleLineHeight), m_editorUtils.GetContent("StampBackwardButton")))
            {
                PickNextStamp(-1);
            }

            //Building up a value array of incrementing ints of the size of the directory names array, this array will then match the displayed string selection in the popup
            int[] categoryIDArray = Enumerable
                                    .Repeat(0, (int)((m_categoryNames.ToArray().Length - 0) / 1) + 1)
                                    .Select((tr, ti) => tr + (1 * ti))
                                    .ToArray();

            int previousCategoryID = m_selectedCategoryID;

            m_selectedCategoryID = EditorGUI.IntPopup(new Rect(rect.x + 60, rect.y, rect.width - 120, EditorGUIUtility.singleLineHeight), m_selectedCategoryID, m_categoryNames.ToArray(), categoryIDArray);
            if (previousCategoryID != m_selectedCategoryID)
            {
                LoadStampDirFileInfo();
                m_currentStampIndex    = -1;
                m_validStampInCategory = PickNextStamp(1);
            }

            if (GUI.Button(new Rect(rect.x + 60 + rect.width - 110, rect.y, 50, EditorGUIUtility.singleLineHeight), m_editorUtils.GetContent("StampForwardButton")))
            {
                PickNextStamp(1);
            }

            rect.y += EditorGUIUtility.singleLineHeight * 2;

            if (GUI.Button(new Rect(rect.x + 20, rect.y, 100, EditorGUIUtility.singleLineHeight * 2), m_editorUtils.GetContent("ApplyButton")))
            {
                Close();
            }
            if (GUI.Button(new Rect(rect.x + rect.width - 100 - 20, rect.y, 100, EditorGUIUtility.singleLineHeight * 2), m_editorUtils.GetContent("CancelButton")))
            {
                //Load original stamp back in and close
                if (m_editedImageMask != null)
                {
                    m_editedImageMask.ImageMaskTexture = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(m_originalTextureGUID), typeof(Texture2D));
                }
                //if (m_editedStamperSettings != null)
                //{
                //    m_editedStamperSettings.m_stamperInputImage = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(m_originalTextureGUID), typeof(Texture2D));
                //}
                UpdateToolsAndScene();
                Close();
            }


            EditorGUILayout.EndVertical();
        }
Example #12
0
        private void GlobalSettingsEnabled(bool helpEnabled)
        {
            if (PlayerSettings.colorSpace != ColorSpace.Linear)
            {
                GUI.backgroundColor = Color.yellow;
                EditorGUILayout.HelpBox("Gaia lighting looks best in Linear Color Space. Go to Gaia standard tab and press Set Linear Deferred", MessageType.Warning);
            }

            GUI.backgroundColor = defaultBackground;

            m_editorUtils.Heading("SetupSettings");
            m_profile.m_multiSceneLightingSupport = m_editorUtils.Toggle("MultiSceneSupport", m_profile.m_multiSceneLightingSupport, helpEnabled);
            if (m_renderPipeline != GaiaConstants.EnvironmentRenderer.HighDefinition)
            {
                m_profile.m_masterSkyboxMaterial = (Material)m_editorUtils.ObjectField("MasterSkyboxMaterial", m_profile.m_masterSkyboxMaterial, typeof(Material), false, GUILayout.Height(16f));
            }
            EditorGUILayout.Space();

            m_editorUtils.Heading("LightmappingSettings");
            m_profile.m_lightingBakeMode = (GaiaConstants.BakeMode)m_editorUtils.EnumPopup("LightmappingBakeMode", m_profile.m_lightingBakeMode, helpEnabled);
#if UNITY_2020_1_OR_NEWER
            m_profile.m_lightmappingMode = (LightingSettings.Lightmapper)EditorGUILayout.EnumPopup("Lightmapping Mode", m_profile.m_lightmappingMode);
#else
            m_profile.m_lightmappingMode = (LightmapEditorSettings.Lightmapper)EditorGUILayout.EnumPopup("Lightmapping Mode", m_profile.m_lightmappingMode);
#endif
            EditorGUILayout.Space();

            m_editorUtils.Heading("PostProcessingSettings");
            m_profile.m_enablePostProcessing = m_editorUtils.ToggleLeft("EnablePostProcessing", m_profile.m_enablePostProcessing);
            if (m_profile.m_enablePostProcessing)
            {
                m_profile.m_hideProcessVolume = m_editorUtils.ToggleLeft("HidePostProcessingVolumesInScene", m_profile.m_hideProcessVolume);
                m_profile.m_antiAliasingMode  = (GaiaConstants.GaiaProAntiAliasingMode)EditorGUILayout.EnumPopup("Anti-Aliasing Mode", m_profile.m_antiAliasingMode);
                if (m_renderPipeline == GaiaConstants.EnvironmentRenderer.BuiltIn)
                {
                    if (m_profile.m_antiAliasingMode == GaiaConstants.GaiaProAntiAliasingMode.TAA)
                    {
                        m_profile.m_AAJitterSpread       = m_editorUtils.Slider("AAJitterSpread", m_profile.m_AAJitterSpread, 0f, 1f, helpEnabled);
                        m_profile.m_AAStationaryBlending = m_editorUtils.Slider("AAStationaryBlending", m_profile.m_AAStationaryBlending, 0f, 1f, helpEnabled);
                        m_profile.m_AAMotionBlending     = m_editorUtils.Slider("AAMotionBlending", m_profile.m_AAMotionBlending, 0f, 1f, helpEnabled);
                        m_profile.m_AASharpness          = m_editorUtils.Slider("AASharpness", m_profile.m_AASharpness, 0f, 1f, helpEnabled);
                    }
                }
            }
            EditorGUILayout.Space();

            m_editorUtils.Heading("CameraSettings");
            m_profile.m_enableAutoDOF = m_editorUtils.Toggle("UseAutoDOF", m_profile.m_enableAutoDOF, helpEnabled);
            if (m_profile.m_enableAutoDOF)
            {
                m_profile.m_dofLayerDetection = GaiaEditorUtils.LayerMaskField(new GUIContent(m_editorUtils.GetTextValue("DOFLayerDetection"), m_editorUtils.GetTooltip("DOFLayerDetection")), m_profile.m_dofLayerDetection);
            }
            EditorGUILayout.Space();

            m_profile.m_usePhysicalCamera = m_editorUtils.Toggle("UsePhysicalCamera", m_profile.m_usePhysicalCamera, helpEnabled);
            if (m_profile.m_usePhysicalCamera)
            {
                m_profile.m_cameraFocalLength = m_editorUtils.FloatField("CameraFocalLength", m_profile.m_cameraFocalLength, helpEnabled);
                m_profile.m_cameraSensorSize  = m_editorUtils.Vector2Field("CameraSensorSize", m_profile.m_cameraSensorSize, helpEnabled);
            }
            EditorGUILayout.Space();

            m_editorUtils.Heading("MiscellaneousSettings");
            m_profile.m_globalReflectionProbe = m_editorUtils.ToggleLeft("GlobalReflectionProbe", m_profile.m_globalReflectionProbe);
            m_profile.m_parentObjects         = m_editorUtils.ToggleLeft("ParentObjectsToGaia", m_profile.m_parentObjects);
            m_profile.m_enableAmbientAudio    = m_editorUtils.ToggleLeft("EnableAmbientAudio", m_profile.m_enableAmbientAudio);

            if (m_renderPipeline != GaiaConstants.EnvironmentRenderer.HighDefinition)
            {
                m_profile.m_enableFog = m_editorUtils.ToggleLeft("EnableFog", m_profile.m_enableFog);
            }
            else
            {
#if UNITY_2019_3_OR_NEWER
                EditorGUILayout.Space();
                m_editorUtils.Heading("HDRPSettings");
                if (m_profile.m_antiAliasingMode == GaiaConstants.GaiaProAntiAliasingMode.TAA)
                {
                    m_profile.m_antiAliasingTAAStrength = m_editorUtils.Slider("TAAStrength", m_profile.m_antiAliasingTAAStrength, 0f, 2f, helpEnabled);
                }
                m_profile.m_cameraDithering = m_editorUtils.Toggle("CameraDithering", m_profile.m_cameraDithering, helpEnabled);
                m_profile.m_cameraAperture  = m_editorUtils.Slider("CameraAperture", m_profile.m_cameraAperture, 1f, 32f, helpEnabled);
#endif
            }
        }
Example #13
0
        private void GlobalPanel(bool helpEnabled)
        {
            //Text intro
            GUILayout.BeginVertical("Gaia Scanner", m_boxStyle);
            GUILayout.Space(20);
            EditorGUILayout.LabelField("The Gaia Scanner allows you to create new stamps from Windows R16, Windows 16 bit RAW, Mac 16 bit RAW, Terrains, Textures or Meshes. Just drag and drop the file or object onto the area below to scan it.", m_wrapStyle);
            GUILayout.EndVertical();

            DropAreaGUI();

            bool originalGUIState = GUI.enabled;

            if (!m_scanner.m_objectScanned)
            {
                GUI.enabled = false;
            }

            //DrawDefaultInspector();
            GUILayout.BeginVertical("Setup", m_boxStyle);
            GUILayout.Space(20);
            m_editorUtils.Heading("GlobalSettings");
            m_scanner.m_previewMaterial = (Material)m_editorUtils.ObjectField("PreviewMaterial", m_scanner.m_previewMaterial, typeof(Material), false, helpEnabled);
            EditorGUILayout.BeginHorizontal();
            m_scanner.m_exportFolder = m_editorUtils.TextField("ExportPath", m_scanner.m_exportFolder);

            if (m_editorUtils.Button("ExportDirectoryOpen", GUILayout.Width(80)))
            {
                string path = EditorUtility.SaveFolderPanel(m_editorUtils.GetTextValue("ExportDirectoryWindowTitle"), GaiaDirectories.GetUserStampDirectory(), GaiaDirectories.SCANNER_EXPORT_DIRECTORY.Replace("/", ""));
                if (path.Contains(Application.dataPath))
                {
                    m_scanner.m_exportFolder = GaiaDirectories.GetPathStartingAtAssetsFolder(path);
                }
                else
                {
                    EditorUtility.DisplayDialog("Path outside the Assets folder", "The selected path needs to be inside the Assets folder of the project. Please select an appropiate path.", "OK");
                    m_scanner.m_exportFolder = GaiaDirectories.GetScannerExportDirectory();
                }
            }
            EditorGUILayout.EndHorizontal();
            m_editorUtils.InlineHelp("ExportPath", helpEnabled);
            m_scanner.m_exportFileName = m_editorUtils.TextField("ExportFilename", m_scanner.m_exportFileName, helpEnabled);

            float oldBaseLevel = m_scanner.m_baseLevel;

            m_scanner.m_baseLevel = m_editorUtils.Slider("BaseLevel", m_scanner.m_baseLevel, 0f, 1f, helpEnabled);
            if (oldBaseLevel != m_scanner.m_baseLevel)
            {
                SceneView.lastActiveSceneView.Repaint();
            }
            EditorGUILayout.Space(10f);
            m_editorUtils.Heading("ObjectTypeSettings");
            if (m_scanner.m_scannerObjectType == ScannerObjectType.Mesh)
            {
                m_scanner.m_scanResolution = m_editorUtils.Slider("ScanResolution", m_scanner.m_scanResolution, 0.0001f, 1f, helpEnabled);
                if (m_scanner.m_lastScanResolution != m_scanner.m_scanResolution)
                {
                    if (m_editorUtils.Button("RefreshScan"))
                    {
                        m_scanner.LoadGameObject(m_scanner.m_lastScannedMesh);
                    }
                }
            }
            if (m_scanner.m_scannerObjectType == ScannerObjectType.Raw)
            {
                //Drop Options section
                GUILayout.BeginHorizontal();
                {
                    EditorGUILayout.PrefixLabel(BYTE_ORDER_LABEL);
                    EditorGUI.BeginChangeCheck();
                    {
                        m_rawByteOrder = (GaiaConstants.RawByteOrder)GUILayout.Toolbar((int)m_rawByteOrder, new string[] { "IBM PC", "Macintosh" });
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        ReloadRawFile();
                    }
                }
                GUILayout.EndHorizontal();
                m_editorUtils.InlineHelp("RawFileByteOrder", helpEnabled);

                EditorGUI.BeginChangeCheck();
                {
                    m_rawBitDepth = (GaiaConstants.RawBitDepth)EditorGUILayout.Popup(BIT_DEPTH_LABEL, (int)m_rawBitDepth, BIT_DEPTHS_LABELS);
                    m_editorUtils.InlineHelp("RawFileBitDepth", helpEnabled);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    ReloadRawFile();
                }
                GUILayout.BeginVertical();
                if (m_showRawInfo)
                {
                    EditorGUILayout.HelpBox("Assumed " + (m_rawBitDepth == GaiaConstants.RawBitDepth.Sixteen ? "16-bit" : "8-bit") + " RAW " + m_assumedRawRes + " x " + m_assumedRawRes, MessageType.Info);
                }
                if (m_showBitDepthWarning)
                {
                    EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("8BitWarning"), MessageType.Warning);
                }
                GUILayout.EndVertical();
            }
            EditorGUILayout.Space(10f);



            m_editorUtils.Heading("ExportSettings");
            //m_scanner.m_textureExportResolution = (GaiaConstants.GaiaProWaterReflectionsQuality) EditorGUILayout.EnumPopup(new GUIContent("Export Resolution", "Sets the export resolution of the texture generated"), m_scanner.m_textureExportResolution);
            m_scanner.m_normalize         = m_editorUtils.Toggle("Normalize", m_scanner.m_normalize, helpEnabled);
            m_scanner.m_exportTextureAlso = m_editorUtils.Toggle("ExportPNG", m_scanner.m_exportTextureAlso, helpEnabled);
            //m_scanner.m_exportBytesData = m_editorUtils.Toggle("ExportBytesData", m_scanner.m_exportBytesData, helpEnabled);

            GUILayout.EndVertical();

            //Terraform section
            GUILayout.BeginVertical("Scanner Controller", m_boxStyle);
            GUILayout.Space(20);
            if (!string.IsNullOrEmpty(m_infoMessage))
            {
                EditorGUILayout.HelpBox(m_infoMessage, MessageType.Info);
            }
            if (m_scanner.m_scanMap == null)
            {
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoScanDataInfo"), MessageType.Info);
                GUI.enabled = false;
            }
            GUILayout.BeginHorizontal();
            Color normalBGColor = GUI.backgroundColor;

            if (m_settings == null)
            {
                m_settings = GaiaUtils.GetGaiaSettings();
            }

            GUI.backgroundColor = m_settings.GetActionButtonColor();
            if (m_editorUtils.Button("SaveScan"))
            {
                string path = m_scanner.SaveScan();
                AssetDatabase.Refresh();
                path += ".exr";
                Object exportedTexture = AssetDatabase.LoadAssetAtPath(path, typeof(Object));
                if (exportedTexture != null)
                {
                    m_infoMessage = "Scan exported to: " + path;
                    Debug.Log(m_infoMessage);
                    EditorGUIUtility.PingObject(exportedTexture);
                }
            }
            GUI.backgroundColor = normalBGColor;
            GUI.enabled         = true;
            if (m_editorUtils.Button("Clear"))
            {
                m_scanner.Clear();
            }

            GUILayout.EndHorizontal();
            GUILayout.Space(5);
            GUILayout.EndVertical();
            GUILayout.Space(5f);

            m_showRawInfo         = m_assumedRawRes > 0;
            m_showBitDepthWarning = m_rawBitDepth == GaiaConstants.RawBitDepth.Eight;

            GUI.enabled = originalGUIState;
        }
Example #14
0
        private void DrawSummary(bool helpEnabled)
        {
            m_manager.m_session = (GaiaSession)m_editorUtils.ObjectField("SessionData", m_manager.m_session, typeof(GaiaSession), helpEnabled);
            m_editorUtils.InlineHelp("SessionData", helpEnabled);
            if (m_manager.m_session == null)
            {
                if (m_editorUtils.Button("CreateSessionButton"))
                {
                    m_manager.CreateSession();
                }
            }
            if (m_manager.m_session == null)
            {
                return;
            }
            EditorGUI.BeginChangeCheck();
            m_manager.m_session.m_name = m_editorUtils.DelayedTextField("Name", m_manager.m_session.m_name, helpEnabled);
            if (EditorGUI.EndChangeCheck())
            {
                //Get the old path
                string oldSessionDataPath = GaiaDirectories.GetSessionSubFolderPath(m_manager.m_session);
                //Rename the session asset
                AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(m_manager.m_session), m_manager.m_session.m_name + ".asset");
                //rename the session data path as well
                string newSessionDataPath = GaiaDirectories.GetSessionSubFolderPath(m_manager.m_session, false);
                AssetDatabase.MoveAsset(oldSessionDataPath, newSessionDataPath);
                //if we have terrain scenes stored in the Terrain Loader, we need to update the paths in there as well
                foreach (TerrainScene terrainScene in TerrainLoaderManager.TerrainScenes)
                {
                    terrainScene.m_scenePath         = terrainScene.m_scenePath.Replace(oldSessionDataPath, newSessionDataPath);
                    terrainScene.m_impostorScenePath = terrainScene.m_impostorScenePath.Replace(oldSessionDataPath, newSessionDataPath);
                    terrainScene.m_backupScenePath   = terrainScene.m_backupScenePath.Replace(oldSessionDataPath, newSessionDataPath);
                    terrainScene.m_colliderScenePath = terrainScene.m_colliderScenePath.Replace(oldSessionDataPath, newSessionDataPath);
                }
                TerrainLoaderManager.Instance.SaveStorageData();

                AssetDatabase.DeleteAsset(oldSessionDataPath);
                AssetDatabase.SaveAssets();
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(m_editorUtils.GetContent("Description"), GUILayout.MaxWidth(EditorGUIUtility.labelWidth));
            m_manager.m_session.m_description = EditorGUILayout.TextArea(m_manager.m_session.m_description, GUILayout.MinHeight(100));
            EditorGUILayout.EndHorizontal();
            m_editorUtils.InlineHelp("Description", helpEnabled);
            m_manager.m_session.m_previewImage = (Texture2D)m_editorUtils.ObjectField("PreviewImage", m_manager.m_session.m_previewImage, typeof(Texture2D), helpEnabled);
            GUILayout.BeginHorizontal();
            Rect rect = EditorGUILayout.GetControlRect();

            GUILayout.Space(rect.width - 20);
            if (GUILayout.Button("Generate Image"))
            {
                string textureFileName = GaiaDirectories.GetSessionSubFolderPath(m_manager.m_session) + Path.DirectorySeparatorChar + m_manager.m_session + "_Preview";
                var    originalLODBias = QualitySettings.lodBias;
                QualitySettings.lodBias = 100;
                OrthographicBake.BakeTerrain(Terrain.activeTerrain, 2048, 2048, Camera.main.cullingMask, textureFileName);
                OrthographicBake.RemoveOrthoCam();
                QualitySettings.lodBias = originalLODBias;
                textureFileName        += ".png";
                AssetDatabase.ImportAsset(textureFileName);
                var importer = AssetImporter.GetAtPath(textureFileName) as TextureImporter;
                if (importer != null)
                {
                    importer.sRGBTexture         = false;
                    importer.alphaIsTransparency = false;
                    importer.alphaSource         = TextureImporterAlphaSource.None;
                    importer.mipmapEnabled       = false;
                }
                AssetDatabase.ImportAsset(textureFileName);
                m_manager.m_session.m_previewImage = (Texture2D)AssetDatabase.LoadAssetAtPath(textureFileName, typeof(Texture2D));
            }
            GUILayout.EndHorizontal();
            m_editorUtils.InlineHelp("PreviewImage", helpEnabled);
            m_editorUtils.LabelField("Created", new GUIContent(m_manager.m_session.m_dateCreated), helpEnabled);
            m_manager.m_session.m_isLocked = m_editorUtils.Toggle("Locked", m_manager.m_session.m_isLocked, helpEnabled);
            float maxSeaLevel = 2000f;

            if (Terrain.activeTerrain != null)
            {
                maxSeaLevel = Terrain.activeTerrain.terrainData.size.y + Terrain.activeTerrain.transform.position.y;
            }
            else
            {
                maxSeaLevel = m_manager.GetSeaLevel(false) + 500f;
            }

            float oldSeaLevel = m_manager.GetSeaLevel(false);
            float newSeaLEvel = oldSeaLevel;

            newSeaLEvel = m_editorUtils.Slider("SeaLevel", newSeaLEvel, 0, maxSeaLevel, helpEnabled);
            if (newSeaLEvel != oldSeaLevel)
            {
                //Do we have a water instance? If yes, update it & it will update the sea level in the session as well
                if (PWS_WaterSystem.Instance != null)
                {
                    PWS_WaterSystem.Instance.SeaLevel = newSeaLEvel;
                }
                else
                {
                    //no water instance yet, just update the sea level in the session
                    m_manager.SetSeaLevel(newSeaLEvel, false);
                    SceneView.RepaintAll();
                }
            }

            m_manager.m_session.m_spawnDensity = m_editorUtils.FloatField("SpawnDensity", Mathf.Max(0.01f, m_manager.m_session.m_spawnDensity), helpEnabled);
            GUILayout.BeginHorizontal();
            if (m_editorUtils.Button("DeleteAllOperations"))
            {
                if (EditorUtility.DisplayDialog(m_editorUtils.GetTextValue("PopupDeleteAllTitle"), m_editorUtils.GetTextValue("PopupDeleteAllMessage"), m_editorUtils.GetTextValue("Continue"), m_editorUtils.GetTextValue("Cancel")))
                {
                    foreach (GaiaOperation op in m_manager.m_session.m_operations)
                    {
                        try
                        {
                            if (!String.IsNullOrEmpty(op.scriptableObjectAssetGUID))
                            {
                                AssetDatabase.DeleteAsset(AssetDatabase.GUIDToAssetPath(op.scriptableObjectAssetGUID));
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.LogError("Error while deleting one of the operation data files: " + ex.Message + " Stack Trace:" + ex.StackTrace);
                        }
                    }

                    m_manager.m_session.m_operations.Clear();
                }
            }

            if (m_editorUtils.Button("PlaySession"))
            {
                GaiaLighting.SetDefaultAmbientLight(GaiaUtils.GetGaiaSettings().m_gaiaLightingProfile);
                GaiaSessionManager.PlaySession();
            }
            GUILayout.EndHorizontal();
        }
Example #15
0
        private void DetailTerrainDistance(bool helpEnabled)
        {
            EditorGUI.BeginChangeCheck();

            m_editorUtils.Text("DetailInfo");
            EditorGUILayout.Space();

            //switch (m_profile.m_detailQuality)
            //{
            //    case GaiaConstants.TerrainDetailQuality.Ultra2:
            //        EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "Ultra");
            //        break;
            //    case GaiaConstants.TerrainDetailQuality.VeryHigh4:
            //        EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "Very High");
            //        break;
            //    case GaiaConstants.TerrainDetailQuality.High8:
            //        EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "High");
            //        break;
            //    case GaiaConstants.TerrainDetailQuality.Medium16:
            //        EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "Medium");
            //        break;
            //    case GaiaConstants.TerrainDetailQuality.Low32:
            //        EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "Low");
            //        break;
            //    case GaiaConstants.TerrainDetailQuality.VeryLow64:
            //        EditorGUILayout.LabelField(m_editorUtils.GetTextValue("DetailPatchResolution") + "Very Low");
            //        break;
            //}
            //EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("DetailPatchResolutionHelp"), MessageType.Info);

            m_profile.m_detailDistance = m_editorUtils.IntField("DetailDistance", m_profile.m_detailDistance, helpEnabled);
            if (m_profile.m_detailDistance < 0)
            {
                m_profile.m_detailDistance = 0;
            }
            if (m_profile.m_detailDistance > 250)
            {
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("DetailDistanceHelp"), MessageType.Info);
            }

            m_profile.m_detailDensity = m_editorUtils.Slider("DetailDensity", m_profile.m_detailDensity, 0f, 1f, helpEnabled);
            if (m_profile.m_detailDistance > 250 && m_profile.m_detailDensity > 0.5f)
            {
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("DetailDensityHelp"), MessageType.Info);
            }

            if (m_editorUtils.Button("ApplyToAll"))
            {
                m_profile.ApplySettings(true);
            }

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(m_profile, "Made changes");
                EditorUtility.SetDirty(m_profile);
                m_profile.ApplySettings(false);

                if (!Application.isPlaying)
                {
                    EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
                }
            }
        }
Example #16
0
        private void SaveAndLoad(bool helpEnabled)
        {
            EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("SaveAndLoadHelpText"), MessageType.Info);

            if (m_profile.SceneProfile == null)
            {
                m_profile.SceneProfile = ScriptableObject.CreateInstance <SceneProfile>();
            }

            bool canBeSaved = true;

            if (!m_profile.SceneProfile.DefaultLightingSet)
            {
                EditorGUILayout.HelpBox("No lighting profile settings have been saved. Please use gaia default lighting profile to save them here.", MessageType.Warning);
                canBeSaved = false;
            }
            else
            {
                //EditorGUILayout.HelpBox("Lighting profile has been saved", MessageType.Info);
            }

            if (!m_profile.SceneProfile.DefaultWaterSet)
            {
                EditorGUILayout.HelpBox("No water profile settings have been saved. Please use gaia default water profile to save them here.", MessageType.Warning);
                canBeSaved = false;
            }
            else
            {
                //EditorGUILayout.HelpBox("Water profile has been saved", MessageType.Info);
            }

            EditorGUILayout.BeginHorizontal();
            if (!canBeSaved)
            {
                GUI.enabled = false;
            }

            //string path = Application.dataPath + "/Assets";
            string path = "";

            if (m_editorUtils.Button("Save"))
            {
                string sceneName = EditorSceneManager.GetActiveScene().name;
                if (string.IsNullOrEmpty(sceneName))
                {
                    Debug.LogWarning("Unable to save file as scene has not been saved. Please save your scene then try again.");
                }

                path = EditorUtility.SaveFilePanelInProject("Save Location", sceneName + " Profile", "asset", "Save new profile asset");
                GaiaSceneManagement.SaveFile(m_profile.SceneProfile, path);
                EditorGUIUtility.ExitGUI();
            }

            GUI.enabled = true;

            if (m_editorUtils.Button("Load"))
            {
                path = EditorUtility.OpenFilePanel("Load Profile", Application.dataPath + "/Assets", "asset");
                GaiaSceneManagement.LoadFile(path);
                EditorGUIUtility.ExitGUI();
            }

            if (m_editorUtils.Button("Revert"))
            {
                GaiaSceneManagement.Revert(m_profile.SceneProfile);
                EditorGUIUtility.ExitGUI();
            }
            EditorGUILayout.EndHorizontal();
        }
Example #17
0
        /// <summary>
        /// Draws the data fields for each operation
        /// </summary>
        /// <param name="op"></param>
        public static void DrawOperationFields(GaiaOperation op, EditorUtils editorUtils, GaiaSessionManager sessionManager, bool helpEnabled, int currentIndex)
        {
            //shared default fields first
            //op.m_isActive = m_editorUtils.Toggle("Active", op.m_isActive, helpEnabled);
            bool currentGUIState = GUI.enabled;

            GUI.enabled      = op.m_isActive;
            op.m_description = editorUtils.TextField("Description", op.m_description, helpEnabled);
            editorUtils.LabelField("DateTime", new GUIContent(op.m_operationDateTime), helpEnabled);
            EditorGUI.indentLevel++;
            op.m_terrainsFoldedOut = editorUtils.Foldout(op.m_terrainsFoldedOut, "AffectedTerrains", helpEnabled);

            if (op.m_terrainsFoldedOut)
            {
                foreach (string name in op.m_affectedTerrainNames)
                {
                    EditorGUILayout.LabelField(name);
                }
            }
            EditorGUI.indentLevel--;

            //type specific fields, switch by op type to draw additional fields suitable for the op type

            switch (op.m_operationType)
            {
            case GaiaOperation.OperationType.CreateWorld:
                editorUtils.LabelField("xTiles", new GUIContent(op.WorldCreationSettings.m_xTiles.ToString()), helpEnabled);
                editorUtils.LabelField("zTiles", new GUIContent(op.WorldCreationSettings.m_zTiles.ToString()), helpEnabled);
                editorUtils.LabelField("TileSize", new GUIContent(op.WorldCreationSettings.m_tileSize.ToString()), helpEnabled);
                break;

            case GaiaOperation.OperationType.Spawn:
                editorUtils.LabelField("NumberOfSpawners", new GUIContent(op.SpawnOperationSettings.m_spawnerSettingsList.Count.ToString()), helpEnabled);
                float size = (float)Mathd.Max(op.SpawnOperationSettings.m_spawnArea.size.x, op.SpawnOperationSettings.m_spawnArea.size.z);
                editorUtils.LabelField("SpawnSize", new GUIContent(size.ToString()), helpEnabled);
                break;
            }
            GUI.enabled = currentGUIState;
            //Button controls
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(20);
            if (editorUtils.Button("Delete"))
            {
                if (EditorUtility.DisplayDialog(editorUtils.GetTextValue("PopupDeleteTitle"), editorUtils.GetTextValue("PopupDeleteText"), editorUtils.GetTextValue("OK"), editorUtils.GetTextValue("Cancel")))
                {
                    try
                    {
                        if (!String.IsNullOrEmpty(op.scriptableObjectAssetGUID))
                        {
                            AssetDatabase.DeleteAsset(AssetDatabase.GUIDToAssetPath(op.scriptableObjectAssetGUID));
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.LogError("Error while deleting one of the operation data files: " + ex.Message + " Stack Trace:" + ex.StackTrace);
                    }

                    sessionManager.RemoveOperation(currentIndex);
                    EditorGUIUtility.ExitGUI();
                }
            }
            GUI.enabled = op.m_isActive;
            if (editorUtils.Button("Play"))
            {
                if (EditorUtility.DisplayDialog(editorUtils.GetTextValue("PopupPlayTitle"), editorUtils.GetTextValue("PopupPlayText"), editorUtils.GetTextValue("OK"), editorUtils.GetTextValue("Cancel")))
                {
                    GaiaSessionManager.ExecuteOperation(op);
                    //Destroy all temporary tools used while executing
                    //not if it is a spawn operation since that is asynchronous
                    if (op.m_operationType != GaiaOperation.OperationType.Spawn)
                    {
                        GaiaSessionManager.DestroyTempSessionTools();
                    }
                }
            }
            GUI.enabled = currentGUIState;
            //EditorGUILayout.EndHorizontal();
            //EditorGUILayout.BeginHorizontal();
            //GUILayout.Space(20);
            if (editorUtils.Button("ViewData"))
            {
                switch (op.m_operationType)
                {
                case GaiaOperation.OperationType.CreateWorld:
                    Selection.activeObject = op.WorldCreationSettings;
                    break;

                case GaiaOperation.OperationType.Stamp:
                    Selection.activeObject = op.StamperSettings;
                    break;

                case GaiaOperation.OperationType.Spawn:
                    Selection.activeObject = op.SpawnOperationSettings;
                    break;

                case GaiaOperation.OperationType.FlattenTerrain:
                    Selection.activeObject = op.FlattenOperationSettings;
                    break;

                case GaiaOperation.OperationType.StampUndo:
                    Selection.activeObject = op.UndoRedoOperationSettings;
                    break;

                case GaiaOperation.OperationType.StampRedo:
                    Selection.activeObject = op.UndoRedoOperationSettings;
                    break;

                case GaiaOperation.OperationType.ClearSpawns:
                    Selection.activeObject = op.ClearOperationSettings;
                    break;

                case GaiaOperation.OperationType.RemoveNonBiomeResources:
                    Selection.activeObject = op.RemoveNonBiomeResourcesSettings;
                    break;

                case GaiaOperation.OperationType.MaskMapExport:
                    Selection.activeObject = op.ExportMaskMapOperationSettings;
                    break;
                }

                EditorGUIUtility.PingObject(Selection.activeObject);
            }
            switch (op.m_operationType)
            {
            case GaiaOperation.OperationType.Stamp:
                if (editorUtils.Button("PreviewInStamper"))
                {
                    Stamper stamper = GaiaSessionManager.GetOrCreateSessionStamper();
                    stamper.LoadSettings(op.StamperSettings);
#if GAIA_PRO_PRESENT
                    if (GaiaUtils.HasDynamicLoadedTerrains())
                    {
                        //We got placeholders, activate terrain loading
                        stamper.m_loadTerrainMode = LoadMode.EditorSelected;
                    }
#endif
                    Selection.activeObject = stamper.gameObject;
                }

                break;

            case GaiaOperation.OperationType.Spawn:
                if (editorUtils.Button("PreviewInSpawner"))
                {
                    BiomeController bmc         = null;
                    List <Spawner>  spawnerList = null;
                    Selection.activeObject = GaiaSessionManager.GetOrCreateSessionSpawners(op.SpawnOperationSettings, ref bmc, ref spawnerList);
                }

                break;

            case GaiaOperation.OperationType.MaskMapExport:
#if GAIA_PRO_PRESENT
                if (editorUtils.Button("PreviewInExport"))
                {
                    MaskMapExport mme = null;
                    Selection.activeObject = GaiaSessionManager.GetOrCreateMaskMapExporter(op.ExportMaskMapOperationSettings.m_maskMapExportSettings, ref mme);
                }
#endif
                break;
            }

            EditorGUILayout.EndHorizontal();
        }
Example #18
0
        private void GlobalSettings(bool helpEnabled)
        {
            m_editorUtils.Heading("GlobalSettings");
            m_profile.EnableUnderwaterEffects = m_editorUtils.Toggle("EnableUnderwaterEffects", m_profile.EnableUnderwaterEffects, helpEnabled);
            m_profile.m_seaLevel           = m_editorUtils.FloatField("SeaLevel", m_profile.m_seaLevel, helpEnabled);
            m_profile.m_playerCamera       = (Transform)m_editorUtils.ObjectField("PlayerCamera", m_profile.m_playerCamera, typeof(Transform), helpEnabled);
            m_profile.m_startingUnderwater = m_editorUtils.Toggle("StartingUnderwater", m_profile.m_startingUnderwater, helpEnabled);
            bool transitionEnabled = m_profile.m_enableTransitionFX;

            transitionEnabled = m_editorUtils.Toggle("EnableTransitionFX", transitionEnabled, helpEnabled);
            if (m_profile.m_enableTransitionFX != transitionEnabled)
            {
                m_profile.m_enableTransitionFX = transitionEnabled;
                m_profile.SetupTransitionVFX(m_profile.m_enableTransitionFX);
            }
            EditorGUILayout.Space();

            m_editorUtils.Heading("CausticSettings");
            m_profile.m_useCaustics = m_editorUtils.Toggle("UseCaustics", m_profile.m_useCaustics, helpEnabled);
            if (m_profile.m_useCaustics)
            {
                m_profile.m_mainLight           = (Light)m_editorUtils.ObjectField("MainLight", m_profile.m_mainLight, typeof(Light), helpEnabled);
                m_profile.m_framesPerSecond     = m_editorUtils.IntField("FramesPerSecond", m_profile.m_framesPerSecond, helpEnabled);
                m_profile.m_causticSize         = m_editorUtils.Slider("CausticSize", m_profile.m_causticSize, 1f, 100f, helpEnabled);
                m_profile.m_editCausticTextures = m_editorUtils.Toggle("EditCausticTextures", m_profile.m_editCausticTextures, helpEnabled);
                if (m_profile.m_editCausticTextures)
                {
                    for (int i = 0; i < m_profile.m_causticTextures.Count; i++)
                    {
                        EditorGUILayout.BeginHorizontal();
                        m_profile.m_causticTextures[i] = (Texture2D)EditorGUILayout.ObjectField(new GUIContent("[" + i + "]" + m_editorUtils.GetTextValue("CausticTexture"), m_editorUtils.GetTooltip("CausticTexture")), m_profile.m_causticTextures[i], typeof(Texture2D), false, GUILayout.MaxHeight(16f));
                        if (m_editorUtils.Button("Remove", GUILayout.MaxWidth(30f)))
                        {
                            m_profile.m_causticTextures.RemoveAt(i);
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                    if (m_editorUtils.Button("Add"))
                    {
                        m_profile.m_causticTextures.Add(null);
                    }
                }
            }
            EditorGUILayout.Space();

            m_editorUtils.Heading("FogSettings");
            m_profile.m_supportFog = m_editorUtils.Toggle("SupportFog", m_profile.m_supportFog, helpEnabled);
            if (m_profile.m_supportFog)
            {
                m_profile.m_fogColorGradient = EditorGUILayout.GradientField(new GUIContent(m_editorUtils.GetTextValue("FogColor"), m_editorUtils.GetTooltip("FogColor")), m_profile.m_fogColorGradient);
                m_editorUtils.InlineHelp("FogColor", helpEnabled);
                if (m_renderPipeline != GaiaConstants.EnvironmentRenderer.HighDefinition)
                {
                    if (RenderSettings.fogMode == FogMode.Linear)
                    {
                        m_profile.m_nearFogDistance = m_editorUtils.FloatField("FogStartDistance", m_profile.m_nearFogDistance, helpEnabled);
                        m_profile.m_fogDistance     = m_editorUtils.FloatField("FogEndDistance", m_profile.m_fogDistance, helpEnabled);
                    }
                    else
                    {
                        m_profile.m_fogDensity = m_editorUtils.Slider("FogDensity", m_profile.m_fogDensity, 0f, 1f, helpEnabled);
                    }
                }
                else
                {
                    m_profile.m_fogDistance = m_editorUtils.FloatField("FogEndDistance", m_profile.m_fogDistance, helpEnabled);
                }
            }
            EditorGUILayout.Space();

            m_editorUtils.Heading("AudioSettings");
            m_profile.m_playbackVolume      = m_editorUtils.Slider("PlaybackVolume", m_profile.m_playbackVolume, 0f, 1f, helpEnabled);
            m_profile.m_submergeSoundFXDown = (AudioClip)m_editorUtils.ObjectField("SubmergeSoundFXDown", m_profile.m_submergeSoundFXDown, typeof(AudioClip), helpEnabled);
            m_profile.m_submergeSoundFXUp   = (AudioClip)m_editorUtils.ObjectField("SubmergeSoundFXUp", m_profile.m_submergeSoundFXUp, typeof(AudioClip), helpEnabled);
            m_profile.m_underwaterSoundFX   = (AudioClip)m_editorUtils.ObjectField("UnderwaterSoundFX", m_profile.m_underwaterSoundFX, typeof(AudioClip), helpEnabled);
        }