summaryrefslogtreecommitdiffstats
path: root/Editor
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-08-02 16:40:30 -0700
committeryum <yum.food.vr@gmail.com>2024-08-02 16:40:30 -0700
commitfa44a3879806176d48d0c16a960a2c4fe6198dd6 (patch)
treebc055e94014e4478bbf6d2c5430d32e50c849a9b /Editor
parenta627c1f915b86956b528af304fa85fee42dc11a0 (diff)
Add second clearcoat mask, and add invert ability
Also optimize by locking each behind a keyword.
Diffstat (limited to 'Editor')
-rw-r--r--Editor/tooner.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs
index f7bdc50..9efdd21 100644
--- a/Editor/tooner.cs
+++ b/Editor/tooner.cs
@@ -115,6 +115,33 @@ public class ToonerGUI : ShaderGUI {
editor.RangeProperty(bc, "Roughness");
bc = FindProperty("_Clearcoat_Mask");
editor.TexturePropertySingleLine(MakeLabel(bc, "Mask"), bc);
+ SetKeyword($"_CLEARCOAT_MASK", bc.textureValue);
+
+ if (bc.textureValue) {
+ EditorGUI.indentLevel += 1;
+ bc = FindProperty("_Clearcoat_Mask_Invert");
+ enabled = bc.floatValue > 1E-6;
+ EditorGUI.BeginChangeCheck();
+ enabled = EditorGUILayout.Toggle("Invert mask", enabled);
+ EditorGUI.EndChangeCheck();
+ bc.floatValue = enabled ? 1.0f : 0.0f;
+ EditorGUI.indentLevel -= 1;
+ }
+
+ bc = FindProperty("_Clearcoat_Mask2");
+ editor.TexturePropertySingleLine(MakeLabel(bc, "Mask 2"), bc);
+ SetKeyword($"_CLEARCOAT_MASK2", bc.textureValue);
+
+ if (bc.textureValue) {
+ EditorGUI.indentLevel += 1;
+ bc = FindProperty("_Clearcoat_Mask2_Invert");
+ enabled = bc.floatValue > 1E-6;
+ EditorGUI.BeginChangeCheck();
+ enabled = EditorGUILayout.Toggle("Invert mask", enabled);
+ EditorGUI.EndChangeCheck();
+ bc.floatValue = enabled ? 1.0f : 0.0f;
+ EditorGUI.indentLevel -= 1;
+ }
}
}