浏览代码

[Material Graph]delete edge + vector 1 node drawing.

/main
Tim Cooper 8 年前
当前提交
860a7a67
共有 11 个文件被更改,包括 70 次插入35 次删除
  1. 2
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/SerializableGraphView.cs
  2. 2
      MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/NodalView.cs
  3. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/ColorNodeDrawData.cs
  4. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/MaterialGraphDataSource.cs
  5. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/TextureNodeDrawData.cs
  6. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Vector1Node.cs
  7. 40
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector1NodeDrawData.cs
  8. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/Vector1NodeDrawData.cs.meta
  9. 9
      MaterialGraphProject/Assets/NewUI/Editor/Demo/GraphElements.meta
  10. 9
      MaterialGraphProject/Assets/NewUI/Editor/Graph.meta
  11. 9
      MaterialGraphProject/Assets/NewUI/Editor/GraphElements.meta

2
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/SerializableGraphView.cs


// Shortcut handler to delete elements
var dictionary = new Dictionary<Event, ShortcutDelegate>();
dictionary[Event.KeyboardEvent("delete")] = DeleteSelection;
contentViewContainer.AddManipulator(new ShortcutHandler(dictionary));
AddManipulator(new ShortcutHandler(dictionary));
AddManipulator(new ContentZoomer());
AddManipulator(new ContentDragger());

2
MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/NodalView.cs


// Shortcut handler to delete elements
var dictionary = new Dictionary<Event, ShortcutDelegate>();
dictionary[Event.KeyboardEvent("delete")] = DeleteSelection;
contentViewContainer.AddManipulator(new ShortcutHandler(dictionary));
AddManipulator(new ShortcutHandler(dictionary));
// Contextual menu to create new nodes
AddManipulator(new ContextualMenu((evt, customData) =>

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


namespace UnityEditor.MaterialGraph.Drawing
{
[Serializable]
class ContolDrawDrawData : ControlDrawData
class ColorContolDrawData : ControlDrawData
{
public override void OnGUIHandler()
{

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

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


{
AddTypeMapping(typeof(AbstractMaterialNode), typeof(MaterialNodeDrawData));
AddTypeMapping(typeof(ColorNode), typeof(ColorNodeDrawData));
AddTypeMapping(typeof(TextureNode), typeof(TextureNodeDrawData));
AddTypeMapping(typeof(TextureNode), typeof(TextureNodeDrawData));
AddTypeMapping(typeof(Vector1Node), typeof(Vector1NodeDrawData));
}
}
}

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


namespace UnityEditor.MaterialGraph.Drawing
{
class ContolDrawData : ControlDrawData
class TextureContolDrawData : ControlDrawData
{
private string[] m_TextureTypeNames;
private string[] textureTypeNames

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

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


public float value
{
get { return m_Value; }
set { m_Value = value; }
set
{
if (m_Value == value)
return;
m_Value = value;
if (onModified != null)
onModified (this);
}
}
public override void GeneratePropertyBlock(PropertyGenerator visitor, GenerationMode generationMode)

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


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

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


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

9
MaterialGraphProject/Assets/NewUI/Editor/Demo/GraphElements.meta


fileFormatVersion: 2
guid: 0cabc6d3555773b46ac210aaf8eefae6
folderAsset: yes
timeCreated: 1475167728
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
MaterialGraphProject/Assets/NewUI/Editor/Graph.meta


fileFormatVersion: 2
guid: b72798efa4aa8574ca0cbdfa63df0b7a
folderAsset: yes
timeCreated: 1475177616
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
MaterialGraphProject/Assets/NewUI/Editor/GraphElements.meta


fileFormatVersion: 2
guid: ebb7c69d632722145a1f9d838e7fe6ef
folderAsset: yes
timeCreated: 1475161005
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存