浏览代码

Added NodeModificationScope for the onNodeModifiedCallback

Currently it is not used anywhere and all the places making the
callbacks are passing ShaderRegeneration. Need to analyse which
properties actually causes ShaderRegeneration as well as actually use
this callback to regenerate shaders rather than checking against node
version.
/main
Peter Bay Bastian 8 年前
当前提交
a848031a
共有 8 个文件被更改,包括 15 次插入12 次删除
  1. 3
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphDataSource.cs
  2. 8
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Interfaces/INode.cs
  3. 1
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/MaterialNodeDrawer.cs
  4. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs
  5. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/ColorNode.cs
  6. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/PropertyNode.cs
  7. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/TextureNode.cs
  8. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Vector1Node.cs

3
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphDataSource.cs


public IGraphAsset graphAsset { get; private set; }
void OnNodeChanged(INode inNode)
void OnNodeChanged(INode inNode, NodeModificationScope scope)
Debug.Log("OnNodeChanged");
var dependentNodes = new List<INode>();
NodeUtils.CollectNodesNodeFeedsInto(dependentNodes, inNode);
foreach (var node in dependentNodes)

8
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Interfaces/INode.cs


namespace UnityEngine.Graphing
{
public delegate void OnNodeModified(INode node);
public enum NodeModificationScope
{
Redraw,
ShaderRegeneration
}
public delegate void OnNodeModified(INode node, NodeModificationScope scope);
public interface INode
{

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


using System.Collections.Generic;
using System.Linq;
using UnityEditor.Graphing.Drawing;
using UnityEngine;
using UnityEngine.Graphing;
using UnityEngine.MaterialGraph;
using UnityEngine.RMGUI;

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs


using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEngine;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/ColorNode.cs


m_Color = value;
if (onModified != null)
{
onModified(this);
onModified(this, NodeModificationScope.ShaderRegeneration);
}
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/PropertyNode.cs


using System.Collections.Generic;
using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{

m_Exposed = value;
if (onModified != null)
{
onModified(this);
onModified(this, NodeModificationScope.ShaderRegeneration);
}
}
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/TextureNode.cs


if (onModified != null)
{
onModified(this);
onModified(this, NodeModificationScope.ShaderRegeneration);
}
}
}

m_TextureType = value;
if (onModified != null)
{
onModified(this);
onModified(this, NodeModificationScope.ShaderRegeneration);
}
}
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Vector1Node.cs


m_Value = value;
if (onModified != null)
onModified(this);
onModified(this, NodeModificationScope.ShaderRegeneration);
}
}

正在加载...
取消
保存