Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions com.unity.shadergraph/Editor/Drawing/Views/IdentifierField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
using UnityEngine;
using UnityEngine.UIElements;

// This is to ensure backwards compatibility since TextValueField, TextValueFieldTraits and DeltaSpeed were moved from UnityEditor.UIElements to UnityEngine.UIElements.
using UnityEditor.UIElements;

namespace UnityEditor.ShaderGraph.Drawing
{
/*
Field that allows entering a valid HLSL identifier.
(variable name, function name, ...) this means
no spaces, no funny characters, never starts with a number, ...
*/
public class IdentifierField : UIElements.TextValueField<string>
public class IdentifierField : TextValueField<string>
{
IdentifierInput tsInput => (IdentifierInput)textInputBase;

public new class UxmlFactory : UxmlFactory<IdentifierField, UxmlTraits> { }
public new class UxmlTraits : UIElements.TextValueFieldTraits<string, UxmlStringAttributeDescription> { }
public new class UxmlTraits : TextValueFieldTraits<string, UxmlStringAttributeDescription> { }

protected override string ValueToString(string v)
{
Expand Down Expand Up @@ -52,7 +55,7 @@ public IdentifierField() : this((string)null) { }
tsInput.AddToClassList(inputUssClassName);
}

public override void ApplyInputDeviceDelta(Vector3 delta, UIElements.DeltaSpeed speed, string startValue)
public override void ApplyInputDeviceDelta(Vector3 delta, DeltaSpeed speed, string startValue)
{
tsInput.ApplyInputDeviceDelta(delta, speed, startValue);
}
Expand All @@ -71,7 +74,7 @@ protected override string allowedCharacters
get { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; }
}

public override void ApplyInputDeviceDelta(Vector3 delta, UIElements.DeltaSpeed speed, string startValue)
public override void ApplyInputDeviceDelta(Vector3 delta, DeltaSpeed speed, string startValue)
{
}

Expand Down