Updated OutlineScope;
Reorgnize shader code;
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Misaki.ShaderGUI;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -76,6 +77,10 @@ namespace Misaki.HdrpToon.Editor
|
||||
"-1 gives 0% for the Rim Light effect, 0 gives 100% for the Rim Light and Mask effect, 1 gives 100% for the Rim Light and 0% for the Mask effect.");
|
||||
}
|
||||
|
||||
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.Rimlight;
|
||||
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Rim Light Settings");
|
||||
protected override bool ShowSection => editor.GetMaterials().All(mat => mat.HasFeature(SurfaceFeature.RimLight));
|
||||
|
||||
public override void LoadMaterialProperties()
|
||||
{
|
||||
Properties.rimLightEnabled = FindProperty("_RimLight");
|
||||
@@ -97,46 +102,32 @@ namespace Misaki.HdrpToon.Editor
|
||||
|
||||
protected override void DrawContent()
|
||||
{
|
||||
editor.ShaderProperty(Properties.rimLightEnabled, Styles.rimLightEnabledText);
|
||||
EditorGUI.BeginDisabledGroup(Properties.rimLightEnabled.floatValue == 0);
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
editor.ShaderProperty(Properties.rimLightColor, Styles.rimLightColorText);
|
||||
editor.ShaderProperty(Properties.rimLightStrength, Styles.rimLightStrengthText);
|
||||
editor.ShaderProperty(Properties.rimLightLevel, Styles.rimLightLevelText);
|
||||
editor.ShaderProperty(Properties.colorBlendingMode, Styles.colorBlendingModeText);
|
||||
editor.ShaderProperty(Properties.adjustRimLightArea, Styles.adjustRimLightAreaText);
|
||||
editor.ShaderProperty(Properties.rimLightFeatherOff, Styles.rimLightFeatherOffText);
|
||||
editor.ShaderProperty(Properties.lightDirection, Styles.lightDirectionText);
|
||||
EditorGUI.BeginDisabledGroup(Properties.lightDirection.floatValue == 0);
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
editor.ShaderProperty(Properties.lightDirectionRimLightLevel,
|
||||
Styles.lightDirectionRimLightLevelText);
|
||||
editor.ShaderProperty(Properties.invertedDirectionRimLight,
|
||||
Styles.invertedDirectionRimLightText);
|
||||
EditorGUI.BeginDisabledGroup(Properties.invertedDirectionRimLight.floatValue == 0);
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
editor.ShaderProperty(Properties.invertedRimLightColor, Styles.invertedRimLightColorText);
|
||||
editor.ShaderProperty(Properties.inversedRimLightLevel, Styles.inversedRimLightLevelText);
|
||||
editor.ShaderProperty(Properties.invertedRimLightFeatherOff,
|
||||
Styles.invertedRimLightFeatherOffText);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUI.indentLevel--;
|
||||
editor.TexturePropertySingleLine(Styles.rimLightMaskMapText, Properties.rimLightMaskMap);
|
||||
editor.ShaderProperty(Properties.rimLightMaskLevel, Styles.rimLightMaskLevelText);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
editor.ShaderProperty(Properties.rimLightColor, Styles.rimLightColorText);
|
||||
editor.ShaderProperty(Properties.rimLightStrength, Styles.rimLightStrengthText);
|
||||
editor.ShaderProperty(Properties.rimLightLevel, Styles.rimLightLevelText);
|
||||
editor.ShaderProperty(Properties.colorBlendingMode, Styles.colorBlendingModeText);
|
||||
editor.ShaderProperty(Properties.adjustRimLightArea, Styles.adjustRimLightAreaText);
|
||||
editor.ShaderProperty(Properties.rimLightFeatherOff, Styles.rimLightFeatherOffText);
|
||||
editor.ShaderProperty(Properties.lightDirection, Styles.lightDirectionText);
|
||||
|
||||
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.Rimlight;
|
||||
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Rim Light Settings");
|
||||
protected override bool ShowSection => SurfaceOptionsScope.HasFeature(SurfaceFeatureFlags.RimLight);
|
||||
using (var lightDisabledGroup = new EditorGUI.DisabledScope(!Properties.lightDirection.GetBooleanValue()))
|
||||
{
|
||||
using var lightIndentLevelScope = new EditorGUI.IndentLevelScope();
|
||||
|
||||
editor.ShaderProperty(Properties.lightDirectionRimLightLevel, Styles.lightDirectionRimLightLevelText);
|
||||
editor.ShaderProperty(Properties.invertedDirectionRimLight, Styles.invertedDirectionRimLightText);
|
||||
|
||||
using var invertedDirectionDisabledGroup = new EditorGUI.DisabledScope(!Properties.invertedDirectionRimLight.GetBooleanValue());
|
||||
using var invertedDirectionIndentLevelScope = new EditorGUI.IndentLevelScope();
|
||||
|
||||
editor.ShaderProperty(Properties.invertedRimLightColor, Styles.invertedRimLightColorText);
|
||||
editor.ShaderProperty(Properties.inversedRimLightLevel, Styles.inversedRimLightLevelText);
|
||||
editor.ShaderProperty(Properties.invertedRimLightFeatherOff, Styles.invertedRimLightFeatherOffText);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
editor.TexturePropertySingleLine(Styles.rimLightMaskMapText, Properties.rimLightMaskMap);
|
||||
editor.ShaderProperty(Properties.rimLightMaskLevel, Styles.rimLightMaskLevelText);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user