浏览代码

Merge pull request #514 from Unity-Technologies/Branch_FixDebugWindow

Branch fix debug window
/Yibing-Project-2
GitHub 7 年前
当前提交
11796663
共有 3 个文件被更改,包括 34 次插入16 次删除
  1. 2
      ScriptableRenderPipeline/Core/Debugging/DebugMenuManager.cs
  2. 39
      ScriptableRenderPipeline/Core/Debugging/DebugMenuState.cs
  3. 9
      ScriptableRenderPipeline/Core/Debugging/Editor/DebugMenuEditor.cs

2
ScriptableRenderPipeline/Core/Debugging/DebugMenuManager.cs


if(m_DebugMenuState != null && m_DebugMenuStateDirty)
{
m_DebugMenuStateDirty = false;
m_DebugMenuState.UpdateAllDebugItems();
m_DebugMenuState.ReInitializeDebugItemStates();
}
m_DebugMenuUI.Update();

39
ScriptableRenderPipeline/Core/Debugging/DebugMenuState.cs


#if UNITY_EDITOR
UnityEditor.Undo.undoRedoPerformed += OnUndoRedoPerformed;
#endif
DebugMenuManager.instance.SetDebugMenuState(this);
}
public void OnDisable()
{
DebugMenuManager.instance.SetDebugMenuState(null);
#if UNITY_EDITOR
UnityEditor.Undo.undoRedoPerformed -= OnUndoRedoPerformed;
#endif
}
public void ReInitializeDebugItemStates()
{
CleanUp();
// Populate item states
DebugMenuManager dmm = DebugMenuManager.instance;
for (int panelIdx = 0; panelIdx < dmm.panelCount; ++panelIdx)

if (debugItemState == null)
{
debugItemState = item.handler.CreateDebugItemState();
if(debugItemState != null)
if (debugItemState != null)
{
debugItemState.hideFlags = HideFlags.DontSave;
debugItemState.Initialize(item);

}
}
DebugMenuManager.instance.SetDebugMenuState(this);
UpdateAllDebugItems();
public void OnDisable()
private void CleanUp()
#if UNITY_EDITOR
UnityEditor.Undo.undoRedoPerformed -= OnUndoRedoPerformed;
#endif
foreach (var item in m_ItemStateList)
{
Object.DestroyImmediate(item);
}
m_ItemStateList.Clear();
foreach(var item in m_ItemStateList)
{
Object.DestroyImmediate(item);
}
CleanUp();
}
void OnUndoRedoPerformed()

#endif
}
public void AddDebugItemState(DebugItemState state)
private void AddDebugItemState(DebugItemState state)
{
m_ItemStateList.Add(state);
}

return m_ItemStateList.Find(x => x.itemName == item.name && x.panelName == item.panelName);
}
public void UpdateAllDebugItems()
private void UpdateAllDebugItems()
{
foreach (var itemState in m_ItemStateList)
{

9
ScriptableRenderPipeline/Core/Debugging/Editor/DebugMenuEditor.cs


{
DebugItemState debugItemState = m_DebugMenuState.FindDebugItemState(item);
UnityEditor.Undo.RecordObject(debugItemState, "DebugMenu State Update");
debugItemState.SetValue(item.GetValue());
EditorUtility.SetDirty(m_DebugMenuState);
if(debugItemState != null)
{
UnityEditor.Undo.RecordObject(debugItemState, "DebugMenu State Update");
debugItemState.SetValue(item.GetValue());
EditorUtility.SetDirty(m_DebugMenuState);
}
}
void OnGUI()

正在加载...
取消
保存