Peter Bay Bastian
7 年前
当前提交
6ec339e3
共有 18 个文件被更改,包括 48 次插入 和 111 次删除
-
8com.unity.shadergraph/Editor/Drawing/Controls/ChannelEnumControl.cs
-
2com.unity.shadergraph/Editor/Drawing/Controls/ChannelEnumMaskControl.cs
-
4com.unity.shadergraph/Editor/Drawing/Controls/ChannelMixerControl.cs
-
2com.unity.shadergraph/Editor/Drawing/Controls/ColorControl.cs
-
2com.unity.shadergraph/Editor/Drawing/Controls/CubemapControl.cs
-
14com.unity.shadergraph/Editor/Drawing/Controls/DielectricSpecularControl.cs
-
2com.unity.shadergraph/Editor/Drawing/Controls/IntegerControl.cs
-
20com.unity.shadergraph/Editor/Drawing/Controls/SliderControl.cs
-
2com.unity.shadergraph/Editor/Drawing/Controls/TextureControl.cs
-
4com.unity.shadergraph/Editor/Drawing/Controls/ToggleControl.cs
-
8com.unity.shadergraph/Editor/Drawing/Controls/VectorControl.cs
-
2com.unity.shadergraph/Editor/Drawing/Inspector/MasterPreviewView.cs
-
14com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs
-
4com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs
-
2com.unity.shadergraph/Editor/Drawing/Views/Slots/MultiFloatSlotControlView.cs
-
7com.unity.shadergraph/Editor/Util/CompatibilityExtensions.cs
-
59com.unity.shadergraph/Editor/Drawing/Views/PixelCacheProfilerView.cs
-
3com.unity.shadergraph/Editor/Drawing/Views/PixelCacheProfilerView.cs.meta
|
|||
using System.Linq; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing |
|||
{ |
|||
public class PixelCacheProfilerView : VisualElement |
|||
{ |
|||
readonly VisualElement m_Target; |
|||
Label m_TotalLabel; |
|||
Label m_DirtyLabel; |
|||
Label m_TotalNodeContentsLabel; |
|||
Label m_DirtyNodeContentsLabel; |
|||
Label m_TotalPreviewsLabel; |
|||
Label m_DirtyPreviewsLabel; |
|||
Label m_TotalInlinesLabel; |
|||
Label m_DirtyInlinesLabel; |
|||
|
|||
public PixelCacheProfilerView(VisualElement target) |
|||
{ |
|||
m_Target = target; |
|||
|
|||
var tpl = Resources.Load<VisualTreeAsset>("UXML/PixelCacheProfiler"); |
|||
tpl.CloneTree(this, null); |
|||
|
|||
m_TotalLabel = this.Q<Label>("totalLabel"); |
|||
m_DirtyLabel = this.Q<Label>("dirtyLabel"); |
|||
m_TotalNodeContentsLabel = this.Q<Label>("totalNodeContentsLabel"); |
|||
m_DirtyNodeContentsLabel = this.Q<Label>("dirtyNodeContentsLabel"); |
|||
m_TotalPreviewsLabel = this.Q<Label>("totalPreviewsLabel"); |
|||
m_DirtyPreviewsLabel = this.Q<Label>("dirtyPreviewsLabel"); |
|||
m_TotalInlinesLabel = this.Q<Label>("totalInlinesLabel"); |
|||
m_DirtyInlinesLabel = this.Q<Label>("dirtyInlinesLabel"); |
|||
} |
|||
|
|||
public void Profile() |
|||
{ |
|||
var caches = m_Target.Query().Where(ve => ve.clippingOptions == ClippingOptions.ClipAndCacheContents).Build().ToList(); |
|||
var dirtyCaches = caches.Where(ve => ve.IsDirty(ChangeType.Repaint)).ToList(); |
|||
m_TotalLabel.text = caches.Count.ToString(); |
|||
m_DirtyLabel.text = dirtyCaches.Count.ToString(); |
|||
|
|||
var nodeContentsCaches = caches.Where(ve => ve.name == "node-border").ToList(); |
|||
var dirtyNodeContentsCaches = nodeContentsCaches.Where(ve => ve.IsDirty(ChangeType.Repaint)).ToList(); |
|||
m_TotalNodeContentsLabel.text = nodeContentsCaches.Count.ToString(); |
|||
m_DirtyNodeContentsLabel.text = dirtyNodeContentsCaches.Count.ToString(); |
|||
|
|||
var previewCaches = caches.Where(ve => ve.name == "previewContainer").ToList(); |
|||
var dirtyPreviewCaches = previewCaches.Where(ve => ve.IsDirty(ChangeType.Repaint)).ToList(); |
|||
m_TotalPreviewsLabel.text = previewCaches.Count.ToString(); |
|||
m_DirtyPreviewsLabel.text = dirtyPreviewCaches.Count.ToString(); |
|||
|
|||
var inlineCaches = caches.Where(ve => ve.name == "portInputContainer").ToList(); |
|||
var dirtyInlineCaches = inlineCaches.Where(ve => ve.IsDirty(ChangeType.Repaint)).ToList(); |
|||
m_TotalInlinesLabel.text = inlineCaches.Count.ToString(); |
|||
m_DirtyInlinesLabel.text = dirtyInlineCaches.Count.ToString(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7147f25b12dd4427b4c8afd44624f35b |
|||
timeCreated: 1517227822 |
撰写
预览
正在加载...
取消
保存
Reference in new issue