浏览代码

Add field dragger to vector inputs

/main
Peter Bay Bastian 7 年前
当前提交
cd4618e1
共有 3 个文件被更改,包括 12 次插入2 次删除
  1. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/VectorControl.cs
  2. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/Slots/MultiFloatSlotControlView.cs
  3. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/VectorControl.cs


void AddField(int index, string subLabel)
{
Add(new Label(subLabel));
var label = new Label(subLabel);
Add(label);
var dragger = new FieldMouseDragger<double>(doubleField);
dragger.SetDragZone(label);
doubleField.RegisterCallback<MouseDownEvent>(Repaint);
doubleField.RegisterCallback<MouseMoveEvent>(Repaint);
doubleField.OnValueChanged(evt =>

SetValue(value);
m_UndoGroup = -1;
Dirty(ChangeType.Repaint);
});
doubleField.RegisterCallback<InputEvent>(evt =>
{

var value = GetValue();
value[index] = newValue;
SetValue(value);
Dirty(ChangeType.Repaint);
});
doubleField.RegisterCallback<KeyDownEvent>(evt =>
{

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/Slots/MultiFloatSlotControlView.cs


void AddField(Vector4 initialValue, int index, string subLabel)
{
Add(new Label(subLabel));
var label = new Label(subLabel);
Add(label);
var dragger = new FieldMouseDragger<double>(doubleField);
dragger.SetDragZone(label);
doubleField.OnValueChanged(evt =>
{
var value = m_Get();

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss


MultiFloatSlotControlView > Label {
margin-left: 0;
margin-right: 0;
cursor: slide-arrow;
}
MultiFloatSlotControlView > DoubleField {

MultiFloatControlView > Label {
margin-left: 0;
margin-right: 0;
cursor: slide-arrow;
}
MultiFloatControlView > DoubleField {

正在加载...
取消
保存