summaryrefslogtreecommitdiffstats
path: root/Editor
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-08-10 13:41:58 -0700
committeryum <yum.food.vr@gmail.com>2024-08-10 13:41:58 -0700
commit8948b000fb82cea4ce1d966a669daf68bfeb3166 (patch)
treec607bcd235dd2abf58a0eb2986d089027d5aff22 /Editor
parent9035231332e55f9995618f3b65ab8b05d9b52023 (diff)
Implement metallics in PBR overlay
Diffstat (limited to 'Editor')
-rw-r--r--Editor/tooner.cs28
1 files changed, 19 insertions, 9 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs
index 252dce9..01ab5a2 100644
--- a/Editor/tooner.cs
+++ b/Editor/tooner.cs
@@ -235,16 +235,26 @@ public class ToonerGUI : ShaderGUI {
}
SetKeyword($"_PBR_OVERLAY{i}_NORMAL_MAP", bct.textureValue);
- bc = FindProperty($"_PBR_Overlay{i}_Metallic");
- bct = FindProperty($"_PBR_Overlay{i}_MetallicTex");
- editor.TexturePropertySingleLine(
- MakeLabel(bct, "Metallic (RGBA)"),
- bct,
- bc);
- if (bct.textureValue) {
- editor.TextureScaleOffsetProperty(bct);
+ bc = FindProperty($"_PBR_Overlay{i}_Metallic_Enable");
+ enabled = bc.floatValue > 1E-6;
+ EditorGUI.BeginChangeCheck();
+ enabled = EditorGUILayout.Toggle("Enable metallic", enabled);
+ EditorGUI.EndChangeCheck();
+ bc.floatValue = enabled ? 1.0f : 0.0f;
+ SetKeyword($"_PBR_OVERLAY{i}_METALLIC", enabled);
+
+ if (enabled) {
+ bc = FindProperty($"_PBR_Overlay{i}_Metallic");
+ bct = FindProperty($"_PBR_Overlay{i}_MetallicTex");
+ editor.TexturePropertySingleLine(
+ MakeLabel(bct, "Metallic (RGBA)"),
+ bct,
+ bc);
+ if (bct.textureValue) {
+ editor.TextureScaleOffsetProperty(bct);
+ }
+ SetKeyword($"_PBR_OVERLAY{i}_METALLIC_MAP", bct.textureValue);
}
- SetKeyword($"_PBR_OVERLAY{i}_METALLIC_MAP", bct.textureValue);
bc = FindProperty($"_PBR_Overlay{i}_Roughness_Enable");
enabled = bc.floatValue > 1E-6;