Skip to content

Commit

Permalink
Rename a property
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiliMilk committed Dec 23, 2021
1 parent c40271a commit 5f35aaa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions Assets/ChiliMilkToonShader/Editor/ToonShaderGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private struct Styles
public static readonly GUIContent RenderQueue = new GUIContent("RenderQueue");
public static readonly GUIContent EnableStencil = new GUIContent("Stencil");
public static readonly GUIContent StencilType = new GUIContent("Stencil Type");
public static readonly GUIContent StencilChannel = new GUIContent("Stencil Channel");
public static readonly GUIContent StencilRef = new GUIContent("Stencil Ref");
public static readonly GUIContent Color = new GUIContent("Color");
public static readonly GUIContent Normal = new GUIContent("Normal");
public static readonly GUIContent Occlusion = new GUIContent("Occlusion");
Expand Down Expand Up @@ -89,7 +89,7 @@ private struct MPropertyNames
public static readonly string Cutoff = "_Cutoff";
public static readonly string EnableStencil = "_EnableStencil";
public static readonly string StencilType = "_StencilType";
public static readonly string StencilChannel = "_StencilChannel";
public static readonly string StencilRef = "_StencilRef";
public static readonly string EnvironmentReflections = "_EnvironmentReflections";
public static readonly string RenderQueue = "_RenderQueue";

Expand Down Expand Up @@ -207,7 +207,7 @@ public enum StencilType
private MaterialProperty m_RenderQueueProp;
private MaterialProperty m_EnableStencilProp;
private MaterialProperty m_StencilTypeProp;
private MaterialProperty m_StencilChannelProp;
private MaterialProperty m_StencilRefProp;

//Diffuse
private MaterialProperty m_BaseMapProp;
Expand Down Expand Up @@ -290,7 +290,7 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro
m_RenderQueueProp = FindProperty(MPropertyNames.RenderQueue, properties, false);
m_EnableStencilProp = FindProperty(MPropertyNames.EnableStencil, properties, false);
m_StencilTypeProp = FindProperty(MPropertyNames.StencilType, properties, false);
m_StencilChannelProp = FindProperty(MPropertyNames.StencilChannel, properties, false);
m_StencilRefProp = FindProperty(MPropertyNames.StencilRef, properties, false);

//Diffuse
m_BaseMapProp = FindProperty(MPropertyNames.BaseMap, properties, false);
Expand Down Expand Up @@ -638,7 +638,7 @@ private void DrawSurfaceOptions(MaterialEditor materialEditor)
}

//Stencil
if (material.HasProperty(MPropertyNames.EnableStencil) && material.HasProperty(MPropertyNames.StencilChannel))
if (material.HasProperty(MPropertyNames.EnableStencil) && material.HasProperty(MPropertyNames.StencilRef))
{
EditorGUI.BeginChangeCheck();
var enableStencil = EditorGUILayout.Toggle(Styles.EnableStencil, m_EnableStencilProp.floatValue == 1);
Expand Down Expand Up @@ -666,7 +666,7 @@ private void DrawSurfaceOptions(MaterialEditor materialEditor)
material.SetInt("_StencilOp", (int)UnityEngine.Rendering.StencilOp.Keep);
}
}
materialEditor.ShaderProperty(m_StencilChannelProp, Styles.StencilChannel);
materialEditor.ShaderProperty(m_StencilRefProp, Styles.StencilRef);
EditorGUI.showMixedValue = false;
}
else
Expand Down
10 changes: 5 additions & 5 deletions Assets/ChiliMilkToonShader/Shader/Toon.shader
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//Stencil
[HideInInspector]_StencilType("StencilType",Float) = 0
[ToggleOff]_EnableStencil("EnableStencil",Float) = 0
_StencilChannel ("Stencil Channel", int) =1
_StencilRef ("Stencil Ref", int) = 1
[HideInInspector]_StencilComp("Stencil Comp",int) = 0
[HideInInspector]_StencilOp ("Stencil Op",int) = 0

Expand Down Expand Up @@ -130,7 +130,7 @@
Cull Front
Stencil
{
Ref [_StencilChannel]
Ref [_StencilRef]
Comp [_StencilComp]
Pass [_StencilOp]
Fail [_StencilOp]
Expand Down Expand Up @@ -161,7 +161,7 @@
Cull[_Cull]
Stencil
{
Ref[_StencilChannel]
Ref[_StencilRef]
Comp[_StencilComp]
Pass [_StencilOp]
Fail [_StencilOp]
Expand Down Expand Up @@ -380,7 +380,7 @@
Cull Front
Stencil
{
Ref [_StencilChannel]
Ref [_StencilRef]
Comp [_StencilComp]
Pass [_StencilOp]
Fail [_StencilOp]
Expand Down Expand Up @@ -411,7 +411,7 @@
Cull[_Cull]
Stencil
{
Ref[_StencilChannel]
Ref[_StencilRef]
Comp[_StencilComp]
Pass [_StencilOp]
Fail [_StencilOp]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ Universal Toon shader based on URP , use PBR lighting(Minimalist CookTorrance
- Stencil Type (Set Material RenderQueue to Mask < Out).
Mask
Stencil {
Ref[_StencilChannel]
Ref[_StencilRef]
Comp Always
Pass Replace
Fail Replace
}
Out
Stencil {
Ref[_StencilChannel]
Ref[_StencilRef]
Comp NotEqual
Pass Keep
Fail Keep
Expand Down

0 comments on commit 5f35aaa

Please sign in to comment.