Skip to content

Commit 3d5fe9b

Browse files
Rename also all enum which a Vector1 inside to get correct string conversion as float
1 parent 6b8e617 commit 3d5fe9b

31 files changed

+66
-66
lines changed

com.unity.shadergraph/Editor/Data/Graphs/DynamicValueMaterialSlot.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public override void GetPreviewProperties(List<PreviewProperty> properties, stri
7979
{
8080
var propType = concreteValueType.ToPropertyType();
8181
var pp = new PreviewProperty(propType) { name = name };
82-
if (propType == PropertyType.Vector1)
82+
if (propType == PropertyType.Float)
8383
pp.floatValue = value.m00;
8484
else
8585
pp.vector4Value = new Vector4(value.m00, value.m01, value.m02, value.m03);
@@ -118,7 +118,7 @@ public override void AddDefaultProperty(PropertyCollector properties, Generation
118118
case ConcreteSlotValueType.Vector2:
119119
property = new Vector2ShaderProperty();
120120
break;
121-
case ConcreteSlotValueType.Vector1:
121+
case ConcreteSlotValueType.Float:
122122
property = new Vector1ShaderProperty();
123123
break;
124124
case ConcreteSlotValueType.Matrix4:

com.unity.shadergraph/Editor/Data/Graphs/DynamicVectorMaterialSlot.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public override void GetPreviewProperties(List<PreviewProperty> properties, stri
7272
{
7373
var propType = concreteValueType.ToPropertyType();
7474
var pp = new PreviewProperty(propType) { name = name };
75-
if (propType == PropertyType.Vector1)
75+
if (propType == PropertyType.Float)
7676
pp.floatValue = value.x;
7777
else
7878
pp.vector4Value = new Vector4(value.x, value.y, value.z, value.w);
@@ -111,7 +111,7 @@ public override void AddDefaultProperty(PropertyCollector properties, Generation
111111
case ConcreteSlotValueType.Vector2:
112112
property = new Vector2ShaderProperty();
113113
break;
114-
case ConcreteSlotValueType.Vector1:
114+
case ConcreteSlotValueType.Float:
115115
property = new Vector1ShaderProperty();
116116
break;
117117
default:

com.unity.shadergraph/Editor/Data/Graphs/MaterialSlot.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static string ConcreteSlotValueTypeAsString(ConcreteSlotValueType type)
7070
{
7171
switch (type)
7272
{
73-
case ConcreteSlotValueType.Vector1:
73+
case ConcreteSlotValueType.Float:
7474
return "(1)";
7575
case ConcreteSlotValueType.Vector2:
7676
return "(2)";
@@ -162,7 +162,7 @@ public static MaterialSlot CreateMaterialSlot(SlotValueType type, int slotId, st
162162
return new Vector3MaterialSlot(slotId, displayName, shaderOutputName, slotType, defaultValue, shaderStageCapability, hidden: hidden);
163163
case SlotValueType.Vector2:
164164
return new Vector2MaterialSlot(slotId, displayName, shaderOutputName, slotType, defaultValue, shaderStageCapability, hidden: hidden);
165-
case SlotValueType.Vector1:
165+
case SlotValueType.Float:
166166
return new Vector1MaterialSlot(slotId, displayName, shaderOutputName, slotType, defaultValue.x, shaderStageCapability, hidden: hidden);
167167
case SlotValueType.Dynamic:
168168
return new DynamicValueMaterialSlot(slotId, displayName, shaderOutputName, slotType, new Matrix4x4(defaultValue, Vector4.zero, Vector4.zero, Vector4.zero), shaderStageCapability, hidden);

com.unity.shadergraph/Editor/Data/Graphs/PreviewProperty.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ public float floatValue
148148
{
149149
get
150150
{
151-
if (propType != PropertyType.Vector1)
152-
throw new ArgumentException(string.Format(k_GetErrorMessage, PropertyType.Vector1, propType));
151+
if (propType != PropertyType.Float)
152+
throw new ArgumentException(string.Format(k_GetErrorMessage, PropertyType.Float, propType));
153153
return m_StructData.floatValue;
154154
}
155155
set
156156
{
157-
if (propType != PropertyType.Vector1)
158-
throw new ArgumentException(string.Format(k_SetErrorMessage, PropertyType.Vector1, propType));
157+
if (propType != PropertyType.Float)
158+
throw new ArgumentException(string.Format(k_SetErrorMessage, PropertyType.Float, propType));
159159
m_StructData.floatValue = value;
160160
}
161161
}
@@ -228,7 +228,7 @@ public void SetValueOnMaterialPropertyBlock(MaterialPropertyBlock mat)
228228
mat.SetColor(name, m_StructData.colorValue);
229229
else if (propType == PropertyType.Vector2 || propType == PropertyType.Vector3 || propType == PropertyType.Vector4)
230230
mat.SetVector(name, m_StructData.vector4Value);
231-
else if (propType == PropertyType.Vector1)
231+
else if (propType == PropertyType.Float)
232232
mat.SetFloat(name, m_StructData.floatValue);
233233
else if (propType == PropertyType.Boolean)
234234
mat.SetFloat(name, m_StructData.booleanValue ? 1 : 0);

com.unity.shadergraph/Editor/Data/Graphs/Vector1MaterialSlot.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ public override void AddDefaultProperty(PropertyCollector properties, Generation
9090
properties.AddShaderProperty(property);
9191
}
9292

93-
public override SlotValueType valueType { get { return SlotValueType.Vector1; } }
94-
public override ConcreteSlotValueType concreteValueType { get { return ConcreteSlotValueType.Vector1; } }
93+
public override SlotValueType valueType { get { return SlotValueType.Float; } }
94+
public override ConcreteSlotValueType concreteValueType { get { return ConcreteSlotValueType.Float; } }
9595

9696
public override void GetPreviewProperties(List<PreviewProperty> properties, string name)
9797
{
98-
var pp = new PreviewProperty(PropertyType.Vector1)
98+
var pp = new PreviewProperty(PropertyType.Float)
9999
{
100100
name = name,
101101
floatValue = value,

com.unity.shadergraph/Editor/Data/Graphs/Vector1ShaderProperty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal Vector1ShaderProperty()
1717
displayName = "Float";
1818
}
1919

20-
public override PropertyType propertyType => PropertyType.Vector1;
20+
public override PropertyType propertyType => PropertyType.Float;
2121

2222
internal override bool isBatchable => true;
2323
internal override bool isExposable => true;

com.unity.shadergraph/Editor/Data/Implementation/NodeUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ public static string GetSlotDimension(ConcreteSlotValueType slotValue)
526526
{
527527
switch (slotValue)
528528
{
529-
case ConcreteSlotValueType.Vector1:
529+
case ConcreteSlotValueType.Float:
530530
return String.Empty;
531531
case ConcreteSlotValueType.Vector2:
532532
return "2";

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,20 +454,20 @@ public static ConcreteSlotValueType ConvertDynamicVectorInputTypeToConcrete(IEnu
454454
switch (inputTypesDistinct.Count)
455455
{
456456
case 0:
457-
return ConcreteSlotValueType.Vector1;
457+
return ConcreteSlotValueType.Float;
458458
case 1:
459459
if(SlotValueHelper.AreCompatible(SlotValueType.DynamicVector, inputTypesDistinct.First()))
460460
return inputTypesDistinct.First();
461461
break;
462462
default:
463463
// find the 'minumum' channel width excluding 1 as it can promote
464-
inputTypesDistinct.RemoveAll(x => x == ConcreteSlotValueType.Vector1);
464+
inputTypesDistinct.RemoveAll(x => x == ConcreteSlotValueType.Float);
465465
var ordered = inputTypesDistinct.OrderByDescending(x => x);
466466
if (ordered.Any())
467467
return ordered.FirstOrDefault();
468468
break;
469469
}
470-
return ConcreteSlotValueType.Vector1;
470+
return ConcreteSlotValueType.Float;
471471
}
472472

473473
public static ConcreteSlotValueType ConvertDynamicMatrixInputTypeToConcrete(IEnumerable<ConcreteSlotValueType> inputTypes)

com.unity.shadergraph/Editor/Data/Nodes/Channel/SwizzleNode.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo
131131
var outputName = GetVariableNameForSlot(OutputSlotId);
132132
var inputValue = GetSlotValue(InputSlotId, generationMode);
133133
var inputValueType = FindInputSlot<MaterialSlot>(InputSlotId).concreteValueType;
134-
if (inputValueType == ConcreteSlotValueType.Vector1)
134+
if (inputValueType == ConcreteSlotValueType.Float)
135135
sb.AppendLine(string.Format("{0} {1} = {2};", outputSlotType, outputName, inputValue));
136136
else if (generationMode == GenerationMode.ForReals)
137137
sb.AppendLine("{0} {1} = {2}.{3}{4}{5}{6};",
@@ -163,7 +163,7 @@ public override void CollectPreviewMaterialProperties(List<PreviewProperty> prop
163163
base.CollectPreviewMaterialProperties(properties);
164164
// Encode swizzle values into an integer
165165
var value = ((int)redChannel) | ((int)greenChannel << 2) | ((int)blueChannel << 4) | ((int)alphaChannel << 6);
166-
properties.Add(new PreviewProperty(PropertyType.Vector1)
166+
properties.Add(new PreviewProperty(PropertyType.Float)
167167
{
168168
name = GetVariableNameForNode(),
169169
floatValue = value

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private static SlotValueType ConvertTypeToSlotValueType(ParameterInfo p)
153153
}
154154
if (t == typeof(Vector1))
155155
{
156-
return SlotValueType.Vector1;
156+
return SlotValueType.Float;
157157
}
158158
if (t == typeof(Vector2))
159159
{

0 commit comments

Comments
 (0)