Optimize ShadingColorSettingsScope toggle style;

This commit is contained in:
2025-01-31 16:17:29 +08:00
parent 5d23bd906b
commit f41c6c9b34

View File

@@ -55,18 +55,10 @@ namespace Misaki.HdrpToon.Editor
{
editor.TexturePropertySingleLine(Styles.baseMapText, Properties.baseColorMap, Properties.baseColor);
EditorGUI.indentLevel += 2;
EditorGUI.BeginChangeCheck();
bool applyToFirst = EditorGUILayout.Toggle(Styles.applyTo1stShadingMapText,
Properties.applyTo1stShadingMapEnable.floatValue != 0);
if (EditorGUI.EndChangeCheck())
{
editor.RegisterPropertyChangeUndo(Styles.applyTo1stShadingMapText.text);
Properties.applyTo1stShadingMapEnable.floatValue = applyToFirst ? 1 : 0;
}
editor.ShaderProperty(Properties.applyTo1stShadingMapEnable, Styles.applyTo1stShadingMapText.text);
EditorGUI.indentLevel -= 2;
if (applyToFirst)
if (Properties.applyTo1stShadingMapEnable.floatValue != 0)
{
EditorGUI.indentLevel += 2;
editor.ColorProperty(Properties.firstShadingColor, Styles.firstShadeColorText.text);
@@ -79,17 +71,10 @@ namespace Misaki.HdrpToon.Editor
}
EditorGUI.indentLevel += 2;
EditorGUI.BeginChangeCheck();
bool applyToSecond = EditorGUILayout.Toggle(Styles.applyTo2ndShadingMapText,
Properties.applyTo2ndShadingMapEnable.floatValue != 0);
if (EditorGUI.EndChangeCheck())
{
editor.RegisterPropertyChangeUndo(Styles.applyTo2ndShadingMapText.text);
Properties.applyTo2ndShadingMapEnable.floatValue = applyToSecond ? 1 : 0;
}
editor.ShaderProperty(Properties.applyTo2ndShadingMapEnable, Styles.applyTo2ndShadingMapText);
EditorGUI.indentLevel -= 2;
if (applyToSecond)
if (Properties.applyTo2ndShadingMapEnable.floatValue != 0)
{
EditorGUI.indentLevel += 2;
editor.ColorProperty(Properties.secondShadingColor, Styles.secondShadeColorText.text);