浏览代码

Added UI for Vector{2,3,4}

/main
Peter Bay Bastian 8 年前
当前提交
85173f43
共有 11 个文件被更改,包括 176 次插入2 次删除
  1. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/MaterialGraphDataSource.cs
  2. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector1NodeDrawData.cs
  3. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Vector2Node.cs
  4. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Vector3Node.cs
  5. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Vector4Node.cs
  6. 40
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector2NodeDrawData.cs
  7. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector2NodeDrawData.cs.meta
  8. 40
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector3NodeDrawData.cs
  9. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector3NodeDrawData.cs.meta
  10. 40
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector4NodeDrawData.cs
  11. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector4NodeDrawData.cs.meta

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/MaterialGraphDataSource.cs


AddTypeMapping(typeof(ColorNode), typeof(ColorNodeDrawData));
AddTypeMapping(typeof(TextureNode), typeof(TextureNodeDrawData));
AddTypeMapping(typeof(Vector1Node), typeof(Vector1NodeDrawData));
AddTypeMapping(typeof(Vector2Node), typeof(Vector2NodeDrawData));
AddTypeMapping(typeof(Vector3Node), typeof(Vector3NodeDrawData));
AddTypeMapping(typeof(Vector4Node), typeof(Vector4NodeDrawData));
}
}
}

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


namespace UnityEditor.MaterialGraph.Drawing
{
class Vector1ContolDrawData : ControlDrawData
class Vector1ControlDrawData : ControlDrawData
{
public override void OnGUIHandler()
{

{
protected override IEnumerable<GraphElementData> GetControlData()
{
var instance = CreateInstance<Vector1ContolDrawData>();
var instance = CreateInstance<Vector1ControlDrawData>();
instance.Initialize(node);
return new List<GraphElementData> { instance };
}

5
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Vector2Node.cs


UpdateNodeAfterDeserialization();
}
public override bool hasPreview
{
get { return true; }
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector2, Vector4.zero));

5
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Vector3Node.cs


UpdateNodeAfterDeserialization();
}
public override bool hasPreview
{
get { return true; }
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector3, Vector4.zero));

5
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Vector4Node.cs


UpdateNodeAfterDeserialization();
}
public override bool hasPreview
{
get { return true; }
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero));

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


using System;
using System.Collections.Generic;
using RMGUI.GraphView;
using UnityEditor.Graphing.Drawing;
using UnityEngine;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing
{
class Vector2ControlDrawData : ControlDrawData
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var tNode = node as UnityEngine.MaterialGraph.Vector2Node;
if (tNode == null)
return;
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState);
tNode.value = EditorGUILayout.Vector2Field("", tNode.value);
}
public override float GetHeight()
{
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class Vector2NodeDrawData : MaterialNodeDrawData
{
protected override IEnumerable<GraphElementData> GetControlData()
{
var instance = CreateInstance<Vector2ControlDrawData>();
instance.Initialize(node);
return new List<GraphElementData> { instance };
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector2NodeDrawData.cs.meta


fileFormatVersion: 2
guid: 6018b93ef62914859a707349fee5d50e
timeCreated: 1476871291
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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


using System;
using System.Collections.Generic;
using RMGUI.GraphView;
using UnityEditor.Graphing.Drawing;
using UnityEngine;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing
{
class Vector3ControlDrawData : ControlDrawData
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var tNode = node as UnityEngine.MaterialGraph.Vector3Node;
if (tNode == null)
return;
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState);
tNode.value = EditorGUILayout.Vector3Field("", tNode.value);
}
public override float GetHeight()
{
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class Vector3NodeDrawData : MaterialNodeDrawData
{
protected override IEnumerable<GraphElementData> GetControlData()
{
var instance = CreateInstance<Vector3ControlDrawData>();
instance.Initialize(node);
return new List<GraphElementData> { instance };
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector3NodeDrawData.cs.meta


fileFormatVersion: 2
guid: e8f2d0e687af5483fa604cf5b2843284
timeCreated: 1476877473
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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


using System;
using System.Collections.Generic;
using RMGUI.GraphView;
using UnityEditor.Graphing.Drawing;
using UnityEngine;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing
{
class Vector4ControlDrawData : ControlDrawData
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var tNode = node as UnityEngine.MaterialGraph.Vector4Node;
if (tNode == null)
return;
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState);
tNode.value = EditorGUILayout.Vector4Field("", tNode.value);
}
public override float GetHeight()
{
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class Vector4NodeDrawData : MaterialNodeDrawData
{
protected override IEnumerable<GraphElementData> GetControlData()
{
var instance = CreateInstance<Vector4ControlDrawData>();
instance.Initialize(node);
return new List<GraphElementData> { instance };
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector4NodeDrawData.cs.meta


fileFormatVersion: 2
guid: c63e4f4ffa1734ea8a3dd6ee0099314e
timeCreated: 1476877473
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存