Skip to content

Commit

Permalink
Merge branch 'head_unity2019'
Browse files Browse the repository at this point in the history
  • Loading branch information
whiteflare committed Jul 20, 2024
2 parents b58a80b + 203be5c commit b1bce3a
Show file tree
Hide file tree
Showing 94 changed files with 1,768 additions and 385 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Change Log

## 2024-07-21 (2.2.0)
https://github.com/whiteflare/Unlit_WF_ShaderSuite/releases/tag/UnlitWF_Shader_20240721

### Added
- Shader
- MainTexture 2nd 機能を追加しました。
- EmissiveScroll に波形グラデーションテクスチャを追加しました。
- EmissiveAudioLink にディレイを追加しました。

### Changed
- GUI
- Hierarchy右クリックの「UnlitWF Shader/マテリアルのクリンナップ」を復活させました。
- グラデーションマップを参照する時の縦座標を今までは 0.0 で参照していたものを 0.5 に変更しました。

### Fixed
- GUI
- 機能を有効化したときにデフォルトテクスチャが割り当てられない問題を修正しました。

----

## 2024-06-12 (2.1.0)
https://github.com/whiteflare/Unlit_WF_ShaderSuite/releases/tag/UnlitWF_Shader_20240612

Expand Down
27 changes: 13 additions & 14 deletions Editor/WF_Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ static class WFCommonUtility
private static readonly Regex PAT_ENABLE_KEYWORD = new Regex(@"^_(?<prefix>[A-Z][A-Z0-9]*)_((?<func>[A-Z0-9]+)_)?ENABLE(?<suffix>(?:_\d+)?)$", RegexOptions.Compiled);

