diff options
| author | yum <yum.food.vr@gmail.com> | 2024-08-28 14:29:23 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-08-28 14:29:23 -0700 |
| commit | 699da7b756aec0d361c4a6d84fa41e8183ef1d12 (patch) | |
| tree | 39cdae51faea62904ac0a330074a3deb66484af0 /Editor/tooner.cs | |
| parent | 6eaf7c8ec43d4d6ce5d2c67e9ef032f182fbfa25 (diff) | |
Add second HSV slot
Helps with animation.
Diffstat (limited to 'Editor/tooner.cs')
| -rw-r--r-- | Editor/tooner.cs | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs index 8d4221a..f35090d 100644 --- a/Editor/tooner.cs +++ b/Editor/tooner.cs @@ -789,43 +789,45 @@ public class ToonerGUI : ShaderGUI { void DoHSV() { MaterialProperty bc; - bc = FindProperty("_HSV_Enabled"); - bool enabled = bc.floatValue > 1E-6; - EditorGUI.BeginChangeCheck(); - enabled = EditorGUILayout.Toggle("Enable", enabled); - EditorGUI.EndChangeCheck(); - bc.floatValue = enabled ? 1.0f : 0.0f; - - SetKeyword("_HSV", enabled); - - if (enabled) { - bc = FindProperty("_HSV_Mask"); - editor.TexturePropertySingleLine( - MakeLabel(bc, "Mask"), - bc); - - if (bc.textureValue) { - bc = FindProperty("_HSV_Mask_Invert"); - enabled = bc.floatValue > 1E-6; - EditorGUI.BeginChangeCheck(); - enabled = EditorGUILayout.Toggle("Invert", enabled); - EditorGUI.EndChangeCheck(); - bc.floatValue = enabled ? 1.0f : 0.0f; - } - - bc = FindProperty("_HSV_Hue_Shift"); - editor.RangeProperty( - bc, - "Hue shift"); - bc = FindProperty("_HSV_Sat_Shift"); - editor.RangeProperty( - bc, - "Saturation shift"); - bc = FindProperty("_HSV_Val_Shift"); - editor.RangeProperty( - bc, - "Value shift"); - } + for (int i = 0; i < 2; i++) { + bc = FindProperty($"_HSV{i}_Enabled"); + bool enabled = bc.floatValue > 1E-6; + EditorGUI.BeginChangeCheck(); + enabled = EditorGUILayout.Toggle($"Enable slot {i}", enabled); + EditorGUI.EndChangeCheck(); + bc.floatValue = enabled ? 1.0f : 0.0f; + + SetKeyword($"_HSV{i}", enabled); + + if (enabled) { + bc = FindProperty($"_HSV{i}_Mask"); + editor.TexturePropertySingleLine( + MakeLabel(bc, "Mask"), + bc); + + if (bc.textureValue) { + bc = FindProperty($"_HSV{i}_Mask_Invert"); + enabled = bc.floatValue > 1E-6; + EditorGUI.BeginChangeCheck(); + enabled = EditorGUILayout.Toggle("Invert", enabled); + EditorGUI.EndChangeCheck(); + bc.floatValue = enabled ? 1.0f : 0.0f; + } + + bc = FindProperty($"_HSV{i}_Hue_Shift"); + editor.RangeProperty( + bc, + "Hue shift"); + bc = FindProperty($"_HSV{i}_Sat_Shift"); + editor.RangeProperty( + bc, + "Saturation shift"); + bc = FindProperty($"_HSV{i}_Val_Shift"); + editor.RangeProperty( + bc, + "Value shift"); + } + } } void DoClones() { |
