浏览代码

[mat graph] Add duplicate command.

/main
Tim Cooper 9 年前
当前提交
675ed679
共有 2 个文件被更改,包括 4 次插入21 次删除
  1. 8
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/CopySelected.cs
  2. 17
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawableNode.cs

8
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/CopySelected.cs


if (e.type == EventType.Used)
return false;
if (e.commandName != "Copy" && e.commandName != "Paste")
if (e.commandName != "Copy" && e.commandName != "Paste" && e.commandName != "Duplicate")
return false;
e.Use();

if (e.type == EventType.Used)
return false;
if (e.commandName != "Copy" && e.commandName != "Paste")
if (e.commandName != "Copy" && e.commandName != "Paste" && e.commandName != "Duplicate")
if (e.commandName == "Copy")
if (e.commandName == "Copy" || e.commandName == "Duplicate")
if (e.commandName == "Paste")
if (e.commandName == "Paste" || e.commandName == "Duplicate")
DoPaste(parent);
e.Use();

17
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawableNode.cs


public override void Render(Rect parentRect, Canvas2D canvas)
{
// some imgui elements eat key down events
// this is okay a lot of the time
// but for delete key it is not desired.
// if we have a delete key here
// just return. This allows us to get
// a validate / execute later on that can
// be handled by the graph.
var evt = Event.current;
if (evt.type == EventType.keyDown
&& (evt.keyCode == KeyCode.Backspace || evt.keyCode == KeyCode.Delete))
{
return;
}
if (evt.type == EventType.ValidateCommand || evt.type == EventType.ExecuteCommand)
return;
Color backgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.7f);
Color selectedColor = new Color(1.0f, 0.7f, 0.0f, 0.7f);
EditorGUI.DrawRect(new Rect(0, 0, scale.x, scale.y), m_Node.hasError ? Color.red : selected ? selectedColor : backgroundColor);

正在加载...
取消
保存