浏览代码

Preview rendering works again for non-time-dependent nodes

/main
Peter Bay Bastian 7 年前
当前提交
f589fb80
共有 3 个文件被更改,包括 19 次插入6 次删除
  1. 10
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/MaterialNodeDrawer.cs
  2. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialNodePresenter.cs
  3. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/NodePreviewPresenter.cs

10
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/MaterialNodeDrawer.cs


using System.Linq;
using UnityEditor.Experimental.UIElements.GraphView;
using UnityEditor.Graphing.Drawing;
using UnityEditor.Graphing.Util;
using UnityEngine.Graphing;
using UnityEngine.MaterialGraph;
using UnityEngine;

{
data.OnModified(ModificationScope.Node);
UpdatePreviewTexture(m_currentPreviewData);
Dirty(ChangeType.Repaint);
}
ListPool<INode>.Release(childrenNodes);
}

m_PreviewImage.RemoveFromClassList("inactive");
m_PreviewImage.image = texture;
}
Dirty(ChangeType.Repaint);
}
void UpdateControls(MaterialNodePresenter nodeData)

m_ControlsContainer.ClearChildren();
if (controlPresenters.ItemsReferenceEquals(m_CurrentControlPresenter) && nodeData.expanded)
return;
m_ControlsContainer.Clear();
m_CurrentControlPresenter.Clear();
if (!nodeData.expanded)

{
m_ControlsContainer.AddChild(CreateControl(controlData));
m_ControlsContainer.Add(CreateControl(controlData));
m_CurrentControlPresenter.Add(controlData);
}
}

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialNodePresenter.cs


using UnityEngine.Graphing;
using UnityEngine.MaterialGraph;
using UnityEditor.Experimental.UIElements.GraphView;
using UnityEngine;
namespace UnityEditor.MaterialGraph.Drawing
{

[SerializeField]
[SerializeField]
int m_Version;
public bool requiresTime
{

public override void OnModified(ModificationScope scope)
{
m_Version++;
base.OnModified(scope);
// TODO: Propagate callback rather than setting property
if (m_NodePreviewPresenter != null)

public override void Initialize(INode inNode)
{
base.Initialize(inNode);
m_Version = 0;
AddPreview(inNode);
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/NodePreviewPresenter.cs


if (m_Node.hasPreview == false)
return null;
if (m_modificationScope != ModificationScope.Nothing)
var scope = m_modificationScope;
m_modificationScope = ModificationScope.Nothing;
if (scope != ModificationScope.Nothing)
if (m_modificationScope >= ModificationScope.Graph)
if (scope >= ModificationScope.Graph)
m_modificationScope = ModificationScope.Nothing;
}
else if (m_texture == null)
{

正在加载...
取消
保存