Skip to content

Commit

Permalink
- add search field
Browse files Browse the repository at this point in the history
- per material / shader cache state
- public API to internal
- fix #7
- remove Obsolete APIs
  • Loading branch information
JasonMa0012 committed Sep 25, 2022
2 parents 1cffc97 + 8bd77e1 commit fcfad24
Show file tree
Hide file tree
Showing 12 changed files with 877 additions and 481 deletions.
960 changes: 655 additions & 305 deletions Editor/DrawerUtility.cs

Large diffs are not rendered by default.

293 changes: 157 additions & 136 deletions Editor/ShaderDrawer.cs

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Editor/Test/LWGUI_KeywordTest 1.mat
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Material:
m_Name: LWGUI_KeywordTest 1
m_Shader: {fileID: 4800000, guid: 52d4969be96ad35418215d6bda45665b, type: 3}
m_ValidKeywords:
- _KEYWORDENUM_KEY1
- _KEYWORDENUM_KEY2
- _KWENUM_KEY2
- _SUBKEYWORDENUM_KEY1
m_InvalidKeywords:
- key1
- _SUBKEYWORDENUM_KEY2
- _TOGGLE_KEYWORD
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
Expand All @@ -28,11 +28,11 @@ Material:
m_Floats:
- _enum: 1
- _group: 1
- _keywordEnum: 0
- _keywordEnum: 1
- _kwenum: 1
- _subEnum: 1
- _subKeywordEnum: 0
- _subKeywordEnum: 1
- _toggle: 0
- _toggle1: 0
- _toggle1: 1
m_Colors: []
m_BuildTextureStacks: []
22 changes: 7 additions & 15 deletions Editor/Test/LWGUI_KeywordTest.mat
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: LWGUI_KeywordTest
m_Shader: {fileID: 4800000, guid: 52d4969be96ad35418215d6bda45665b, type: 3}
m_ValidKeywords:
- _KEYWORDENUM_KEY1
- _KWENUM_KEY1
m_InvalidKeywords:
- _ENUM_KEY1
- key1
m_ShaderKeywords: _KEYWORDENUM_KEY2 _KWENUM_KEY2 _SUBKEYWORDENUM_KEY1
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
Expand All @@ -24,15 +18,13 @@ Material:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Ints: []
m_Floats:
- _enum: 0
- _enum: 1
- _group: 1
- _keywordEnum: 0
- _kwenum: 0
- _keywordEnum: 1
- _kwenum: 1
- _subEnum: 1
- _subKeywordEnum: 0
- _toggle: 0
- _toggle1: 0
m_Colors: []
m_BuildTextureStacks: []
12 changes: 8 additions & 4 deletions Editor/Test/LWGUI_SampleDrawer 1.mat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ Material:
m_Texture: {fileID: 2800000, guid: 87addb69bcbcc9b4ea7336eff8d6a52b, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Tex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _normal:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
Expand Down Expand Up @@ -59,10 +63,10 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _enum: 1
- _enum: 0
- _float: -0.8
- _float1: 0.33
- _float2: -0.35
- _float1: -0.05
- _float2: -0.08
- _float3: 0
- _float4: 2
- _floatN: 0
Expand Down Expand Up @@ -90,5 +94,5 @@ Material:
- _mColor3: {r: 0, g: 0, b: 1, a: 1}
- _textureChannelMask: {r: 0, g: 0, b: 1, a: 0}
- _textureChannelMask1: {r: 0, g: 0, b: 0, a: 1}
- _vector1: {r: 1, g: 1, b: 1, a: 1}
- _vector1: {r: 1.32, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
13 changes: 9 additions & 4 deletions Editor/Test/LWGUI_SampleDrawer 2.mat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Material:
m_InvalidKeywords:
- _GROUP_ON
- _KEY1
- _KEY2
- _KEY3
- _KEYWORD
- _TOGGLE_KEYWORD
Expand All @@ -29,6 +30,10 @@ Material:
m_Texture: {fileID: 2800000, guid: df4a1e363556192459af030f3e1d4e89, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Tex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _normal:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
Expand Down Expand Up @@ -59,7 +64,7 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _enum: 0
- _enum: 2
- _float: 0.53
- _float1: 0
- _float2: -0.57
Expand All @@ -73,8 +78,8 @@ Material:
- _key1_Float1: 0
- _key2_Float2: 0
- _key3_Float3: 0
- _key3_Float3_Range: 0
- _key3_Float4_PowerSlider: 0.000088794855
- _key3_Float3_Range: 0.137
- _key3_Float4_PowerSlider: 0.0033800516
- _minMaxSlider: 1
- _range: 0
- _rangeEnd: 0.7474536
Expand All @@ -90,5 +95,5 @@ Material:
- _mColor3: {r: 0, g: 0, b: 1, a: 1}
- _textureChannelMask: {r: 0, g: 1, b: 0, a: 0}
- _textureChannelMask1: {r: 0, g: 0, b: 0, a: 1}
- _vector1: {r: 1, g: 1, b: 1, a: 1}
- _vector1: {r: 0.34, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
17 changes: 12 additions & 5 deletions Editor/Test/LWGUI_SampleDrawer.mat
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
serializedVersion: 8
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LWGUI_SampleDrawer
m_Shader: {fileID: 4800000, guid: ded91f399f8343d4f9b0cf33eda0088d, type: 3}
m_ShaderKeywords: KEY2 _KEYWORD
m_ValidKeywords: []
m_InvalidKeywords:
- KEY2
- _GROUP_ON
- _KEYWORD
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
Expand Down Expand Up @@ -38,6 +43,7 @@ Material:
m_Texture: {fileID: 2800000, guid: 936423d97fbdd3c40bd47377240f5c64, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Queue: 2000
- _enum: 1
Expand All @@ -50,7 +56,7 @@ Material:
- _enumFloat3: 0
- _enumFloat4_range: 0
- _float: 1
- _float2: 2
- _float2: 1.17
- _float3: 2
- _float30: 2
- _float31: 2
Expand Down Expand Up @@ -79,3 +85,4 @@ Material:
- _mColor1: {r: 1, g: 0, b: 0, a: 1}
- _mColor2: {r: 0.68301886, g: 1, b: 0.68301886, a: 1}
- _mColor3: {r: 0, g: 0, b: 1, a: 1}
m_BuildTextureStacks: []
8 changes: 8 additions & 0 deletions Editor/Test/SampleDrawer 1.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ Shader "Hidden"
[HideInInspector] _mColor2 (" ", Color) = (0, 1, 0, 1)
[HideInInspector] [HDR] _mColor3 (" ", Color) = (0, 0, 1, 1)

[Tex(_, _color2)] _tex_color2 ("Tex with Color", 2D) = "white" { }
[HideInInspector] _color2 (" ", Color) = (1, 0, 0, 1)
[Tex(_, _float5)] _tex_float2 ("Tex with Float", 2D) = "white" { }
[HideInInspector] _float5 (" ", float) = 0
[Tex(_, _range2)] _tex_range2 ("Tex with Range", 2D) = "white" { }
[HideInInspector] _range2 (" ", Range(0,1)) = 0
[Tex(_, _textureChannelMask2)] _tex_channel2 ("Tex with Channel", 2D) = "white" { }
[HideInInspector] _textureChannelMask2(" ", Vector) = (0,0,0,1)

[Space]
[Title(Ramp Samples)]
Expand Down
2 changes: 1 addition & 1 deletion Editor/Test/SampleDrawer.shader
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Shader "Hidden"

[Title(Title on Group)]
// Create a folding group with name "g1"
[Main(g1)] _group ("Group", float) = 1
[Main(g1)] _group ("Group", float) = 0
[Sub(g1)] _float ("float", float) = 2

[KWEnum(g1, name1, key1, name2, key2, name3, key3)]
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ Use simple MaterialProperty Drawer syntax to achieve complex Shader GUI, save a

## Installation

1. Make sure your environment is compatible with LWGUI: **Unity 2017+**
1. Make sure your environment is compatible with LWGUI: **Unity 2019.2+**

**The Unity 2017-2018 version has stopped maintenance**, if necessary, please download **2017-2018 branch** to use.
2. Open your project
3. `Window > Package Manager > Add > Add package from git URL` , enter: `https://github.com/JasonMa0012/LWGUI.git`

- You can also choose to manually download the Zip from Github,then: `Package Manager > Add package from disk`

## Usage
Expand Down
4 changes: 3 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@

## Installation

1. 确保你的环境兼容LWGUI: **Unity 2017+**
1. 确保你的环境兼容LWGUI: **Unity 2019.2+**

**Unity 2019以下版本已经停止维护**, 如有需要请自行下载**2017-2018分支**使用.
2. 打开已有工程
3. (可能需要代理)`Window > Package Manager > Add > Add package from git URL` 输入`https://github.com/JasonMa0012/LWGUI.git`
- 你也可以选择手动从Github下载Zip,然后从`Package Manager > Add package from disk`添加Local Package
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.jasonma.lwgui",
"version": "1.1.2",
"version": "1.2.0",
"displayName": "LWGUI",
"description": "A Lightweight, Flexible, Powerful Shader GUI System for Unity.",
"keywords": [
Expand All @@ -12,5 +12,9 @@
"email": "[email protected]",
"url": "https://github.com/JasonMa0012/LWGUI"
},
"type": "tool"
"type": "tool",
"unity": "2019.2",
"changelogUrl": "https://github.com/JasonMa0012/LWGUI/releases",
"documentationUrl": "https://github.com/JasonMa0012/LWGUI",
"licensesUrl": "https://github.com/JasonMa0012/LWGUI/blob/main/LICENSE"
}

0 comments on commit fcfad24

Please sign in to comment.