/// <summary>
/// プロパティのディスプレイ名から、Prefixと名前を分割する
/// プロパティのディスプレイ名から、Labelと名前を分割する
/// </summary>
/// <param name="text">ディスプレイ名</param>
/// <param name="label">Prefix</param>
/// <param name="label">Label</param>
/// <param name="name">名前</param>
/// <param name="dispName">ディスプレイ文字列</param>
/// <returns></returns>
Expand All @@ -93,21 +93,21 @@ public static bool FormatDispName(string text, out string label, out string name
/// プロパティ名の文字列から、Prefix+Suffixと名前を分割する。
/// </summary>
/// <param name="text">プロパティ名</param>
/// <param name="label">Prefix+Suffix</param>
/// <param name="prefix">Prefix+Suffix</param>
/// <param name="name">名前</param>
/// <returns></returns>
public static bool FormatPropName(string text, out string label, out string name)
public static bool FormatPropName(string text, out string prefix, out string name)
{
var mm = PAT_PROP_NAME.Match(text ?? "");
if (mm.Success)
{
label = mm.Groups["prefix"].Value.ToUpper() + mm.Groups["suffix"].Value.ToUpper();
prefix = mm.Groups["prefix"].Value.ToUpper() + mm.Groups["suffix"].Value.ToUpper();
name = mm.Groups["name"].Value;
return true;
}
else
{
label = null;
prefix = null;
name = text;
return false;
}
Expand All @@ -120,14 +120,14 @@ public static bool FormatPropName(string text, out string label, out string name
/// <returns></returns>
public static string GetPrefixFromPropName(string prop_name)
{
string label = WFShaderDictionary.SpecialPropNameToLabelMap.GetValueOrNull(prop_name);
if (label != null)
string prefix = WFShaderDictionary.SpecialPropNameToLabelMap.GetValueOrNull(prop_name);
if (prefix != null)
{
return label;
return prefix;
}
string name;
FormatPropName(prop_name, out label, out name);
return label;
FormatPropName(prop_name, out prefix, out name);
return prefix;
}

public static string GetHelpUrl(MaterialEditor editor, string displayName, string headerTitle)
Expand Down Expand Up @@ -166,9 +166,8 @@ public static string GetHelpUrl(MaterialEditor editor, string displayName, strin
/// <returns></returns>
public static bool IsEnableToggleFromPropName(string prop_name)
{
string label, name;
FormatPropName(prop_name, out label, out name);
return IsEnableToggle(label, name);
FormatPropName(prop_name, out var prefix, out var name);
return IsEnableToggle(prefix, name);
}

/// <summary>
Expand Down
23 changes: 23 additions & 0 deletions Editor/WF_Dictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ private static bool HasPropertyPrefix(Material mat, string prefix)
new WFShaderFunction("PA", "PA", "Particle System"),

// その他の機能
new WFShaderFunction("TX2", "TX2", "Main Texture 2nd"),
new WFShaderFunction("BKT", "BKT", "BackFace Texture"),
new WFShaderFunction("CGR", "CGR", "Gradient Map"),
new WFShaderFunction("CLC", "CLC", "Color Change"),
Expand Down Expand Up @@ -307,6 +308,7 @@ private static bool HasPropertyPrefix(Material mat, string prefix)
{ "HE", HELP_URL_UNTOON + "#LightMatcap" },
{ "HF", HELP_URL_UNTOON + "#LightMatcap" },
{ "HG", HELP_URL_UNTOON + "#LightMatcap" },
{ "TX2", HELP_URL_UNTOON + "#MainTex2nd" },
{ "BKT", HELP_URL_UNTOON + "#BackFaceTexture" },
{ "CGR", HELP_URL_UNTOON + "#GradientMap" },
{ "CLC", HELP_URL_UNTOON + "#ColorChange" },
Expand Down Expand Up @@ -392,9 +394,17 @@ private static bool HasPropertyPrefix(Material mat, string prefix)
new WFCustomKeywordSettingBool("_ES_ScrollEnable", "_ES_SCROLL_ENABLE") {
enablePropName = "_ES_Enable",
},
new WFCustomKeywordSettingCustom("_ES_SC_GradTex",
mat => WFAccessor.HasShaderPropertyTexture(mat.shader,"_ES_SC_GradTex") && WFAccessor.GetBool(mat, "_ES_ScrollEnable", false) && WFAccessor.GetInt(mat, "_ES_SC_Shape", 0) == 3 , "_ES_SCROLLGRAD_ENABLE") {
enablePropName = "_ES_Enable",
},
new WFCustomKeywordSettingBool("_ES_AuLinkEnable", "_ES_AULINK_ENABLE") {
enablePropName = "_ES_Enable",
},
new WFCustomKeywordSettingCustom("_ES_AU_DelayTex",
mat => WFAccessor.HasShaderPropertyTexture(mat.shader,"_ES_AU_DelayTex") && WFAccessor.GetBool(mat, "_ES_AuLinkEnable", false) && WFAccessor.GetInt(mat, "_ES_AU_DelayDir", 0) == 5 , "_ES_AULINKDTEX_ENABLE") {
enablePropName = "_ES_Enable",
},
new WFCustomKeywordSettingEnum("_TS_FixContrast", "_", "_TS_FIXC_ENABLE") {
enablePropName = "_TS_Enable",
},
Expand Down Expand Up @@ -437,6 +447,7 @@ private static Dictionary<string, WFCustomKeywordSetting> ToWFCustomKeywordSetti
// HeaderTitle
new WFI18NTranslation("3ch Color Mask", "3chカラーマスク"),
new WFI18NTranslation("Ambient Occlusion", "AOマップとライトマップ"),
new WFI18NTranslation("Main Texture 2nd", "メインテクスチャ 2nd"),
new WFI18NTranslation("BackFace Texture", "裏面テクスチャ"),
new WFI18NTranslation("Base", "基本設定"),
new WFI18NTranslation("ClearCoat", "クリアコート"),
Expand Down Expand Up @@ -542,6 +553,9 @@ private static Dictionary<string, WFCustomKeywordSetting> ToWFCustomKeywordSetti
new WFI18NTranslation("AL", "Power", "アルファ強度"),
new WFI18NTranslation("AL", "Fresnel Power", "フレネル強度"),
new WFI18NTranslation("AL", "Cutoff Threshold", "カットアウトしきい値"),
// MainTexture2nd
new WFI18NTranslation("TX2", "Main Texture 2nd", "メインテクスチャ 2nd"),
new WFI18NTranslation("TX2", "Color 2nd", "マテリアルカラー 2nd"),
// BackFace Texture
new WFI18NTranslation("BKT", "Back Texture", "裏面テクスチャ"),
new WFI18NTranslation("BKT", "Back Color", "裏面色"),
Expand Down Expand Up @@ -634,6 +648,7 @@ private static Dictionary<string, WFCustomKeywordSetting> ToWFCustomKeywordSetti
new WFI18NTranslation("ES", "Emission Texture", "Emission テクスチャ"),
new WFI18NTranslation("ES", "Enable EmissiveScroll", "スクロールを使用する"),
new WFI18NTranslation("ES", "Wave Type", "波形"),
new WFI18NTranslation("ES", "Wave Grad Tex", "波形グラデーションテクスチャ"),
new WFI18NTranslation("ES", "Change Alpha Transparency", "透明度も反映する"),
new WFI18NTranslation("ES", "Direction Type", "方向の種類"),
new WFI18NTranslation("ES", "LevelOffset", "ゼロ点調整"),
Expand All @@ -649,6 +664,10 @@ private static Dictionary<string, WFCustomKeywordSetting> ToWFCustomKeywordSetti
new WFI18NTranslation("ES", "Threshold (Min)", "しきい値 (Min)"),
new WFI18NTranslation("ES", "Threshold (Max)", "しきい値 (Max)"),
new WFI18NTranslation("ES", "Dont Emit when AudioLink is disabled", "AudioLink無効時は光らせない"),
new WFI18NTranslation("ES", "Delay Direction", "ディレイ方向"),
new WFI18NTranslation("ES", "Delay Control Texture (R)", "ディレイ制御テクスチャ (R)"),
new WFI18NTranslation("ES", "Delay Reverse", "ディレイ反転"),
new WFI18NTranslation("ES", "Delay Length", "ディレイ長"),
// Outline
new WFI18NTranslation("TL", "Line Color", "線の色"),
new WFI18NTranslation("TL", "Line Width", "線の太さ"),
Expand Down Expand Up @@ -826,6 +845,10 @@ private static Dictionary<string, WFCustomKeywordSetting> ToWFCustomKeywordSetti
new WFI18NTranslation("UnlitWF.SunSourceMode.CUSTOM_WORLD_DIR", "カスタム(ワールド方向)"),
new WFI18NTranslation("UnlitWF.SunSourceMode.CUSTOM_LOCAL_DIR", "カスタム(ローカル方向)"),
new WFI18NTranslation("UnlitWF.SunSourceMode.CUSTOM_WORLD_POS", "カスタム(ワールド座標)"),
new WFI18NTranslation("UnlitWF.EmissiveScrollMode.STANDARD", "標準"),
new WFI18NTranslation("UnlitWF.EmissiveScrollMode.SAWTOOTH", "のこぎり波"),
new WFI18NTranslation("UnlitWF.EmissiveScrollMode.SIN_WAVE", "正弦波"),
new WFI18NTranslation("UnlitWF.EmissiveScrollMode.CUSTOM", "カスタム"),

// WFEditorSetting
new WFI18NTranslation("WFEditorSetting", "This is the current setting used.", "これは現在有効な設定です。"),
Expand Down
4 changes: 2 additions & 2 deletions Editor/WF_MaterialConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ protected static List<Action<SelectShaderContext>> CreateConverterList()
},
ctx => {
// シェーダ切り替える直前に、削除したいプロパティを削除
WFMaterialEditUtility.RemovePropertiesWithoutUndo(ctx.target, "_GI_Intensity");
WFMaterialEditUtility.DeletePropertiesWithoutUndo(ctx.target, "_GI_Intensity");
// _GI_Intensity は UTS が保持しているが、UnToon でも過去に同名プロパティを持っていてマイグレーション対象にしているため削除する
},
ctx => {
Expand Down Expand Up @@ -1183,7 +1183,7 @@ protected static List<Action<ConvertContext>> CreateConverterList()
// BlendNormalを複製する
foreach(var propName in ctx.oldProps.Keys)
{
if (WFCommonUtility.FormatPropName(propName, out var label, out var name)) {
if (WFCommonUtility.FormatPropName(propName, out var _, out var name)) {
if (name == "BlendNormal")
{
var propName2 = propName.Replace("_BlendNormal", "_BlendNormal2");
Expand Down
Loading

0 comments on commit b1bce3a

Please sign in to comment.