Skip to content

Commit cc6ab94

Browse files
Missed renaming of existing inline Vector1 for rename Vector1 to Float (#2159)
* Missed renaming of existing inline Vector1 for rename Vector1 to Float PR * Rename Vector1 to Float in EnumPopup for custom function
1 parent a1e4585 commit cc6ab94

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

com.unity.shadergraph/Editor/Data/Nodes/Input/Basic/Vector1Node.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ public AbstractShaderProperty AsShaderProperty()
4646
return new Vector1ShaderProperty { value = slot.value };
4747
}
4848

49+
public override void OnAfterDeserialize()
50+
{
51+
base.OnAfterDeserialize();
52+
53+
name = "Float";
54+
}
55+
4956
int IPropertyFromNode.outputSlotId { get { return OutputSlotId; } }
5057
}
5158
}

com.unity.shadergraph/Editor/Data/Nodes/SlotValue.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,26 @@ enum ConcreteSlotValueType
4646
VirtualTexture
4747
}
4848

49+
// This enum must match ConcreteSlotValueType enum and is used to give friendly name in the enum popup used for custom function
50+
enum ConcreteSlotValueTypePopupName
51+
{
52+
SamplerState = ConcreteSlotValueType.SamplerState,
53+
Matrix4 = ConcreteSlotValueType.Matrix4,
54+
Matrix3 = ConcreteSlotValueType.Matrix3,
55+
Matrix2 = ConcreteSlotValueType.Matrix2,
56+
Texture2D = ConcreteSlotValueType.Texture2D,
57+
Texture2DArray = ConcreteSlotValueType.Texture2DArray,
58+
Texture3D = ConcreteSlotValueType.Texture3D,
59+
Cubemap = ConcreteSlotValueType.Cubemap,
60+
Gradient = ConcreteSlotValueType.Gradient,
61+
Vector4 = ConcreteSlotValueType.Vector4,
62+
Vector3 = ConcreteSlotValueType.Vector3,
63+
Vector2 = ConcreteSlotValueType.Vector2,
64+
Float = ConcreteSlotValueType.Vector1, // This is currently the only renaming we need - rename Vector1 to Float
65+
Boolean = ConcreteSlotValueType.Boolean,
66+
VirtualTexture = ConcreteSlotValueType.VirtualTexture
67+
}
68+
4969
static class SlotValueHelper
5070
{
5171
public static bool AllowedAsSubgraphOutput(this ConcreteSlotValueType type)

com.unity.shadergraph/Editor/Drawing/Views/ReorderableSlotListView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private void AddCallbacks()
107107
var concreteValueType = (ConcreteSlotValueType) EditorGUI.EnumPopup(
108108
new Rect(rect.x + rect.width / 2, rect.y, rect.width - rect.width / 2, EditorGUIUtility.singleLineHeight),
109109
GUIContent.none,
110-
oldSlot.concreteValueType,
110+
(ConcreteSlotValueTypePopupName)oldSlot.concreteValueType, // Force ConcreteSlotValueTypePopupName enum which match ConcreteSlotValueType to provide a friendly named in Popup
111111
e => (AllowedTypeCallback == null) ? true : AllowedTypeCallback((ConcreteSlotValueType) e));
112112

113113
if(EditorGUI.EndChangeCheck())

0 commit comments

Comments
 (0)