浏览代码

Remove preview rate limitation button

/main
Peter Bay Bastian 7 年前
当前提交
b4404ee6
共有 2 个文件被更改,包括 3 次插入37 次删除
  1. 14
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewManager.cs
  2. 26
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs

14
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewManager.cs


using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;

MaterialPropertyBlock m_PreviewPropertyBlock;
PreviewSceneResources m_SceneResources;
Texture2D m_ErrorTexture;
DateTime m_LastUpdate;
public PreviewRate previewRate { get; set; }
public PreviewRenderData masterRenderData
{

public void RenderPreviews()
{
if (previewRate == PreviewRate.Off)
return;
var updateTime = DateTime.Now;
if (previewRate == PreviewRate.Throttled && (updateTime - m_LastUpdate) < TimeSpan.FromSeconds(1.0 / 10.0))
return;
m_LastUpdate = updateTime;
if (m_DirtyShaders.Any())
{
m_NodesWith3DPreview.Clear();

26
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs


MaterialGraphView m_GraphView;
GraphInspectorView m_GraphInspectorView;
ToolbarView m_ToolbarView;
ToolbarButtonView m_TimeButton;
AbstractMaterialGraph m_Graph;
PreviewManager m_PreviewManager;

get { return m_GraphView; }
}
public PreviewRate previewRate
{
get { return previewManager.previewRate; }
set { previewManager.previewRate = value; }
}
public PreviewManager previewManager
PreviewManager previewManager
public GraphInspectorView inspectorView
GraphInspectorView inspectorView
{
get { return m_GraphInspectorView; }
}

m_ToolbarView.Add(showInProjectButton);
m_ToolbarView.Add(new ToolbarSeparatorView());
m_ToolbarView.Add(new ToolbarSpaceView());
m_ToolbarView.Add(new ToolbarSeparatorView());
m_TimeButton = new ToolbarButtonView { text = "Preview rate: " + previewRate };
m_TimeButton.AddManipulator(new Clickable(() =>
{
if (previewRate == PreviewRate.Full)
previewRate = PreviewRate.Throttled;
else if (previewRate == PreviewRate.Throttled)
previewRate = PreviewRate.Off;
else if (previewRate == PreviewRate.Off)
previewRate = PreviewRate.Full;
m_TimeButton.text = "Preview rate: " + previewRate;
}));
m_ToolbarView.Add(m_TimeButton);
}
Add(m_ToolbarView);

正在加载...
取消
保存