Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public AbstractShaderProperty AsShaderProperty()
return new Vector1ShaderProperty { value = slot.value };
}

public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();

name = "Float";
}

int IPropertyFromNode.outputSlotId { get { return OutputSlotId; } }
}
}
20 changes: 20 additions & 0 deletions com.unity.shadergraph/Editor/Data/Nodes/SlotValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@ enum ConcreteSlotValueType
VirtualTexture
}

// This enum must match ConcreteSlotValueType enum and is used to give friendly name in the enum popup used for custom function
enum ConcreteSlotValueTypePopupName
{
SamplerState = ConcreteSlotValueType.SamplerState,
Matrix4 = ConcreteSlotValueType.Matrix4,
Matrix3 = ConcreteSlotValueType.Matrix3,
Matrix2 = ConcreteSlotValueType.Matrix2,
Texture2D = ConcreteSlotValueType.Texture2D,
Texture2DArray = ConcreteSlotValueType.Texture2DArray,
Texture3D = ConcreteSlotValueType.Texture3D,
Cubemap = ConcreteSlotValueType.Cubemap,
Gradient = ConcreteSlotValueType.Gradient,
Vector4 = ConcreteSlotValueType.Vector4,
Vector3 = ConcreteSlotValueType.Vector3,
Vector2 = ConcreteSlotValueType.Vector2,
Float = ConcreteSlotValueType.Vector1, // This is currently the only renaming we need - rename Vector1 to Float
Boolean = ConcreteSlotValueType.Boolean,
VirtualTexture = ConcreteSlotValueType.VirtualTexture
}

static class SlotValueHelper
{
public static bool AllowedAsSubgraphOutput(this ConcreteSlotValueType type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private void AddCallbacks()
var concreteValueType = (ConcreteSlotValueType) EditorGUI.EnumPopup(
new Rect(rect.x + rect.width / 2, rect.y, rect.width - rect.width / 2, EditorGUIUtility.singleLineHeight),
GUIContent.none,
oldSlot.concreteValueType,
(ConcreteSlotValueTypePopupName)oldSlot.concreteValueType, // Force ConcreteSlotValueTypePopupName enum which match ConcreteSlotValueType to provide a friendly named in Popup
e => (AllowedTypeCallback == null) ? true : AllowedTypeCallback((ConcreteSlotValueType) e));

if(EditorGUI.EndChangeCheck())
Expand Down