浏览代码

New SceneSettingsManager based on a stack. Also commited updated .meta since last folder rename.

/Branch_Batching2
Julien Ignace 8 年前
当前提交
095ce858
共有 20 个文件被更改,包括 200 次插入78 次删除
  1. 2
      Assets/ScriptableRenderPipeline.meta
  2. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline.meta
  3. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor.meta
  4. 22
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs
  5. 8
      Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.asset
  6. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting.meta
  7. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Resources.meta
  8. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass.meta
  9. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material.meta
  10. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit.meta
  11. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit.meta
  12. 31
      Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettings.cs
  13. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass.meta
  14. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky.meta
  15. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources.meta
  16. 55
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/SceneSettingsManagementWindow.cs
  17. 81
      Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettingsManager.cs
  18. 12
      Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettingsManager.cs.meta
  19. 45
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipeWindow.cs
  20. 0
      /Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/SceneSettingsManagementWindow.cs.meta

2
Assets/ScriptableRenderPipeline.meta


fileFormatVersion: 2
guid: 7f2fa2efb8ce343069fc5393536094ad
guid: 403e54624681147459c529bbda90360e
folderAsset: yes
timeCreated: 1466769773
licenseType: Pro

2
Assets/ScriptableRenderPipeline/HDRenderPipeline.meta


fileFormatVersion: 2
guid: 4c38eac64d0e8344d85c9f309419d619
guid: a75de3f722a762f4daf65be08cd9c5c6
folderAsset: yes
timeCreated: 1483548930
licenseType: Pro

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor.meta


fileFormatVersion: 2
guid: ab51b986e84ae98449eab2308fbe74db
guid: 6170264326b703040b82caf4f14a7567
folderAsset: yes
timeCreated: 1479127051
licenseType: Pro

22
Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs


using UnityEngine;
using UnityEditor;
using UnityEngine.SceneManagement;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{

LayeredLitGUI.SynchronizeAllLayers(mat);
}
}
}
[MenuItem("HDRenderPipeline/Create Scene Settings")]
public static void CreateSceneSettings()
{
var allSettings = Object.FindObjectsOfType<SceneSettings>();
var activeScene = SceneManager.GetActiveScene();
foreach (SceneSettings setting in allSettings)
{
if (setting.gameObject.scene == activeScene)
{
EditorUtility.DisplayDialog("Create Scene Settings", "Scene settings already exist on scene " + activeScene.name + ". \n\n If you want to create on another scene, set it active (double click) first, then select this option in the menu.", "Got It!");
return;
}
}
var manager = new GameObject();
manager.name = "Scene Settings";
manager.AddComponent<SceneSettings>();
}
}
}

8
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.asset


type: 2}
globalDebugParameters:
debugOverlayRatio: 0.33
displayMaterialDebug: 0
displayRenderingDebug: 0
displayLightingDebug: 0
displayMaterialDebug: 1
displayRenderingDebug: 1
displayLightingDebug: 1
materialDebugParameters:
debugViewMaterial: 0
lightingDebugParameters:

enabled: 1
shadowAtlasWidth: 4096
shadowAtlasHeight: 4096
maxShadowDistance: 1000
maxShadowDistance: 400
directionalLightCascadeCount: 4
directionalLightCascades: {x: 0.05, y: 0.2, z: 0.3}
directionalLightNearPlaneOffset: 5

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting.meta


fileFormatVersion: 2
guid: 1c14e71d397fce047b1675fc26d0bb48
guid: 3002976b0b09954499dd1f6e00169b06
folderAsset: yes
timeCreated: 1474297943
licenseType: Pro

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Resources.meta


fileFormatVersion: 2
guid: 8d7b73e3debb13b46a544563ce8f4a64
guid: 0823a45531ce4ee45ab39bcbe1ea52a6
folderAsset: yes
timeCreated: 1479129942
licenseType: Pro

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass.meta


fileFormatVersion: 2
guid: 8a355c056864a5d4cb26d9c3168ae0bb
guid: 8d0d2ae5d51ae6e42a81b92e8693272f
folderAsset: yes
timeCreated: 1479218330
licenseType: Pro

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material.meta


