From b5209ff99a66dd2cd018eb7adcca94ce872d6686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Leli=C3=A8vre?= Date: Wed, 8 Jul 2020 18:50:30 +0200 Subject: [PATCH] Fix double sided unlit mode in the UI --- .../ShaderGraph/SurfaceOptionPropertyBlock.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs index bde3e02903f..6070ce58960 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs @@ -15,14 +15,14 @@ namespace UnityEditor.Rendering.HighDefinition.ShaderGraph class SurfaceOptionPropertyBlock : SubTargetPropertyBlock { [Flags] - // TODO: remove ? public enum Features { - None = 0, - All = ~0, + None = 0, + ShowDoubleSidedNormal = 1 << 0, + All = ~0, - Unlit = All, - Lit = All, + Unlit = All ^ ShowDoubleSidedNormal, // hide double sided normal for unlit + Lit = All, } class Styles @@ -85,7 +85,10 @@ protected override void CreatePropertyGUI() AddProperty(alphaToMaskText, () => builtinData.alphaToMask, (newValue) => builtinData.alphaToMask = newValue); // Misc - AddProperty(Styles.doubleSidedModeText, () => systemData.doubleSidedMode, (newValue) => systemData.doubleSidedMode = newValue); + if ((enabledFeatures & Features.ShowDoubleSidedNormal) != 0) + AddProperty(Styles.doubleSidedModeText, () => systemData.doubleSidedMode, (newValue) => systemData.doubleSidedMode = newValue); + else + AddProperty(doubleSidedEnableText, () => systemData.doubleSidedMode != DoubleSidedMode.Disabled, (newValue) => systemData.doubleSidedMode = newValue ? DoubleSidedMode.Enabled : DoubleSidedMode.Disabled); if (lightingData != null) AddProperty(Styles.fragmentNormalSpace, () => lightingData.normalDropOffSpace, (newValue) => lightingData.normalDropOffSpace = newValue);