您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

30 行
893 B

using System;
using UnityEditor.Graphing;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
namespace UnityEditor.ShaderGraph.Drawing.Slots
{
public class BooleanSlotControlView : VisualElement
{
BooleanMaterialSlot m_Slot;
public BooleanSlotControlView(BooleanMaterialSlot slot)
{
AddStyleSheetPath("Styles/Controls/BooleanSlotControlView");
m_Slot = slot;
var toggleField = new Toggle();
toggleField.OnToggleChanged(OnChangeToggle);
Add(toggleField);
}
void OnChangeToggle(ChangeEvent<bool> evt)
{
m_Slot.owner.owner.owner.RegisterCompleteObjectUndo("Toggle Change");
var value = m_Slot.value;
value = evt.newValue;
m_Slot.value = value;
m_Slot.owner.Dirty(ModificationScope.Node);
}
}
}