fileFormatVersion: 2
guid: 96af336cb096f854ea18990a1c0a4e19
guid: 49844bc6823848a4087668ebd3367436
folderAsset: yes
timeCreated: 1474297943
licenseType: Pro

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit.meta


fileFormatVersion: 2
guid: e173dfe6cd75d954b95306237244f6de
guid: c526d3e6d7f3ce1408308bb431089d2d
folderAsset: yes
timeCreated: 1476653183
licenseType: Pro

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit.meta


fileFormatVersion: 2
guid: d6cadd3aaf3ad6641b86e85a0929b245
guid: 0d05f89ce69203543914d745c388e6bb
folderAsset: yes
timeCreated: 1476653183
licenseType: Pro

31
Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettings.cs


[ExecuteInEditMode]
public class SceneSettings : MonoBehaviour
{
public CommonSettings SceneCommonSettings
public CommonSettings commonSettings
set { m_CommonSettings = value; ApplySettings(); }
public SkyParameters SceneSkyParameters
public SkyParameters skyParameters
set { m_SkyParameters = value; ApplySettings(); }
[SerializeField]
private CommonSettings m_CommonSettings;
[SerializeField]
private SkyParameters m_SkyParameters;
[SerializeField] private CommonSettings m_CommonSettings;
[SerializeField] private SkyParameters m_SkyParameters;
ApplySettings();
SceneSettingsManager.instance.AddSceneSettings(this);
void OnValidate()
void OnDisable()
ApplySettings();
SceneSettingsManager.instance.RemoveSceneSettings(this);
private void ApplySettings()
void OnValidate()
if (m_CommonSettings != null)
CommonSettingsSingleton.overrideSettings = m_CommonSettings;
// If the setting is already the one currently used we need to tell the manager to reapply it.
if(SceneSettingsManager.instance.GetCurrentSceneSetting())
{
SceneSettingsManager.instance.UpdateCurrentSceneSetting();
}
}
if (m_SkyParameters != null)
SkyParametersSingleton.overrideSettings = m_SkyParameters;
}
}
}

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass.meta


fileFormatVersion: 2
guid: e3b3ad4462341ec4b86566ec1fd82c7c
guid: 057d8506536500045b3047320a4d6122
folderAsset: yes
timeCreated: 1476885561
licenseType: Pro

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky.meta


fileFormatVersion: 2
guid: 066ab4d03bd03384f81c9d82b479f8dd
guid: 99e8d5bd81663624399d10e3fc27571c
folderAsset: yes
timeCreated: 1479239906
licenseType: Pro

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources.meta


fileFormatVersion: 2
guid: 4cdc45a9a65126a42aca158413a5b089
guid: 920208451db81a846ae1c2d55f7b50b4
folderAsset: yes
timeCreated: 1479239906
licenseType: Pro

55
Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/SceneSettingsManagementWindow.cs


using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
public class SceneSettingsManagementWindow : EditorWindow
{
[MenuItem("HDRenderPipeline/Scene Settings Management")]
static void SceneSettingsManagement()
{
GetWindow<SceneSettingsManagementWindow>().Show();
}
static private string m_LastCreationPath = "Assets";
void CreateAsset<AssetType>(string assetName) where AssetType : ScriptableObject
{
string assetPath = EditorUtility.SaveFilePanel("Create new Asset", m_LastCreationPath, assetName, "asset");
if (!string.IsNullOrEmpty(assetPath))
{
assetPath = assetPath.Substring(assetPath.LastIndexOf("Assets"));
m_LastCreationPath = System.IO.Path.GetDirectoryName(assetPath);
var instance = CreateInstance<AssetType>();
AssetDatabase.CreateAsset(instance, assetPath);
}
}
void OnGUI()
{
// Keep it there temporarily until it's back to an "engine" setting in the HDRenderPipeline asset.
SubsurfaceScatteringSettings.overrideSettings = (SubsurfaceScatteringParameters)EditorGUILayout.ObjectField(new GUIContent("SSS Settings"), SubsurfaceScatteringSettings.overrideSettings, typeof(SubsurfaceScatteringParameters), false);
EditorGUILayout.Space();
if (GUILayout.Button("Create new Common Settings"))
{
CreateAsset<CommonSettings>("NewCommonSettings");
}
if (GUILayout.Button("Create new HDRI sky params"))
{
CreateAsset<HDRISkyParameters>("NewHDRISkyParameters");
}
if (GUILayout.Button("Create new Procedural sky params"))
{
CreateAsset<ProceduralSkyParameters>("NewProceduralSkyParameters");
}
if (GUILayout.Button("Create new SSS params"))
{
CreateAsset<SubsurfaceScatteringParameters>("NewSssParameters");
}
}
}
}

