浏览代码

Add change notifications for shader properties

/main
Peter Bay Bastian 7 年前
当前提交
314ba653
共有 4 个文件被更改,包括 43 次插入2 次删除
  1. 2
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/SerializableGraph.cs
  2. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/AbstractMaterialGraph.cs
  3. 28
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Interfaces/MaterialGraphChange.cs
  4. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Interfaces/MaterialGraphChange.cs.meta

2
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/SerializableGraph.cs


public OnGraphChange onChange { get; set; }
void NotifyChange(GraphChange change)
protected void NotifyChange(GraphChange change)
{
if (onChange != null)
onChange(change);

4
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/AbstractMaterialGraph.cs


return;
m_Properties.Add(property);
NotifyChange(new ShaderPropertyAdded(property));
m_Properties.RemoveAll(x => x.guid == guid);
if (m_Properties.RemoveAll(x => x.guid == guid) > 0)
NotifyChange(new ShaderPropertyRemoved(guid));
}
public override Dictionary<SerializationHelper.TypeSerializationInfo, SerializationHelper.TypeSerializationInfo> GetLegacyTypeRemapping()

28
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Interfaces/MaterialGraphChange.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
public class ShaderPropertyAdded : GraphChange
{
public ShaderPropertyAdded(IShaderProperty shaderProperty)
{
this.shaderProperty = shaderProperty;
}
public IShaderProperty shaderProperty { get; private set; }
}
public class ShaderPropertyRemoved : GraphChange
{
public ShaderPropertyRemoved(Guid guid)
{
this.guid = this.guid;
}
public Guid guid { get; private set; }
}
}

11
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Interfaces/MaterialGraphChange.cs.meta


fileFormatVersion: 2
guid: 53af639a9c00c2740ba7f23e2b38cf34
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存