diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Decal/ShaderGraph/DecalMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Decal/ShaderGraph/DecalMasterNode.cs index f57e44a8859..eafd241cb0d 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Decal/ShaderGraph/DecalMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Decal/ShaderGraph/DecalMasterNode.cs @@ -17,7 +17,7 @@ namespace UnityEditor.Rendering.HighDefinition [Serializable] [Title("Master", "Decal (HDRP)")] [FormerName("UnityEditor.Experimental.Rendering.HDPipeline.DecalMasterNode")] - class DecalMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class DecalMasterNode : AbstractMaterialNode, IMasterNode, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent { public const string PositionSlotName = "Vertex Position"; public const string PositionSlotDisplayName = "Vertex Position"; diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeMasterNode.cs index a66bb31bfca..ef106ff5316 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeMasterNode.cs @@ -19,7 +19,7 @@ namespace UnityEditor.Rendering.HighDefinition { [Serializable] [Title("Master", "Eye (HDRP)(Preview)")] - class EyeMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class EyeMasterNode : AbstractMaterialNode, IMasterNode, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent { public const string PositionSlotName = "Vertex Position"; public const string PositionSlotDisplayName = "Vertex Position"; @@ -229,7 +229,7 @@ public ToggleData alphaTest Dirty(ModificationScope.Topological); } } - + [SerializeField] bool m_AlphaToMask = false; diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricMasterNode.cs index b4fefee9e2d..b531b62a105 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricMasterNode.cs @@ -21,7 +21,7 @@ namespace UnityEditor.Rendering.HighDefinition [Title("Master", "Fabric (HDRP)")] [FormerName("UnityEditor.Experimental.Rendering.HDPipeline.FabricMasterNode")] [FormerName("UnityEditor.ShaderGraph.FabricMasterNode")] - class FabricMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class FabricMasterNode : AbstractMaterialNode, IMasterNode, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent { public const string PositionSlotName = "Vertex Position"; public const string PositionSlotDisplayName = "Vertex Position"; @@ -234,7 +234,7 @@ public ToggleData alphaTest Dirty(ModificationScope.Topological); } } - + [SerializeField] bool m_AlphaToMask = false; diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairMasterNode.cs index 51104346d8e..bf5a688183a 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairMasterNode.cs @@ -20,7 +20,7 @@ namespace UnityEditor.Rendering.HighDefinition [Serializable] [Title("Master", "Hair (HDRP)")] [FormerName("UnityEditor.Experimental.Rendering.HDPipeline.HairMasterNode")] - class HairMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class HairMasterNode : AbstractMaterialNode, IMasterNode, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent { public const string PositionSlotName = "Vertex Position"; public const string PositionSlotDisplayName = "Vertex Position"; @@ -259,7 +259,7 @@ public ToggleData alphaTest Dirty(ModificationScope.Topological); } } - + [SerializeField] bool m_AlphaToMask = false; diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitMasterNode.cs index 101c135ae3d..06f8e6953e1 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitMasterNode.cs @@ -21,7 +21,7 @@ namespace UnityEditor.Rendering.HighDefinition [Title("Master", "Lit (HDRP)")] [FormerName("UnityEditor.Experimental.Rendering.HDPipeline.HDLitMasterNode")] [FormerName("UnityEditor.ShaderGraph.HDLitMasterNode")] - class HDLitMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class HDLitMasterNode : AbstractMaterialNode, IMasterNode, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent { public const string AlbedoSlotName = "Albedo"; public const string AlbedoDisplaySlotName = "BaseColor"; diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitMasterNode.cs index 3e744888761..fbc644eb20f 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitMasterNode.cs @@ -25,7 +25,7 @@ namespace UnityEditor.Rendering.HighDefinition [Title("Master", "StackLit (HDRP)")] [FormerName("UnityEditor.Experimental.Rendering.HDPipeline.StackLitMasterNode")] [FormerName("UnityEditor.ShaderGraph.StackLitMasterNode")] - class StackLitMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class StackLitMasterNode : AbstractMaterialNode, IMasterNode, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent { public const string PositionSlotName = "Vertex Position"; public const string PositionSlotDisplayName = "Vertex Position"; @@ -360,7 +360,7 @@ public ToggleData alphaTest Dirty(ModificationScope.Topological); } } - + [SerializeField] bool m_AlphaToMask = false; diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitMasterNode.cs index 0da9ede6d50..3a24bb919e7 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitMasterNode.cs @@ -22,7 +22,7 @@ namespace UnityEditor.Rendering.HighDefinition [Serializable] [FormerName("UnityEditor.Experimental.Rendering.HDPipeline.HDUnlitMasterNode")] [Title("Master", "Unlit (HDRP)")] - class HDUnlitMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class HDUnlitMasterNode : AbstractMaterialNode, IMasterNode, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent { public const string ColorSlotName = "Color"; public const string AlphaSlotName = "Alpha"; diff --git a/com.unity.render-pipelines.universal/Editor/ShaderGraph/MasterNodes/SpriteLitMasterNode.cs b/com.unity.render-pipelines.universal/Editor/ShaderGraph/MasterNodes/SpriteLitMasterNode.cs index a0a67d8f645..86663e0ce83 100644 --- a/com.unity.render-pipelines.universal/Editor/ShaderGraph/MasterNodes/SpriteLitMasterNode.cs +++ b/com.unity.render-pipelines.universal/Editor/ShaderGraph/MasterNodes/SpriteLitMasterNode.cs @@ -12,7 +12,7 @@ namespace UnityEditor.Experimental.Rendering.Universal [Serializable] [Title("Master", "Sprite Lit (Experimental)")] [FormerName("UnityEditor.Experimental.Rendering.LWRP.SpriteLitMasterNode")] - class SpriteLitMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class SpriteLitMasterNode : AbstractMaterialNode, IMasterNode, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent { public const string PositionName = "Vertex Position"; public const string NormalName = "Vertex Normal"; diff --git a/com.unity.render-pipelines.universal/Editor/ShaderGraph/MasterNodes/SpriteUnlitMasterNode.cs b/com.unity.render-pipelines.universal/Editor/ShaderGraph/MasterNodes/SpriteUnlitMasterNode.cs index 1a6fac62a61..eb2106a0a26 100644 --- a/com.unity.render-pipelines.universal/Editor/ShaderGraph/MasterNodes/SpriteUnlitMasterNode.cs +++ b/com.unity.render-pipelines.universal/Editor/ShaderGraph/MasterNodes/SpriteUnlitMasterNode.cs @@ -12,7 +12,7 @@ namespace UnityEditor.Experimental.Rendering.Universal [Serializable] [Title("Master", "Sprite Unlit (Experimental)")] [FormerName("UnityEditor.Experimental.Rendering.LWRP.SpriteUnlitMasterNode")] - class SpriteUnlitMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class SpriteUnlitMasterNode : AbstractMaterialNode, IMasterNode, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent { public const string PositionName = "Vertex Position"; public const string NormalName = "Vertex Normal"; diff --git a/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs b/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs index d78942565de..1466748c660 100644 --- a/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs +++ b/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs @@ -733,7 +733,7 @@ public List BuildPropertyDisplayNameList(AbstractShaderProperty ignorePr } } } - + return result; } @@ -901,7 +901,7 @@ void ReplacePropertyNodeWithConcreteNodeNoValidate(PropertyNode propertyNode, bo var node = property.ToConcreteNode() as AbstractMaterialNode; if (node == null) // Some nodes have no concrete form - { + { if (deleteNodeIfNoConcreteFormExists) RemoveNodeNoValidate(propertyNode); return; diff --git a/com.unity.shadergraph/Editor/Data/Interfaces/IHasSettings.cs b/com.unity.shadergraph/Editor/Data/Interfaces/IHasSettings.cs deleted file mode 100644 index 257bbb69a12..00000000000 --- a/com.unity.shadergraph/Editor/Data/Interfaces/IHasSettings.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEngine.UIElements; - -namespace UnityEditor.Graphing -{ - interface IHasSettings - { - VisualElement CreateSettingsElement(); - } -} diff --git a/com.unity.shadergraph/Editor/Data/Interfaces/IHasSettings.cs.meta b/com.unity.shadergraph/Editor/Data/Interfaces/IHasSettings.cs.meta deleted file mode 100644 index aca0cf41f9d..00000000000 --- a/com.unity.shadergraph/Editor/Data/Interfaces/IHasSettings.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: aaccc11846e23c84093c0d6780172063 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/com.unity.shadergraph/Editor/Data/Interfaces/IInspectable.cs b/com.unity.shadergraph/Editor/Data/Interfaces/IInspectable.cs index 950b179fd1a..8b2ae83427f 100644 --- a/com.unity.shadergraph/Editor/Data/Interfaces/IInspectable.cs +++ b/com.unity.shadergraph/Editor/Data/Interfaces/IInspectable.cs @@ -1,25 +1,23 @@ -using System; -using System.Reflection; -using Data.Interfaces; -using Drawing.Inspector; -using UnityEngine.UIElements; - -namespace UnityEditor.ShaderGraph.Drawing -{ - interface IInspectable - { - // Implementors can override this in order to display their desired string when selected and viewed through the inscetor - string inspectorTitle { get; } - - // This function should return the underlying data object that user wishes to expose to the Inspector - object GetObjectToInspect(); - - // This function should return the property information of whatever object has been marked up for metadata gathering by the inspector - // This might be the same as the object returned by GetObjectToInspect(), it might not - PropertyInfo[] GetPropertyInfo(); - - // Used to provide any data needed by the property drawer from the inspectable - // The inspectorUpdateDelegate is used to trigger an inspector update - void SupplyDataToPropertyDrawer(IPropertyDrawer propertyDrawer, Action inspectorUpdateDelegate); - } -} +using System; +using System.Reflection; +using Data.Interfaces; +using Drawing.Inspector; +using UnityEngine.UIElements; + +namespace UnityEditor.ShaderGraph.Drawing +{ + interface IInspectable + { + // Implementors can override this in order to display their desired string when selected and viewed through the inspector + string inspectorTitle { get; } + + // This function should return the underlying data object that user wishes to expose to the Inspector + // For simple data properties like Integers/Floats this is the object that contains the properties + // For complex types like GraphData this is the GraphData itself, its up to the PropertyDrawer to define what it needs + object GetObjectToInspect(); + + // Used to provide any data needed by the property drawer from the inspectable + // The inspectorUpdateDelegate is used to trigger an inspector update + void SupplyDataToPropertyDrawer(IPropertyDrawer propertyDrawer, Action inspectorUpdateDelegate); + } +} diff --git a/com.unity.shadergraph/Editor/Data/MasterNodes/PBRMasterNode.cs b/com.unity.shadergraph/Editor/Data/MasterNodes/PBRMasterNode.cs index 75b3922123a..d63d094f429 100644 --- a/com.unity.shadergraph/Editor/Data/MasterNodes/PBRMasterNode.cs +++ b/com.unity.shadergraph/Editor/Data/MasterNodes/PBRMasterNode.cs @@ -12,7 +12,7 @@ namespace UnityEditor.ShaderGraph { [Serializable] [Title("Master", "PBR")] - class PBRMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class PBRMasterNode : AbstractMaterialNode, IMasterNode, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent { public const string AlbedoSlotName = "Albedo"; public const string NormalSlotName = "Normal"; diff --git a/com.unity.shadergraph/Editor/Data/MasterNodes/UnlitMasterNode.cs b/com.unity.shadergraph/Editor/Data/MasterNodes/UnlitMasterNode.cs index edda64926ee..eb5e9f1a54d 100644 --- a/com.unity.shadergraph/Editor/Data/MasterNodes/UnlitMasterNode.cs +++ b/com.unity.shadergraph/Editor/Data/MasterNodes/UnlitMasterNode.cs @@ -12,7 +12,7 @@ namespace UnityEditor.ShaderGraph { [Serializable] [Title("Master", "Unlit")] - class UnlitMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class UnlitMasterNode : AbstractMaterialNode, IMasterNode, ICanChangeShaderGUI, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent { public const string ColorSlotName = "Color"; public const string AlphaSlotName = "Alpha"; diff --git a/com.unity.shadergraph/Editor/Data/MasterNodes/VfxMasterNode.cs b/com.unity.shadergraph/Editor/Data/MasterNodes/VfxMasterNode.cs index 47d6aeca484..d3d6135c6df 100644 --- a/com.unity.shadergraph/Editor/Data/MasterNodes/VfxMasterNode.cs +++ b/com.unity.shadergraph/Editor/Data/MasterNodes/VfxMasterNode.cs @@ -14,7 +14,7 @@ namespace UnityEditor.ShaderGraph { [Serializable] [Title("Master", "Visual Effect")] - sealed class VfxMasterNode : AbstractMaterialNode, IMasterNode, IHasSettings, IMayRequirePosition + sealed class VfxMasterNode : AbstractMaterialNode, IMasterNode, IMayRequirePosition { const string BaseColorSlotName = "Base Color"; const string MetallicSlotName = "Metallic"; diff --git a/com.unity.shadergraph/Editor/Data/Nodes/AbstractMaterialNode.cs b/com.unity.shadergraph/Editor/Data/Nodes/AbstractMaterialNode.cs index 92d56ecce98..94b7433e796 100644 --- a/com.unity.shadergraph/Editor/Data/Nodes/AbstractMaterialNode.cs +++ b/com.unity.shadergraph/Editor/Data/Nodes/AbstractMaterialNode.cs @@ -92,7 +92,6 @@ public virtual bool canSetPrecision private ConcretePrecision m_ConcretePrecision = ConcretePrecision.Float; - [Inspectable("Precision", ConcretePrecision.Float)] public ConcretePrecision concretePrecision { get => m_ConcretePrecision; diff --git a/com.unity.shadergraph/Editor/Data/Nodes/Input/Texture/SampleVirtualTextureNode.cs b/com.unity.shadergraph/Editor/Data/Nodes/Input/Texture/SampleVirtualTextureNode.cs index 8c5512d9b9e..14af83afa88 100644 --- a/com.unity.shadergraph/Editor/Data/Nodes/Input/Texture/SampleVirtualTextureNode.cs +++ b/com.unity.shadergraph/Editor/Data/Nodes/Input/Texture/SampleVirtualTextureNode.cs @@ -14,7 +14,7 @@ namespace UnityEditor.ShaderGraph { [Title("Input", "Texture", SampleVirtualTextureNode.DefaultNodeTitle)] - class SampleVirtualTextureNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IMayRequireMeshUV, IMayRequireTime, IMayRequireScreenPosition, IHasSettings + class SampleVirtualTextureNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IMayRequireMeshUV, IMayRequireTime, IMayRequireScreenPosition { public const string DefaultNodeTitle = "Sample Virtual Texture"; @@ -144,6 +144,8 @@ public bool noFeedback } } + public TextureType[] textureTypes => m_TextureTypes; + [SerializeField] protected TextureType[] m_TextureTypes = { TextureType.Default, TextureType.Default, TextureType.Default, TextureType.Default }; @@ -164,143 +166,6 @@ public NormalMapSpace normalMapSpace } } - /* - The panel behind the cogwheel node settings - */ - class SampleVirtualTextureNodeSettingsView : VisualElement - { - SampleVirtualTextureNode m_Node; - public SampleVirtualTextureNodeSettingsView(SampleVirtualTextureNode node) - { - m_Node = node; - - PropertySheet ps = new PropertySheet(); - - ps.Add(new PropertyRow(new Label("Lod Mode")), (row) => - { - row.Add(new UIElements.EnumField(m_Node.lodCalculation), (field) => - { - field.value = m_Node.lodCalculation; - field.RegisterValueChangedCallback(evt => - { - if (m_Node.lodCalculation == (LodCalculation)evt.newValue) - return; - - m_Node.owner.owner.RegisterCompleteObjectUndo("Lod Mode Change"); - m_Node.lodCalculation = (LodCalculation)evt.newValue; - }); - }); - }); - - ps.Add(new PropertyRow(new Label("Quality")), (row) => - { - row.Add(new UIElements.EnumField(m_Node.sampleQuality), (field) => - { - field.value = m_Node.sampleQuality; - field.RegisterValueChangedCallback(evt => - { - if (m_Node.sampleQuality == (QualityMode)evt.newValue) - return; - - m_Node.owner.owner.RegisterCompleteObjectUndo("Quality Change"); - m_Node.sampleQuality = (QualityMode)evt.newValue; - }); - }); - }); - - ps.Add(new PropertyRow(new Label("No Feedback")), (row) => - { - row.Add(new UnityEngine.UIElements.Toggle(), (field) => - { - field.value = m_Node.noFeedback; - field.RegisterValueChangedCallback(evt => - { - if (m_Node.noFeedback == evt.newValue) - return; - - m_Node.owner.owner.RegisterCompleteObjectUndo("Feedback Settings Change"); - m_Node.noFeedback = evt.newValue; - }); - }); - }); - - var vtProperty = m_Node.GetSlotProperty(VirtualTextureInputId) as VirtualTextureShaderProperty; - if (vtProperty == null) - { - ps.Add(new HelpBoxRow(MessageType.Warning), (row) => row.Add(new Label("Please connect a VirtualTexture property to configure texture sampling type."))); - } - else - { - int numLayers = vtProperty.value.layers.Count; - - for (int i = 0; i < numLayers; i++) - { - int currentIndex = i; // to make lambda by-ref capturing happy - ps.Add(new PropertyRow(new Label("Layer " + (i + 1) + " Type")), (row) => - { - row.Add(new UIElements.EnumField(m_Node.m_TextureTypes[i]), (field) => - { - field.value = m_Node.m_TextureTypes[i]; - field.RegisterValueChangedCallback(evt => - { - if (m_Node.m_TextureTypes[currentIndex] == (TextureType)evt.newValue) - return; - - m_Node.owner.owner.RegisterCompleteObjectUndo("Texture Type Change"); - m_Node.m_TextureTypes[currentIndex] = (TextureType)evt.newValue; - m_Node.Dirty(ModificationScope.Graph); - }); - }); - }); - } - } - - ps.Add(new PropertyRow(new Label("Normal Space")), (row) => - { - row.Add(new UIElements.EnumField(m_Node.normalMapSpace), (field) => - { - field.value = m_Node.normalMapSpace; - field.RegisterValueChangedCallback(evt => - { - if (m_Node.normalMapSpace == (NormalMapSpace)evt.newValue) - return; - - m_Node.owner.owner.RegisterCompleteObjectUndo("Normal Map space Change"); - m_Node.normalMapSpace = (NormalMapSpace)evt.newValue; - }); - }); - }); - - // display warning if the current master node doesn't support virtual texturing - if (!m_Node.owner.isSubGraph) - { - bool supportedByMasterNode = m_Node.owner.GetNodes().FirstOrDefault()?.supportsVirtualTexturing ?? false; - if (!supportedByMasterNode) - ps.Add(new HelpBoxRow(MessageType.Warning), (row) => row.Add(new Label("The current master node does not support Virtual Texturing, this node will do regular 2D sampling."))); - } - - // display warning if the current render pipeline doesn't support virtual texturing - IVirtualTexturingEnabledRenderPipeline vtRp = GraphicsSettings.currentRenderPipeline as IVirtualTexturingEnabledRenderPipeline; - if (vtRp == null) - ps.Add(new HelpBoxRow(MessageType.Warning), (row) => row.Add(new Label("The current render pipeline does not support Virtual Texturing, this node will do regular 2D sampling."))); - else if (vtRp.virtualTexturingEnabled == false) - ps.Add(new HelpBoxRow(MessageType.Warning), (row) => row.Add(new Label("The current render pipeline has disabled Virtual Texturing, this node will do regular 2D sampling."))); - else - { -#if !ENABLE_VIRTUALTEXTURES - ps.Add(new HelpBoxRow(MessageType.Warning), (row) => row.Add(new Label("Virtual Texturing is disabled globally (possibly by the render pipeline settings), this node will do regular 2D sampling."))); -#endif - } - - Add(ps); - } - } - - public VisualElement CreateSettingsElement() - { - return new SampleVirtualTextureNodeSettingsView(this); - } - public SampleVirtualTextureNode() : this(false, false) { } diff --git a/com.unity.shadergraph/Editor/Data/Nodes/Utility/CustomFunctionNode.cs b/com.unity.shadergraph/Editor/Data/Nodes/Utility/CustomFunctionNode.cs index da018bf7446..c027479c2a3 100644 --- a/com.unity.shadergraph/Editor/Data/Nodes/Utility/CustomFunctionNode.cs +++ b/com.unity.shadergraph/Editor/Data/Nodes/Utility/CustomFunctionNode.cs @@ -12,7 +12,7 @@ namespace UnityEditor.ShaderGraph { [HasDependencies(typeof(MinimalCustomFunctionNode))] [Title("Utility", "Custom Function")] - class CustomFunctionNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IHasSettings + class CustomFunctionNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction { [Serializable] public class MinimalCustomFunctionNode : IHasDependencies @@ -317,15 +317,6 @@ public void Reload(HashSet changedFileDependencies) } } - public VisualElement CreateSettingsElement() - { - PropertySheet ps = new PropertySheet(); - ps.Add(new ReorderableSlotListView(this, SlotType.Input)); - ps.Add(new ReorderableSlotListView(this, SlotType.Output)); - ps.Add(new HlslFunctionView(this)); - return ps; - } - public static string UpgradeFunctionSource(string functionSource) { // Handle upgrade from legacy asset path version diff --git a/com.unity.shadergraph/Editor/Data/SubGraph/SubGraphOutputNode.cs b/com.unity.shadergraph/Editor/Data/SubGraph/SubGraphOutputNode.cs index b01bbed1d98..3ecaf0fa98b 100644 --- a/com.unity.shadergraph/Editor/Data/SubGraph/SubGraphOutputNode.cs +++ b/com.unity.shadergraph/Editor/Data/SubGraph/SubGraphOutputNode.cs @@ -11,7 +11,7 @@ namespace UnityEditor.ShaderGraph { - class SubGraphOutputNode : AbstractMaterialNode, IHasSettings + class SubGraphOutputNode : AbstractMaterialNode { static string s_MissingOutputSlot = "A Sub Graph must have at least one output slot"; static List s_ValidSlotTypes = new List() @@ -114,13 +114,6 @@ public int AddSlot(ConcreteSlotValueType concreteValueType) return index; } - public VisualElement CreateSettingsElement() - { - PropertySheet ps = new PropertySheet(); - ps.Add(new ReorderableSlotListView(this, SlotType.Input)); - return ps; - } - public override bool canDeleteNode => false; public override bool canCopyNode => false; diff --git a/com.unity.shadergraph/Editor/Drawing/Blackboard/BlackboardFieldView.cs b/com.unity.shadergraph/Editor/Drawing/Blackboard/BlackboardFieldView.cs index c65cfc9147e..c52eff99d63 100644 --- a/com.unity.shadergraph/Editor/Drawing/Blackboard/BlackboardFieldView.cs +++ b/com.unity.shadergraph/Editor/Drawing/Blackboard/BlackboardFieldView.cs @@ -66,7 +66,7 @@ private void DirtyNodes(ModificationScope modificationScope = ModificationScope. } // When the properties are changed, this delegate is used to trigger an update in the view that represents those properties - private Action m_propertyViewUpdateTrigger; + private Action m_inspectorUpdateTrigger; private ShaderInputPropertyDrawer.ChangeReferenceNameCallback m_resetReferenceNameTrigger; public string inspectorTitle @@ -137,14 +137,11 @@ public void SupplyDataToPropertyDrawer(IPropertyDrawer propertyDrawer, Action in RegisterPropertyChangeUndo, MarkNodesAsDirty); - m_propertyViewUpdateTrigger = inspectorUpdateDelegate; + m_inspectorUpdateTrigger = inspectorUpdateDelegate; m_resetReferenceNameTrigger = shaderInputPropertyDrawer._resetReferenceNameCallback; - } - } - public PropertyInfo[] GetPropertyInfo() - { - return GetType().GetProperties(); + this.RegisterCallback(evt => m_inspectorUpdateTrigger()); + } } void ChangeExposedField(bool newValue) @@ -170,7 +167,7 @@ void MarkNodesAsDirty(bool triggerPropertyViewUpdate = false, ModificationScope { DirtyNodes(modificationScope); if(triggerPropertyViewUpdate) - m_propertyViewUpdateTrigger(); + m_inspectorUpdateTrigger(); } void ChangePropertyValue(object newValue) diff --git a/com.unity.shadergraph/Editor/Drawing/Blackboard/BlackboardProvider.cs b/com.unity.shadergraph/Editor/Drawing/Blackboard/BlackboardProvider.cs index ac8fcaba640..819566b47a1 100644 --- a/com.unity.shadergraph/Editor/Drawing/Blackboard/BlackboardProvider.cs +++ b/com.unity.shadergraph/Editor/Drawing/Blackboard/BlackboardProvider.cs @@ -19,6 +19,7 @@ class BlackboardProvider public const int k_PropertySectionIndex = 0; public const int k_KeywordSectionIndex = 1; + const string k_styleName = "Blackboard"; public Blackboard blackboard { get; private set; } Label m_PathLabel; @@ -49,6 +50,9 @@ public BlackboardProvider(GraphData graph) moveItemRequested = MoveItemRequested }; + var styleSheet = Resources.Load($"Styles/{k_styleName}"); + blackboard.styleSheets.Add(styleSheet); + m_PathLabel = blackboard.hierarchy.ElementAt(0).Q