81
Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettingsManager.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public class SceneSettingsManager
{
static private SceneSettingsManager s_Instance = null;
static public SceneSettingsManager instance
{
get
{
if(s_Instance == null)
s_Instance = new SceneSettingsManager();
return s_Instance;
}
}
private List<SceneSettings> m_SceneSettingsList = new List<SceneSettings>();
void OnEnable()
{
}
void OnDisable()
{
}
public SceneSettings GetCurrentSceneSetting()
{
if (m_SceneSettingsList.Count == 0)
return null;
else
return m_SceneSettingsList[m_SceneSettingsList.Count - 1];
}
// This can be needed in the editor in case the current setting is being changed. In this case we need to reapply it.
public void UpdateCurrentSceneSetting()
{
if (m_SceneSettingsList.Count != 0)
ApplySettings(GetCurrentSceneSetting());
}
public void AddSceneSettings(SceneSettings settings)
{
m_SceneSettingsList.Add(settings);
ApplySettings(settings);
}
public void RemoveSceneSettings(SceneSettings settings)
{
m_SceneSettingsList.Remove(settings);
// Always reapply the settings at the top of the list
// (this way if the setting being removed was the active one we switch to the next one)
ApplySettings(GetCurrentSceneSetting());
}
private void ApplySettings(SceneSettings settings)
{
if(settings)
{
if (settings.commonSettings != null)
CommonSettingsSingleton.overrideSettings = settings.commonSettings;
if (settings.skyParameters != null)
SkyParametersSingleton.overrideSettings = settings.skyParameters;
}
else
{
CommonSettingsSingleton.overrideSettings = null;
SkyParametersSingleton.overrideSettings = null;
}
}
}
}

12
Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettingsManager.cs.meta


fileFormatVersion: 2
guid: f31f023dee834de44993536e71ee27ac
timeCreated: 1487241314
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

45
Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipeWindow.cs


using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
public class HDRenderPipeWindow : EditorWindow
{
[MenuItem("HDRenderPipeline/Configure Overrides")]
static void ConfigureOverrides()
{
GetWindow<HDRenderPipeWindow>().Show();
}
void OnGUI()
{
CommonSettingsSingleton.overrideSettings = (CommonSettings)EditorGUILayout.ObjectField(new GUIContent("Common Settings"), CommonSettingsSingleton.overrideSettings, typeof(CommonSettings), false);
SkyParametersSingleton.overrideSettings = (SkyParameters)EditorGUILayout.ObjectField(new GUIContent("Sky Settings"), SkyParametersSingleton.overrideSettings, typeof(SkyParameters), false);
SubsurfaceScatteringSettings.overrideSettings = (SubsurfaceScatteringParameters)EditorGUILayout.ObjectField(new GUIContent("Subsurface Scattering Settings"), SubsurfaceScatteringSettings.overrideSettings, typeof(SubsurfaceScatteringParameters), false);
if (GUILayout.Button("Create new common settings"))
{
var instance = CreateInstance<CommonSettings>();
AssetDatabase.CreateAsset(instance, "Assets/NewCommonSettings.asset");
}
if (GUILayout.Button("Create new HDRI sky params"))
{
var instance = CreateInstance<HDRISkyParameters>();
AssetDatabase.CreateAsset(instance, "Assets/NewHDRISkyParameters.asset");
}
if (GUILayout.Button("Create new Procedural sky params"))
{
var instance = CreateInstance<ProceduralSkyParameters>();
AssetDatabase.CreateAsset(instance, "Assets/NewProceduralSkyParameters.asset");
}
if (GUILayout.Button("Create new SSS params"))
{
var instance = CreateInstance<SubsurfaceScatteringParameters>();
AssetDatabase.CreateAsset(instance, "Assets/NewSssParameters.asset");
}
}
}
}

/Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipeWindow.cs.meta → /Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/SceneSettingsManagementWindow.cs.meta

正在加载...
取消
保存