浏览代码

Refactored exposedState control into own NodeDrawData class

/main
Peter Bay Bastian 8 年前
当前提交
860cb402
共有 5 个文件被更改,包括 51 次插入16 次删除
  1. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector1NodeDrawData.cs
  2. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector2NodeDrawData.cs
  3. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector3NodeDrawData.cs
  4. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector4NodeDrawData.cs
  5. 39
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/PropertyNodeDrawData.cs

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector1NodeDrawData.cs


if (tNode == null)
return;
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState);
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
public class Vector1NodeDrawData : MaterialNodeDrawData
public class Vector1NodeDrawData : PropertyNodeDrawData
return new List<GraphElementData> { instance };
return new List<GraphElementData>(base.GetControlData()) { instance };
}
}
}

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector2NodeDrawData.cs


if (tNode == null)
return;
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState);
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
public class Vector2NodeDrawData : MaterialNodeDrawData
public class Vector2NodeDrawData : PropertyNodeDrawData
return new List<GraphElementData> { instance };
return new List<GraphElementData>(base.GetControlData()) { instance };
}
}
}

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector3NodeDrawData.cs


if (tNode == null)
return;
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState);
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
public class Vector3NodeDrawData : MaterialNodeDrawData
public class Vector3NodeDrawData : PropertyNodeDrawData
return new List<GraphElementData> { instance };
return new List<GraphElementData>(base.GetControlData()) { instance };
}
}
}

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector4NodeDrawData.cs


if (tNode == null)
return;
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState);
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
public class Vector4NodeDrawData : MaterialNodeDrawData
public class Vector4NodeDrawData : PropertyNodeDrawData
return new List<GraphElementData> { instance };
return new List<GraphElementData>(base.GetControlData()) { instance };
}
}
}

39
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/PropertyNodeDrawData.cs


using System;
using System.Collections.Generic;
using RMGUI.GraphView;
using UnityEditor.Graphing.Drawing;
using UnityEngine;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing
{
public class PropertyControlDrawData : ControlDrawData
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var tNode = node as UnityEngine.MaterialGraph.PropertyNode;
if (tNode == null)
return;
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState);
}
public override float GetHeight()
{
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public abstract class PropertyNodeDrawData : MaterialNodeDrawData
{
protected override IEnumerable<GraphElementData> GetControlData()
{
var instance = CreateInstance<PropertyControlDrawData>();
instance.Initialize(node);
return new List<GraphElementData> { instance };
}
}
}
正在加载...
取消
保存