浏览代码

Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017

/main
Eduardo Chaves 8 年前
当前提交
d48c5531
共有 2 个文件被更改,包括 20 次插入0 次删除
  1. 15
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
  2. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MaterialSlot.cs

15
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs


using UnityEditor.Graphing.Drawing;
using UnityEngine.MaterialGraph;
using System.Collections.Generic;
using System.Linq;
using RMGUI.GraphView;
namespace UnityEditor.MaterialGraph.Drawing
{

typeMapper[typeof(Matrix4Node)] = typeof(Matrix4NodePresenter);
typeMapper[typeof(MatrixCommonNode)] = typeof(MatrixCommonNodePresenter);
typeMapper[typeof(TransformNode)] = typeof(TransformNodePresenter);
}
public override List<NodeAnchorPresenter> GetCompatibleAnchors(NodeAnchorPresenter startAnchor, NodeAdapter nodeAdapter)
{
return allChildren.OfType<NodeAnchorPresenter>()
.Where(nap => nap.IsConnectable() &&
nap.orientation == startAnchor.orientation &&
nap.direction != startAnchor.direction &&
nodeAdapter.GetAdapter(nap.source, startAnchor.source) != null &&
(startAnchor is GraphAnchorPresenter && ((GraphAnchorPresenter)nap).slot is MaterialSlot &&
((MaterialSlot)((GraphAnchorPresenter)startAnchor).slot).IsCompatibleWithInputSlotType(((MaterialSlot)((GraphAnchorPresenter)nap).slot).valueType)))
.ToList();
}
}
}

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


visitor.AddShaderChunk(matOwner.precision + AbstractMaterialNode.ConvertConcreteSlotValueTypeToString(concreteValueType) + " " + matOwner.GetVariableNameForSlot(id) + ";", true);
}
public bool IsCompatibleWithInputSlotType(SlotValueType inputType)
{
return (inputType == SlotValueType.Dynamic || valueType == SlotValueType.Vector1 || valueType <= inputType);
}
public string GetDefaultValue(GenerationMode generationMode)
{
var matOwner = owner as AbstractMaterialNode;

正在加载...
取消
保存