Skip to content

Commit

Permalink
release v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Mar 4, 2019
2 parents 5d8c598 + 189a294 commit 6ce1ae2
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,79 @@

public class TMP_SDFShaderGUI_Dissolve : TMP_SDFShaderGUI
{
static MaterialPanel dissolvePanel = new MaterialPanel ("Dissolve", true);
static MaterialPanel spritePanel = new MaterialPanel ("Sprite", true);
GUIStyle panelTitle;
Material currentMaterial;

public override void OnGUI (MaterialEditor materialEditor, MaterialProperty [] properties)
{
currentMaterial = materialEditor.target as Material;
base.OnGUI (materialEditor, properties);
}

protected override void DoGUI ()
{
if(material.HasProperty("_FaceColor"))
if (currentMaterial.HasProperty ("_FaceColor"))
{
base.DoGUI ();
}
else if(DoPanelHeader (spritePanel))
else
{
EditorGUI.indentLevel += 1;
DoTexture2D ("_MainTex", "Texture");
DoColor ("_Color", "Color");
EditorGUI.indentLevel -= 1;
if (BeginCommonPanel ("Sprite", true))
{
EditorGUI.indentLevel++;
DoTexture2D ("_MainTex", "Texture");
DoColor ("_Color", "Color");
EditorGUI.indentLevel--;
}
EndCommonPanel ();
}

if (DoPanelHeader (dissolvePanel))
if (BeginCommonPanel ("Dissolve", true))
{
EditorGUI.indentLevel += 1;
EditorGUI.indentLevel++;
DoTexture2D ("_NoiseTex", "Texture");

ColorMode color =
material.IsKeywordEnabled ("ADD") ? ColorMode.Add
: material.IsKeywordEnabled ("SUBTRACT") ? ColorMode.Subtract
: material.IsKeywordEnabled ("FILL") ? ColorMode.Fill
currentMaterial.IsKeywordEnabled ("ADD") ? ColorMode.Add
: currentMaterial.IsKeywordEnabled ("SUBTRACT") ? ColorMode.Subtract
: currentMaterial.IsKeywordEnabled ("FILL") ? ColorMode.Fill
: ColorMode.Multiply;

var newColor = (ColorMode)EditorGUILayout.EnumPopup ("Color Mode", color);
if (color != newColor)
{
material.DisableKeyword (color.ToString ().ToUpper ());
currentMaterial.DisableKeyword (color.ToString ().ToUpper ());
if (newColor != ColorMode.Multiply)
{
material.EnableKeyword (newColor.ToString ().ToUpper ());
currentMaterial.EnableKeyword (newColor.ToString ().ToUpper ());
}
}
EditorGUI.indentLevel -= 1;
EditorGUI.indentLevel--;
}
EndCommonPanel ();
}

bool BeginCommonPanel (string panel, bool expanded)
{
if (panelTitle == null)
{
panelTitle = new GUIStyle (EditorStyles.label) { fontStyle = FontStyle.Bold };
}

EditorGUILayout.BeginVertical (EditorStyles.helpBox);
Rect position = EditorGUI.IndentedRect (GUILayoutUtility.GetRect (20f, 18f));
position.x += 20;
position.width += 6f;
expanded = GUI.Toggle (position, expanded, panel, panelTitle);
EditorGUI.indentLevel++;
EditorGUI.BeginDisabledGroup (false);
return expanded;
}

void EndCommonPanel ()
{
EditorGUI.EndDisabledGroup ();
EditorGUI.indentLevel--;
EditorGUILayout.EndVertical ();
}
}
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [v1.0.1](https://github.com/mob-sakai/ShinyEffectForTMPro/tree/v1.0.1) (2019-03-04)

[Full Changelog](https://github.com/mob-sakai/ShinyEffectForTMPro/compare/v1.0.0...v1.0.1)

**Fixed bugs:**

- TMP\_SDFShaderGUI\_Dissolve has compile errors in TMPro 1.3.0 [\#3](https://github.com/mob-sakai/ShinyEffectForTMPro/issues/3)

## [v1.0.0](https://github.com/mob-sakai/ShinyEffectForTMPro/tree/v1.0.0) (2018-12-13)

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



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ShinyEffectForTMPro",
"version": "1.0.0",
"version": "1.0.1",
"repository": {
"type": "git",
"url": "git+https://github.com/mob-sakai/ShinyEffectForTMPro.git"
Expand Down

0 comments on commit 6ce1ae2

Please sign in to comment.