浏览代码
Merge pull request #207 from Unity-Technologies/peter-fixes
Merge pull request #207 from Unity-Technologies/peter-fixes
Fixes & performance improvements/main
GitHub
7 年前
当前提交
beb99728
共有 10 个文件被更改,包括 310 次插入 和 130 次删除
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
-
239MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs
-
14MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PortInputView.cs
-
53MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss
-
59MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PixelCacheProfilerView.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PixelCacheProfilerView.cs.meta
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/PixelCacheProfiler.uss
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/PixelCacheProfiler.uss.meta
-
39MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PixelCacheProfiler.uxml
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PixelCacheProfiler.uxml.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 |
|
|||
PixelCacheProfilerView > #content > #title { |
|||
font-style: bold; |
|||
} |
|||
|
|||
PixelCacheProfilerView > #content > .row { |
|||
flex-direction: row; |
|||
} |
|||
|
|||
PixelCacheProfilerView > #content > .indented { |
|||
padding-left: 8; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 61cf67e9c1f54ceab08d2bd16ffd3c53 |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} |
|
|||
<UXML xmlns:ui="UnityEngine.Experimental.UIElements"> |
|||
<ui:VisualElement name="content"> |
|||
<Style path="Styles/PixelCacheProfiler"/> |
|||
<ui:Label name="title" text="Pixel Cache Profiler"/> |
|||
<ui:VisualElement class="row"> |
|||
<ui:Label text="Total pixel caches: "/> |
|||
<ui:Label name="totalLabel" text="-"/> |
|||
</ui:VisualElement> |
|||
<ui:VisualElement class="indented row"> |
|||
<ui:Label text="Node contents: "/> |
|||
<ui:Label name="totalNodeContentsLabel" text="-"/> |
|||
</ui:VisualElement> |
|||
<ui:VisualElement class="indented row"> |
|||
<ui:Label text="Node previews: "/> |
|||
<ui:Label name="totalPreviewsLabel" text="-"/> |
|||
</ui:VisualElement> |
|||
<ui:VisualElement class="indented row"> |
|||
<ui:Label text="Inline inputs: "/> |
|||
<ui:Label name="totalInlinesLabel" text="-"/> |
|||
</ui:VisualElement> |
|||
|
|||
<ui:VisualElement class="row"> |
|||
<ui:Label text="Dirty pixel caches: "/> |
|||
<ui:Label name="dirtyLabel" text="-"/> |
|||
</ui:VisualElement> |
|||
<ui:VisualElement class="indented row"> |
|||
<ui:Label text="Node contents: "/> |
|||
<ui:Label name="dirtyNodeContentsLabel" text="-"/> |
|||
</ui:VisualElement> |
|||
<ui:VisualElement class="indented row"> |
|||
<ui:Label text="Node previews: "/> |
|||
<ui:Label name="dirtyPreviewsLabel" text="-"/> |
|||
</ui:VisualElement> |
|||
<ui:VisualElement class="indented row"> |
|||
<ui:Label text="Inline inputs: "/> |
|||
<ui:Label name="dirtyInlinesLabel" text="-"/> |
|||
</ui:VisualElement> |
|||
</ui:VisualElement> |
|||
</UXML> |
|
|||
fileFormatVersion: 2 |
|||
guid: 0fda1aff5a5744478f70542e95fd3d42 |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} |
撰写
预览
正在加载...
取消
保存
Reference in new issue