Skip to content

Commit 6ce1ae2

Browse files
committed
release v1.0.1
2 parents 5d8c598 + 189a294 commit 6ce1ae2

File tree

3 files changed

+61
-18
lines changed

3 files changed

+61
-18
lines changed

Assets/Coffee/UIExtensions/MeshEffectForTextMeshPro/Scripts/Editor/TMP_SDFShaderGUI_Dissolve.cs

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,79 @@
77

88
public class TMP_SDFShaderGUI_Dissolve : TMP_SDFShaderGUI
99
{
10-
static MaterialPanel dissolvePanel = new MaterialPanel ("Dissolve", true);
11-
static MaterialPanel spritePanel = new MaterialPanel ("Sprite", true);
10+
GUIStyle panelTitle;
11+
Material currentMaterial;
12+
13+
public override void OnGUI (MaterialEditor materialEditor, MaterialProperty [] properties)
14+
{
15+
currentMaterial = materialEditor.target as Material;
16+
base.OnGUI (materialEditor, properties);
17+
}
1218

1319
protected override void DoGUI ()
1420
{
15-
if(material.HasProperty("_FaceColor"))
21+
if (currentMaterial.HasProperty ("_FaceColor"))
1622
{
1723
base.DoGUI ();
1824
}
19-
else if(DoPanelHeader (spritePanel))
25+
else
2026
{
21-
EditorGUI.indentLevel += 1;
22-
DoTexture2D ("_MainTex", "Texture");
23-
DoColor ("_Color", "Color");
24-
EditorGUI.indentLevel -= 1;
27+
if (BeginCommonPanel ("Sprite", true))
28+
{
29+
EditorGUI.indentLevel++;
30+
DoTexture2D ("_MainTex", "Texture");
31+
DoColor ("_Color", "Color");
32+
EditorGUI.indentLevel--;
33+
}
34+
EndCommonPanel ();
2535
}
2636

27-
if (DoPanelHeader (dissolvePanel))
37+
if (BeginCommonPanel ("Dissolve", true))
2838
{
29-
EditorGUI.indentLevel += 1;
39+
EditorGUI.indentLevel++;
3040
DoTexture2D ("_NoiseTex", "Texture");
3141

3242
ColorMode color =
33-
material.IsKeywordEnabled ("ADD") ? ColorMode.Add
34-
: material.IsKeywordEnabled ("SUBTRACT") ? ColorMode.Subtract
35-
: material.IsKeywordEnabled ("FILL") ? ColorMode.Fill
43+
currentMaterial.IsKeywordEnabled ("ADD") ? ColorMode.Add
44+
: currentMaterial.IsKeywordEnabled ("SUBTRACT") ? ColorMode.Subtract
45+
: currentMaterial.IsKeywordEnabled ("FILL") ? ColorMode.Fill
3646
: ColorMode.Multiply;
3747

3848
var newColor = (ColorMode)EditorGUILayout.EnumPopup ("Color Mode", color);
3949
if (color != newColor)
4050
{
41-
material.DisableKeyword (color.ToString ().ToUpper ());
51+
currentMaterial.DisableKeyword (color.ToString ().ToUpper ());
4252
if (newColor != ColorMode.Multiply)
4353
{
44-
material.EnableKeyword (newColor.ToString ().ToUpper ());
54+
currentMaterial.EnableKeyword (newColor.ToString ().ToUpper ());
4555
}
4656
}
47-
EditorGUI.indentLevel -= 1;
57+
EditorGUI.indentLevel--;
58+
}
59+
EndCommonPanel ();
60+
}
61+
62+
bool BeginCommonPanel (string panel, bool expanded)
63+
{
64+
if (panelTitle == null)
65+
{
66+
panelTitle = new GUIStyle (EditorStyles.label) { fontStyle = FontStyle.Bold };
4867
}
68+
69+
EditorGUILayout.BeginVertical (EditorStyles.helpBox);
70+
Rect position = EditorGUI.IndentedRect (GUILayoutUtility.GetRect (20f, 18f));
71+
position.x += 20;
72+
position.width += 6f;
73+
expanded = GUI.Toggle (position, expanded, panel, panelTitle);
74+
EditorGUI.indentLevel++;
75+
EditorGUI.BeginDisabledGroup (false);
76+
return expanded;
77+
}
78+
79+
void EndCommonPanel ()
80+
{
81+
EditorGUI.EndDisabledGroup ();
82+
EditorGUI.indentLevel--;
83+
EditorGUILayout.EndVertical ();
4984
}
5085
}

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [v1.0.1](https://github.com/mob-sakai/ShinyEffectForTMPro/tree/v1.0.1) (2019-03-04)
4+
5+
[Full Changelog](https://github.com/mob-sakai/ShinyEffectForTMPro/compare/v1.0.0...v1.0.1)
6+
7+
**Fixed bugs:**
8+
9+
- TMP\_SDFShaderGUI\_Dissolve has compile errors in TMPro 1.3.0 [\#3](https://github.com/mob-sakai/ShinyEffectForTMPro/issues/3)
10+
311
## [v1.0.0](https://github.com/mob-sakai/ShinyEffectForTMPro/tree/v1.0.0) (2018-12-13)
412

513
[Full Changelog](https://github.com/mob-sakai/ShinyEffectForTMPro/compare/a9c4ec4e72a055ca5e5c24f6a75c6720f0f6fd7f...v1.0.0)
@@ -16,4 +24,4 @@ It works well not only for standard Graphic components (Image, RawImage, Text, e
1624

1725

1826

19-
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
27+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ShinyEffectForTMPro",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/mob-sakai/ShinyEffectForTMPro.git"

0 commit comments

Comments
 (0)