diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/AbstractMaterialNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/AbstractMaterialNode.cs index 3fcb143beae..afb4a1ec6cf 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/AbstractMaterialNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/AbstractMaterialNode.cs @@ -80,6 +80,8 @@ public string name set { m_Name = value; } } + public virtual string displayName => name; + public string[] synonyms; protected virtual string documentationPage => name; diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/BlockNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/BlockNode.cs index de869fd7531..9898068ed2f 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/BlockNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/BlockNode.cs @@ -28,6 +28,23 @@ class BlockNode : AbstractMaterialNode [NonSerialized] BlockFieldDescriptor m_Descriptor; + public override string displayName + { + get + { + string displayName = ""; + if (m_Descriptor != null) + { + displayName = m_Descriptor.shaderStage.ToString(); + if (!string.IsNullOrEmpty(displayName)) + displayName += " "; + displayName += m_Descriptor.displayName; + } + + return displayName; + } + } + public override bool canCutNode => false; public override bool canCopyNode => false; @@ -78,7 +95,6 @@ public void Init(BlockFieldDescriptor fieldDescriptor) ? $"{fieldDescriptor.tag}.{fieldDescriptor.name}" : $"{BlockFields.VertexDescription.name}.{k_CustomBlockDefaultName}"; - // TODO: This exposes the MaterialSlot API // TODO: This needs to be removed but is currently required by HDRP for DiffusionProfileInputMaterialSlot if (m_Descriptor is CustomSlotBlockFieldDescriptor customSlotDescriptor) diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/AbstractMaterialNodePropertyDrawer.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/AbstractMaterialNodePropertyDrawer.cs index fd57efc6d23..aa9625c81cf 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/AbstractMaterialNodePropertyDrawer.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/AbstractMaterialNodePropertyDrawer.cs @@ -38,7 +38,7 @@ internal virtual void AddCustomNodeProperties(VisualElement parentElement, Abstr VisualElement CreateGUI(AbstractMaterialNode node, InspectableAttribute attribute, out VisualElement propertyVisualElement) { VisualElement nodeSettings = new VisualElement(); - var nameLabel = PropertyDrawerUtils.CreateLabel($"{node.name} Node", 0, FontStyle.Bold); + var nameLabel = PropertyDrawerUtils.CreateLabel($"{node.displayName} Node", 0, FontStyle.Bold); nodeSettings.Add(nameLabel); if (node.sgVersion < node.latestVersion) {