diff --git a/com.unity.shadergraph/CHANGELOG.md b/com.unity.shadergraph/CHANGELOG.md index 9a58f400c49..c8833e49ef3 100644 --- a/com.unity.shadergraph/CHANGELOG.md +++ b/com.unity.shadergraph/CHANGELOG.md @@ -99,6 +99,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed a bug where adding a " to a property display name would cause shader compilation errors and show all nodes as broken - Fixed a bug where the `Position` node would change coordinate spaces from `World` to `Absolute World` when shaders recompile. [1184617](https://issuetracker.unity3d.com/product/unity/issues/guid/1184617/) - Fixed a bug where instanced shaders wouldn't compile on PS4. +- Fixed a bug where switching a Color Nodes' Mode between Default and HDR would cause the Color to be altered incorrectly. - Fixed a bug where nodes dealing with matricies would sometimes display a preview, sometimes not. - Optimized loading a large Shader Graph. [1209047](https://issuetracker.unity3d.com/issues/shader-graph-unresponsive-editor-when-using-large-graphs) - Fixed NaN issue in triplanar SG node when blend goes to 0. diff --git a/com.unity.shadergraph/Editor/Data/Nodes/Input/Basic/ColorNode.cs b/com.unity.shadergraph/Editor/Data/Nodes/Input/Basic/ColorNode.cs index fcf5813f204..7072d8b70f3 100644 --- a/com.unity.shadergraph/Editor/Data/Nodes/Input/Basic/ColorNode.cs +++ b/com.unity.shadergraph/Editor/Data/Nodes/Input/Basic/ColorNode.cs @@ -54,22 +54,17 @@ public Color color if ((value.color == m_Color.color) && (value.mode == m_Color.mode)) return; - if(value.mode != m_Color.mode) + if ((value.mode != m_Color.mode) && (value.mode == ColorMode.Default)) { - if(value.mode == ColorMode.HDR) - value.color = value.color.gamma; - else - { - float r = Mathf.Clamp(value.color.r, 0, 1); - float g = Mathf.Clamp(value.color.g, 0, 1); - float b = Mathf.Clamp(value.color.b, 0, 1); - float a = Mathf.Clamp(value.color.a, 0, 1); - value.color = new UnityEngine.Color(r, g, b, a); - } + float r = Mathf.Clamp(value.color.r, 0, 1); + float g = Mathf.Clamp(value.color.g, 0, 1); + float b = Mathf.Clamp(value.color.b, 0, 1); + float a = Mathf.Clamp(value.color.a, 0, 1); + value.color = new UnityEngine.Color(r, g, b, a); } m_Color = value; - Dirty(ModificationScope.Node); + Dirty(ModificationScope.Graph); } } diff --git a/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs b/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs index ba11a30abfe..e21d7161785 100644 --- a/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs +++ b/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs @@ -405,7 +405,7 @@ void HandleColorProperty(PropertySheet propertySheet, ColorShaderProperty colorP { this._preChangeValueCallback("Change Color Mode"); colorProperty.colorMode = (ColorMode)newValue; - this._postChangeValueCallback(true); + this._postChangeValueCallback(true, ModificationScope.Graph); }, colorProperty.colorMode, "Mode",