Skip to content

Commit 2fc9706

Browse files
authored
Task/1014 enable disable built in outline (#95)
* Deleted OldLegacyUTStoCurrentLegacyUTS * Fixed: Unable to disable Outline pass for legacy shaders.
1 parent 57f4fbc commit 2fc9706

File tree

8 files changed

+234
-465
lines changed

8 files changed

+234
-465
lines changed

com.unity.toonshader/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
### Fixed:
77
* HDRP:reduced shader variants by disabling some debug pragmas.
88
* URP:UTS materials don't recieve shadows when using newer than Unity 2021.1.
9-
9+
* Legacy:Unable to disable Outline.
1010
### Updated
1111
* More effective and strict internal tests.
1212
## [0.4.1-preview] - 2021-10-20

com.unity.toonshader/Editor/Legacy/OldLegacyUTStoCurrentLegacyUTS.cs

Lines changed: 0 additions & 244 deletions
This file was deleted.

com.unity.toonshader/Editor/Legacy/OldLegacyUTStoCurrentLegacyUTS.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

com.unity.toonshader/Editor/UTS_GUIBase.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2775,6 +2775,8 @@ void SetuOutline(Material material)
27752775
}
27762776
void GUI_Outline(Material material)
27772777
{
2778+
const string kDisableOutlineKeyword = "_DISABLE_OUTLINE";
2779+
bool isLegacy = (srpDefaultLightModeName == "Always");
27782780

27792781
var srpDefaultLightModeTag = material.GetTag("LightMode", false, srpDefaultLightModeName);
27802782
bool isOutlineEnabled = true;
@@ -2786,14 +2788,26 @@ void GUI_Outline(Material material)
27862788
{
27872789
if (GUILayout.Button(STR_ONSTATE, shortButtonStyle))
27882790
{
2791+
if ( isLegacy)
2792+
{
2793+
material.EnableKeyword(kDisableOutlineKeyword);
2794+
}
2795+
27892796
material.SetShaderPassEnabled(srpDefaultLightModeName, false);
2797+
27902798
}
27912799
}
27922800
else
27932801
{
27942802
if (GUILayout.Button(STR_OFFSTATE, shortButtonStyle))
27952803
{
2804+
if (isLegacy)
2805+
{
2806+
material.DisableKeyword(kDisableOutlineKeyword);
2807+
}
2808+
27962809
material.SetShaderPassEnabled(srpDefaultLightModeName, true);
2810+
27972811
}
27982812
}
27992813
EditorGUILayout.EndHorizontal();

com.unity.toonshader/Runtime/Legacy/Shaders/LegacyToon.shader

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ Shader "Toon (Built-in)" {
235235
//V.2.0.4
236236
#pragma multi_compile _IS_OUTLINE_CLIPPING_NO
237237
#pragma multi_compile _OUTLINE_NML _OUTLINE_POS
238+
// Unity Toon Shader 0.5.0
239+
#pragma multi_compile _ _DISABLE_OUTLINE
238240
//The outline process goes to UTS_Outline.cginc.
239241
#include "UCTS_Outline.cginc"
240242
ENDCG

com.unity.toonshader/Runtime/Legacy/Shaders/LegacyToonTessellation.shader

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,8 @@ Shader "ToonTessellation (Built-in)" {
392392

393393
//v.2.0.4
394394
#pragma shader_feature _IS_CLIPPING_OFF _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE
395+
// Unity Toon Shader 0.5.0
396+
#pragma multi_compile _ _DISABLE_OUTLINE
395397
#include "UCTS_ShadowCaster_tess.cginc"
396398
ENDCG
397399
}

0 commit comments

Comments
 (0)