Update ShadingColorScope;
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using System.Linq;
|
||||
using Misaki.ShaderGUI;
|
||||
using Misaki.ShaderGUI;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Rendering;
|
||||
using UnityEngine;
|
||||
@@ -75,6 +75,18 @@ namespace Misaki.HdrpToon.Editor
|
||||
"Feather and step value of Toon Specular");
|
||||
}
|
||||
|
||||
private enum PBRMode
|
||||
{
|
||||
Off,
|
||||
Standard,
|
||||
Anisotropy,
|
||||
KKHair,
|
||||
Toon
|
||||
}
|
||||
|
||||
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.PBR;
|
||||
protected override GUIContent Header => new("PBR Settings");
|
||||
|
||||
public override void LoadMaterialProperties()
|
||||
{
|
||||
Properties.PbrMode = FindProperty("_PBR_Mode");
|
||||
@@ -104,21 +116,21 @@ namespace Misaki.HdrpToon.Editor
|
||||
editor.ShaderProperty(Properties.PbrMode, Styles.PbrModeText);
|
||||
EditorGUILayout.Space();
|
||||
editor.TexturePropertySingleLine(Styles.NormalMapText, Properties.NormalMap, Properties.NormalMapScale);
|
||||
var materials = GetMaterials().ToList();
|
||||
foreach (Material material in materials)
|
||||
var materials = editor.GetMaterials().ToList();
|
||||
foreach (var material in materials)
|
||||
{
|
||||
material.SetKeyword(new LocalKeyword(material.shader, "_NORMAL_MAP"),
|
||||
Properties.NormalMap.textureValue != null);
|
||||
}
|
||||
|
||||
PBRMode pbrMode = (PBRMode)Properties.PbrMode.floatValue;
|
||||
var pbrMode = (PBRMode)Properties.PbrMode.floatValue;
|
||||
if (pbrMode != PBRMode.Off)
|
||||
{
|
||||
editor.TexturePropertySingleLine(Styles.MaskMapText, Properties.MaskMap);
|
||||
|
||||
if (Properties.MaskMap.textureValue == null)
|
||||
{
|
||||
foreach (Material material in materials)
|
||||
foreach (var material in materials)
|
||||
{
|
||||
material.DisableKeyword(new LocalKeyword(material.shader, "_MASK_MAP"));
|
||||
}
|
||||
@@ -129,7 +141,7 @@ namespace Misaki.HdrpToon.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Material material in materials)
|
||||
foreach (var material in materials)
|
||||
{
|
||||
material.EnableKeyword(new LocalKeyword(material.shader, "_MASK_MAP"));
|
||||
}
|
||||
@@ -143,7 +155,7 @@ namespace Misaki.HdrpToon.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Material material in materials)
|
||||
foreach (var material in materials)
|
||||
{
|
||||
material.DisableKeyword(new LocalKeyword(material.shader, "_MASK_MAP"));
|
||||
material.DisableKeyword(new LocalKeyword(material.shader, "_ANISOTROPY_MAP"));
|
||||
@@ -168,14 +180,14 @@ namespace Misaki.HdrpToon.Editor
|
||||
editor.TextureScaleOffsetProperty(Properties.AnisotropyMap);
|
||||
if (Properties.AnisotropyMap.textureValue == null)
|
||||
{
|
||||
foreach (Material material in materials)
|
||||
foreach (var material in materials)
|
||||
{
|
||||
material.DisableKeyword(new LocalKeyword(material.shader, "_ANISOTROPY_MAP"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Material material in materials)
|
||||
foreach (var material in materials)
|
||||
{
|
||||
material.EnableKeyword(new LocalKeyword(material.shader, "_ANISOTROPY_MAP"));
|
||||
}
|
||||
@@ -189,14 +201,14 @@ namespace Misaki.HdrpToon.Editor
|
||||
Properties.SpecularColor);
|
||||
if (Properties.SpecularColorMap.textureValue == null)
|
||||
{
|
||||
foreach (Material material in materials)
|
||||
foreach (var material in materials)
|
||||
{
|
||||
material.DisableKeyword(new LocalKeyword(material.shader, "_SPECULAR_COLOR_MAP"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Material material in materials)
|
||||
foreach (var material in materials)
|
||||
{
|
||||
material.EnableKeyword(new LocalKeyword(material.shader, "_SPECULAR_COLOR_MAP"));
|
||||
}
|
||||
@@ -208,17 +220,5 @@ namespace Misaki.HdrpToon.Editor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum PBRMode
|
||||
{
|
||||
Off,
|
||||
Standard,
|
||||
Anisotropy,
|
||||
KKHair,
|
||||
Toon
|
||||
}
|
||||
|
||||
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.PBR;
|
||||
protected override GUIContent Header => new("PBR Settings");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user