浏览代码

Created an override for the Lighting debug panel.

/Branch_Batching2
Julien Ignace 7 年前
当前提交
c25417c7
共有 8 个文件被更改,包括 116 次插入24 次删除
  1. 16
      Assets/ScriptableRenderPipeline/Core/Debugging/DebugItemHandler.cs
  2. 1
      Assets/ScriptableRenderPipeline/Core/Debugging/DebugMenuManager.cs
  3. 15
      Assets/ScriptableRenderPipeline/Core/Debugging/DebugMenuUI.cs
  4. 10
      Assets/ScriptableRenderPipeline/Core/Debugging/DebugPanel.cs
  5. 14
      Assets/ScriptableRenderPipeline/Core/Debugging/DebugPanelUI.cs
  6. 2
      Assets/ScriptableRenderPipeline/Core/Debugging/Editor/DebugMenuEditor.cs
  7. 70
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/LightingDebugPanel.cs
  8. 12
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/LightingDebugPanel.cs.meta

16
Assets/ScriptableRenderPipeline/Core/Debugging/DebugItemHandler.cs


// Method that will create UI items for runtime debug menu.
public abstract DebugItemUI BuildGUI(GameObject parent);
// Method users need to override for editor specific UI
public abstract bool OnEditorGUI();
public abstract bool OnEditorGUIImpl();
public void OnEditorGUI()
{
if(OnEditorGUIImpl())
{
DebugMenuUI.changed = true;
}
}
// Method users need to override for specific serialization of custom types.
public abstract DebugItemState CreateDebugItemState();
}

return false;
}
public override bool OnEditorGUI()
public override bool OnEditorGUIImpl()
{
Initialize();

}
#if UNITY_EDITOR
public override bool OnEditorGUI()
public override bool OnEditorGUIImpl()
{
Initialize();

}
#if UNITY_EDITOR
public override bool OnEditorGUI()
public override bool OnEditorGUIImpl()
{
Initialize();

1
Assets/ScriptableRenderPipeline/Core/Debugging/DebugMenuManager.cs


private void AddDebugPanel(DebugPanel panel)
{
m_DebugPanels.Add(panel);
m_DebugMenuUI.AddDebugPanel(panel);
}
public void AddDebugItem<DebugPanelType, DebugItemType>(string name, Func<object> getter, Action<object> setter = null, bool dynamicDisplay = false, DebugItemHandler handler = null) where DebugPanelType : DebugPanel

15
Assets/ScriptableRenderPipeline/Core/Debugging/DebugMenuUI.cs


public bool isEnabled { get { return m_Enabled; } }
public int activePanelIndex { get { return m_ActivePanelIndex; } set { m_ActivePanelIndex = value; } }
static bool s_UIChanged = false;
static public bool changed { get { return s_UIChanged; } set { s_UIChanged = value; } }
public DebugMenuUI(DebugMenuManager manager)
{
m_DebugMenuManager = manager;

m_DebugMenuManager.GetPersistentDebugPanel().panelUI.BuildGUI(m_PersistentPanelLayout);
m_PersistentDebugPanelUI = m_DebugMenuManager.GetPersistentDebugPanel().panelUI;
m_DebugPanelUIs.Clear();
m_DebugPanelUIs.Add(m_DebugMenuManager.GetDebugPanel(i).panelUI);
public void AddDebugPanel(DebugPanel panel)
{
m_DebugPanelUIs.Add(panel.panelUI);
}
s_UIChanged = false;
if(s_UIChanged)
{
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
}
}
#endif

10
Assets/ScriptableRenderPipeline/Core/Debugging/DebugPanel.cs


}
newItem.SetDebugItemState(itemState);
//m_DebugPanelUI.RebuildGUI();
}
}

{
m_DebugPanelUI = new DebugPanelUIClass();
m_DebugPanelUI.SetDebugPanel(this);
}
}
public class LightingDebugPanel
: DebugPanel<DebugPanelUI>
{
public LightingDebugPanel()
: base("Lighting")
{
}
}
}

14
Assets/ScriptableRenderPipeline/Core/Debugging/DebugPanelUI.cs


