A game about forced loneliness, made by TACStudios
1using System;
2using UnityEditor.Graphing;
3using UnityEditor.ShaderGraph.Internal;
4using UnityEditor.UIElements;
5using UnityEngine;
6using UnityEngine.UIElements;
7
8namespace UnityEditor.ShaderGraph.Drawing.Slots
9{
10 class UVSlotControlView : VisualElement
11 {
12 UVMaterialSlot m_Slot;
13
14 public UVSlotControlView(UVMaterialSlot slot)
15 {
16 styleSheets.Add(Resources.Load<StyleSheet>("Styles/Controls/UVSlotControlView"));
17 m_Slot = slot;
18 var enumField = new EnumField(slot.channel);
19 enumField.RegisterValueChangedCallback(OnValueChanged);
20 Add(enumField);
21 }
22
23 void OnValueChanged(ChangeEvent<Enum> evt)
24 {
25 var channel = (UVChannel)evt.newValue;
26 if (channel != m_Slot.channel)
27 {
28 m_Slot.owner.owner.owner.RegisterCompleteObjectUndo("Change UV Channel");
29 m_Slot.channel = channel;
30 m_Slot.owner.Dirty(ModificationScope.Graph);
31 }
32 }
33 }
34}