您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
30 行
922 B
30 行
922 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;
|
|
Action changedToggle = () => { OnChangeToggle(); };
|
|
var toggleField = new UnityEngine.Experimental.UIElements.Toggle(changedToggle);
|
|
Add(toggleField);
|
|
}
|
|
|
|
void OnChangeToggle()
|
|
{
|
|
m_Slot.owner.owner.owner.RegisterCompleteObjectUndo("Toggle Change");
|
|
var value = m_Slot.value;
|
|
value = !value;
|
|
m_Slot.value = value;
|
|
m_Slot.owner.Dirty(ModificationScope.Node);
|
|
}
|
|
}
|
|
}
|