浏览代码

Undo support for all node controls

/main
Peter Bay Bastian 7 年前
当前提交
39d3dc25
共有 5 个文件被更改,包括 13 次插入2 次删除
  1. 2
      MaterialGraphProject/Assets/NewNodes/Editor/Keep/GradientNode.cs
  2. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/EnumControl.cs
  3. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/GradientControl.cs
  4. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/ObjectControl.cs
  5. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/PropertyControl.cs

2
MaterialGraphProject/Assets/NewNodes/Editor/Keep/GradientNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Procedural/Gradient Editor")]
[Title("Input/Gradient")]
public class GradientNode : AbstractMaterialNode, IGeneratesBodyCode
{
Gradient m_Gradient;

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/EnumControl.cs


{
value = EditorGUILayout.EnumPopup(m_Label, value);
if (changeCheckScope.changed)
{
m_Node.owner.owner.RegisterCompleteObjectUndo("Change " + m_Node.name);
}
}
}
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/GradientControl.cs


EditorGUILayout.PropertyField(m_SerializedProperty, m_Label, true, null);
m_SerializedObject.ApplyModifiedProperties();
if (changeCheckScope.changed)
{
m_Node.owner.owner.RegisterCompleteObjectUndo("Change " + m_Node.name);
}
}
var e = Event.current;

m_PropertyInfo.SetValue(m_Node, m_GradientObject.gradient, null);
m_PrevWindow = EditorWindow.focusedWindow.ToString();
Debug.Log("Update Gradient Shader");
}
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/ObjectControl.cs


{
value = EditorGUILayout.MiniThumbnailObjectField(m_Label, value, m_PropertyInfo.PropertyType);
if (changeCheckScope.changed)
{
m_Node.owner.owner.RegisterCompleteObjectUndo("Change " + m_Node.name);
}
}
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/PropertyControl.cs


{
var value = EditorGUILayout.Popup("Property", currentSelectedIndex, properties.Select(x => x.displayName).ToArray());
if (changeCheckScope.changed)
{
m_Node.owner.owner.RegisterCompleteObjectUndo("Change " + m_Node.name);
}
}
}
}
正在加载...
取消
保存