menuVLRectTransform.anchorMin = new Vector2(0.0f, 0.0f);
menuVLRectTransform.anchorMax = new Vector2(1.0f, 1.0f);
DebugMenuUI.CreateTextElement(string.Format("{0} Title", m_DebugPanel.name), m_DebugPanel.name, 14, TextAnchor.MiddleLeft, m_Root);
for (int i = 0; i < m_Root.transform.childCount; ++i)
{
Object.DestroyImmediate(m_Root.transform.GetChild(i).gameObject);
}
BuildGUIImpl(m_Root);
}

DebugMenuUI.CreateTextElement(string.Format("{0} Title", m_DebugPanel.name), m_DebugPanel.name, 14, TextAnchor.MiddleLeft, m_Root);
m_ItemsUI.Clear();
for (int i = 0; i < m_DebugPanel.itemCount; i++)
{

{
using (new UnityEditor.EditorGUILayout.VerticalScope())
{
bool needRepaint = false;
needRepaint = needRepaint || m_DebugPanel.GetDebugItem(i).handler.OnEditorGUI();
m_DebugPanel.GetDebugItem(i).handler.OnEditorGUI();
if (needRepaint)
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
}
}
#endif

2
Assets/ScriptableRenderPipeline/Core/Debugging/Editor/DebugMenuEditor.cs


// Contrary to the menu in the player, here we always render the menu wether it's enabled or not. This is a separate window so user can manage it however they want.
EditorGUI.BeginChangeCheck();
DebugMenuUI debugMenuUI = m_DebugMenu.menuUI;
int debugMenuCount = debugMenuUI.panelCount;
int debugMenuCount = m_DebugMenu.panelCount;
int activePanelIndex = debugMenuUI.activePanelIndex;
using (new EditorGUILayout.HorizontalScope())
{

70
Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/LightingDebugPanel.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public class LightingDebugPanelUI
: DebugPanelUI
{
#if UNITY_EDITOR
public override void OnEditorGUI()
{
using (new UnityEditor.EditorGUILayout.VerticalScope())
{
m_DebugPanel.GetDebugItem("Enable Shadows").handler.OnEditorGUI();
DebugItem shadowDebug = m_DebugPanel.GetDebugItem("Shadow Debug Mode");
shadowDebug.handler.OnEditorGUI();
if ((ShadowMapDebugMode)shadowDebug.GetValue() == ShadowMapDebugMode.VisualizeShadowMap)
{
EditorGUI.indentLevel++;
m_DebugPanel.GetDebugItem("Shadow Map Index").handler.OnEditorGUI();
EditorGUI.indentLevel--;
}
DebugItem lightingDebugModeItem = m_DebugPanel.GetDebugItem("Lighting Debug Mode");
lightingDebugModeItem.handler.OnEditorGUI();
if ((DebugLightingMode)lightingDebugModeItem.GetValue() == DebugLightingMode.SpecularLighting)
{
EditorGUI.indentLevel++;
DebugItem overrideSmoothnessItem = m_DebugPanel.GetDebugItem("Override Smoothness");
overrideSmoothnessItem.handler.OnEditorGUI();
if ((bool)overrideSmoothnessItem.GetValue())
{
m_DebugPanel.GetDebugItem("Override Smoothness Value").handler.OnEditorGUI();
}
EditorGUI.indentLevel--;
}
else if ((DebugLightingMode)lightingDebugModeItem.GetValue() == DebugLightingMode.DiffuseLighting)
{
EditorGUI.indentLevel++;
m_DebugPanel.GetDebugItem("Debug Lighting Albedo").handler.OnEditorGUI();
EditorGUI.indentLevel--;
}
DebugItem displaySkyReflecItem = m_DebugPanel.GetDebugItem("Display Sky Reflection");
displaySkyReflecItem.handler.OnEditorGUI();
if ((bool)displaySkyReflecItem.GetValue())
{
EditorGUI.indentLevel++;
m_DebugPanel.GetDebugItem("Sky Reflection Mipmap").handler.OnEditorGUI();
EditorGUI.indentLevel--;
}
}
}
#endif
}
public class LightingDebugPanel
: DebugPanel<LightingDebugPanelUI>
{
public LightingDebugPanel()
: base("Lighting")
{
}
}
}

12
Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/LightingDebugPanel.cs.meta


fileFormatVersion: 2
guid: 19cc6398a661be547848eb23d58699cf
timeCreated: 1495638676
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存