您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
32 行
946 B
32 行
946 B
using System;
|
|
using UnityEditor.Graphing;
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace UnityEditor.ShaderGraph.Drawing.Slots
|
|
{
|
|
class BooleanSlotControlView : VisualElement
|
|
{
|
|
BooleanMaterialSlot m_Slot;
|
|
|
|
public BooleanSlotControlView(BooleanMaterialSlot slot)
|
|
{
|
|
styleSheets.Add(Resources.Load<StyleSheet>("Styles/Controls/BooleanSlotControlView"));
|
|
m_Slot = slot;
|
|
var toggleField = new Toggle() { value = m_Slot.value };
|
|
toggleField.OnToggleChanged(OnChangeToggle);
|
|
Add(toggleField);
|
|
}
|
|
|
|
void OnChangeToggle(ChangeEvent<bool> evt)
|
|
{
|
|
if (evt.newValue != m_Slot.value)
|
|
{
|
|
m_Slot.owner.owner.owner.RegisterCompleteObjectUndo("Toggle Change");
|
|
m_Slot.value = evt.newValue;
|
|
m_Slot.owner.Dirty(ModificationScope.Node);
|
|
}
|
|
}
|
|
}
|
|
}
|