diff options
| author | yum <yum.food.vr@gmail.com> | 2024-08-02 17:03:03 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-08-02 17:03:03 -0700 |
| commit | 674df2324fa891e23e982a95e46d8fda3378c0c3 (patch) | |
| tree | 6197a6497b98e181c5051ac172dbfc5d9e64f128 /Editor | |
| parent | fa44a3879806176d48d0c16a960a2c4fe6198dd6 (diff) | |
Implement overlay roughness
Diffstat (limited to 'Editor')
| -rw-r--r-- | Editor/tooner.cs | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs index 9efdd21..166241d 100644 --- a/Editor/tooner.cs +++ b/Editor/tooner.cs @@ -242,16 +242,28 @@ public class ToonerGUI : ShaderGUI { } SetKeyword($"_PBR_OVERLAY{i}_METALLIC_MAP", bct.textureValue); - bc = FindProperty($"_PBR_Overlay{i}_Roughness"); - bct = FindProperty($"_PBR_Overlay{i}_RoughnessTex"); - editor.TexturePropertySingleLine( - MakeLabel(bct, "Roughness (RGBA)"), - bct, - bc); - if (bct.textureValue) { - editor.TextureScaleOffsetProperty(bct); + bc = FindProperty($"_PBR_Overlay{i}_Roughness_Enable"); + enabled = bc.floatValue > 1E-6; + EditorGUI.BeginChangeCheck(); + enabled = EditorGUILayout.Toggle("Enable roughness", enabled); + EditorGUI.EndChangeCheck(); + bc.floatValue = enabled ? 1.0f : 0.0f; + SetKeyword($"_PBR_OVERLAY{i}_ROUGHNESS", enabled); + + if (enabled) { + EditorGUI.indentLevel += 1; + bc = FindProperty($"_PBR_Overlay{i}_Roughness"); + bct = FindProperty($"_PBR_Overlay{i}_RoughnessTex"); + editor.TexturePropertySingleLine( + MakeLabel(bct, "Roughness (RGBA)"), + bct, + bc); + if (bct.textureValue) { + editor.TextureScaleOffsetProperty(bct); + } + SetKeyword($"_PBR_OVERLAY{i}_ROUGHNESS_MAP", bct.textureValue); + EditorGUI.indentLevel -= 1; } - SetKeyword($"_PBR_OVERLAY{i}_ROUGHNESS_MAP", bct.textureValue); bct = FindProperty($"_PBR_Overlay{i}_Mask"); editor.TexturePropertySingleLine( |
