浏览代码

Force a repaint of scene view when changing a value in the debug menu.

/Branch_Batching2
Julien Ignace 8 年前
当前提交
9e0e6cb2
共有 2 个文件被更改,包括 42 次插入15 次删除
  1. 51
      Assets/ScriptableRenderPipeline/common/Debugging/DebugItemDrawer.cs
  2. 6
      Assets/ScriptableRenderPipeline/common/Debugging/Editor/DebugMenuEditor.cs

51
Assets/ScriptableRenderPipeline/common/Debugging/DebugItemDrawer.cs


}
#if UNITY_EDITOR
void DrawBoolItem()
bool DrawBoolItem()
{
bool value = (bool)m_MenuItem.GetValue();
if (m_MenuItem.readOnly)

if (EditorGUI.EndChangeCheck())
{
m_MenuItem.SetValue(value);
return true;
return false;
void DrawIntItem()
bool DrawIntItem()
{
int value = (int)m_MenuItem.GetValue();
if (m_MenuItem.readOnly)

if (EditorGUI.EndChangeCheck())
{
m_MenuItem.SetValue(value);
return true;
return false;
void DrawUIntItem()
bool DrawUIntItem()
{
int value = (int)(uint)m_MenuItem.GetValue();
if (m_MenuItem.readOnly)

{
value = System.Math.Max(0, value);
m_MenuItem.SetValue((uint)value);
return true;
return false;
void DrawFloatItem()
bool DrawFloatItem()
{
float value = (float)m_MenuItem.GetValue();
if(m_MenuItem.readOnly)

if (EditorGUI.EndChangeCheck())
{
m_MenuItem.SetValue(value);
return true;
return false;
void DrawColorItem()
bool DrawColorItem()
{
EditorGUI.BeginChangeCheck();
Color value = EditorGUILayout.ColorField(m_Label, (Color)m_MenuItem.GetValue());

return true;
return false;
void DrawEnumItem()
bool DrawEnumItem()
{
EditorGUI.BeginChangeCheck();
int value = EditorGUILayout.IntPopup(m_Label, (int)m_MenuItem.GetValue(), m_EnumStrings.ToArray(), m_EnumValues.ToArray());

return true;
return false;
public virtual void OnEditorGUI()
public virtual bool OnEditorGUI()
DrawBoolItem();
return DrawBoolItem();
DrawIntItem();
return DrawIntItem();
DrawUIntItem();
return DrawUIntItem();
DrawFloatItem();
return DrawFloatItem();
DrawColorItem();
return DrawColorItem();
DrawEnumItem();
return DrawEnumItem();
return false;
}
#endif
}

}
#if UNITY_EDITOR
public override void OnEditorGUI()
public override bool OnEditorGUI()
{
EditorGUI.BeginChangeCheck();
float value = EditorGUILayout.Slider(m_MenuItem.name, (float)m_MenuItem.GetValue(), m_Min, m_Max);

return true;
return false;
}
#endif
}

6
Assets/ScriptableRenderPipeline/common/Debugging/Editor/DebugMenuEditor.cs


using(new EditorGUILayout.VerticalScope())
{
DebugMenu activeMenu = m_DebugMenu.GetDebugMenu(m_DebugMenu.activeMenuIndex);
bool needRepaint = false;
activeMenu.GetDebugMenuItem(i).drawer.OnEditorGUI();
needRepaint = needRepaint || activeMenu.GetDebugMenuItem(i).drawer.OnEditorGUI();
if (needRepaint)
SceneView.RepaintAll();
}
}
}
正在加载...
取消
保存