Skip to content

Commit

Permalink
Merge branch 'master' into MittrorOther-1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ishiiyuki committed Apr 13, 2024
2 parents b5c5d4e + ba129d8 commit 469f50a
Show file tree
Hide file tree
Showing 85 changed files with 184 additions and 85 deletions.
10 changes: 10 additions & 0 deletions Assets/lilToon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.7.3] - 2024-04-08
### Fixed
- ShadowCaster disappears when the outline is deleted
- Some textures are not deleted in `Remove Unused Texture`
- Optimization breaks IDMaskPrior function
- Shader error when set color to black
- RimShade mask now working
- Saving RimShade presets
- Set keywords on build

## [1.7.2] - 2024-01-18
### Fixed
- Toggle doesn't work well in Unity 2019
Expand Down
10 changes: 10 additions & 0 deletions Assets/lilToon/CHANGELOG_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.7.3] - 2024-04-08
### 修正
- アウトラインの頂点が削除される場合に深度の書き出しが正しく動作しない問題を修正
- `Remove Unused Texture`で一部テクスチャが残る問題を修正
- 最適化でIDMaskPriorが正しく動作しなくなるのを修正
- マテリアルの色を完全な黒に設定したときに最適化時にシェーダーが正しく動作しなくなるのを修正
- RimShadeのマスクが正しく動作していないのを修正
- RimShadeがプリセットに保存されないのを修正
- 一部シェーダーキーワードをビルド時にセットするように修正

## [1.7.2] - 2024-01-18
### 修正
- Unity 2019でトグルがうまく動作しないのを修正
Expand Down
4 changes: 2 additions & 2 deletions Assets/lilToon/Editor/lilConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace lilToon
{
public class lilConstants
{
public const string currentVersionName = "1.7.2";
public const int currentVersionValue = 42;
public const string currentVersionName = "1.7.3";
public const int currentVersionValue = 43;

internal const string boothURL = "https://lilxyzw.booth.pm/";
internal const string githubURL = "https://github.com/lilxyzw/lilToon";
Expand Down
2 changes: 1 addition & 1 deletion Assets/lilToon/Editor/lilDirectoryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal class lilDirectoryManager
public static string GetShaderFolderPath() { return GUIDToPath("ac0a8f602b5e72f458f4914bf08f0269"); } // "Assets/lilToon/Shader"
public static string GetShaderPipelinePath() { return GUIDToPath("32299664512e2e042bbc351c1d46d383"); } // "Assets/lilToon/Shader/Includes/lil_pipeline.hlsl";
public static string GetShaderCommonPath() { return GUIDToPath("5520e766422958546bbe885a95d5a67e"); } // "Assets/lilToon/Shader/Includes/lil_common.hlsl";
public static string GetEditorLanguageFileGUID() { return GUIDToPath("a63ad2f5296744a4bad011de744ba8ba"); } // "Assets/lilToon/Editor/Resources/lang.txt"
[System.Obsolete] public static string GetEditorLanguageFileGUID() { return GUIDToPath("a63ad2f5296744a4bad011de744ba8ba"); } // "Assets/lilToon/Editor/Resources/lang.txt"
public static string GetGUIBoxInDarkPath() { return GUIDToPath("bb1313c9ea1425b41b74e98fd04bcbc8"); } // "Assets/lilToon/Editor/Resources/gui_box_inner_dark.guiskin"
public static string GetGUIBoxInLightPath() { return GUIDToPath("f18d71f528511e748887f5e246abcc16"); } // "Assets/lilToon/Editor/Resources/gui_box_inner_light.guiskin"
public static string GetGUIBoxInHalfDarkPath() { return GUIDToPath("a72199a4c9cc3714d8edfbc5d3b13823"); } // "Assets/lilToon/Editor/Resources/gui_box_inner_half_dark.guiskin"
Expand Down
5 changes: 5 additions & 0 deletions Assets/lilToon/Editor/lilLanguageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public static void LoadCustomLanguage(string langFileGUID)
LoadLanguage(lilDirectoryManager.GUIDToPath(langFileGUID));
}

[Obsolete]
public static void InitializeLanguage()
{
if(langSet.languageNum == -1)
Expand All @@ -107,14 +108,18 @@ public static void InitializeLanguage()

public static void UpdateLanguage()
{
#pragma warning disable CS0612
string langPath = lilDirectoryManager.GetEditorLanguageFileGUID();
#pragma warning restore CS0612
LoadLanguage(langPath);
InitializeLabels();
}

public static void SelectLang()
{
#pragma warning disable CS0612
InitializeLanguage();
#pragma warning restore CS0612
int numbuf = langSet.languageNum;
langSet.languageNum = EditorGUILayout.Popup("Language", langSet.languageNum, langSet.languageNames.Split('\t'));
if(numbuf != langSet.languageNum) UpdateLanguage();
Expand Down
31 changes: 31 additions & 0 deletions Assets/lilToon/Editor/lilMaterialUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,30 @@ public static void SetupMultiMaterial(Material material)
SetShaderKeywords(material, "BILLBOARD_FACE_CAMERA_POS", false);
}

public static void SetupMultiMaterial(Material[] materials, AnimationClip[] clips)
{
var ms = materials.Where(m => m.shader.name.Contains("Multi")).ToArray();
foreach(var binding in clips.SelectMany(c => AnimationUtility.GetCurveBindings(c)).ToArray())
{
string propname = binding.propertyName;
if(string.IsNullOrEmpty(propname) || !propname.Contains("material.")) continue;

void Set(string name, string keyword)
{
if(propname.Contains(name))
foreach(var m in ms)
{
m.EnableKeyword(keyword);
EditorUtility.SetDirty(m);
}
}
Set("_RimDirStrength", "GEOM_TYPE_LEAF");
Set("_MainTexHSVG", "EFFECT_HUE_VARIATION");
Set("_MainGradationStrength", "EFFECT_HUE_VARIATION");
}
AssetDatabase.SaveAssets();
}

private static bool IsFeatureOnFloat(Material material, string propname)
{
if(material.HasProperty(propname)) return material.GetFloat(propname) != 0.0f;
Expand Down Expand Up @@ -597,6 +621,7 @@ public static void RemoveUnusedTexture(Material material, bool islite)
material.SetTexture("_SmoothnessTex", null);
material.SetTexture("_MetallicGlossMap", null);
material.SetTexture("_ReflectionColorTex", null);
material.SetTexture("_ReflectionCubeTex", null);
}
if(material.GetFloat("_UseMatCap") == 0.0f)
{
Expand All @@ -608,6 +633,12 @@ public static void RemoveUnusedTexture(Material material, bool islite)
material.SetTexture("_MatCap2ndTex", null);
material.SetTexture("_MatCap2ndBlendMask", null);
}
if(!material.shader.name.Contains("Outline"))
{
material.SetTexture("_OutlineTex", null);
material.SetTexture("_OutlineWidthMask", null);
material.SetTexture("_OutlineVectorTex", null);
}
if(material.GetFloat("_UseRim") == 0.0f) material.SetTexture("_RimColorTex", null);
if(material.GetFloat("_UseGlitter") == 0.0f) material.SetTexture("_GlitterColorTex", null);
if(material.GetFloat("_UseParallax") == 0.0f) material.SetTexture("_ParallaxMap", null);
Expand Down
2 changes: 2 additions & 0 deletions Assets/lilToon/Editor/lilOptimizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ private static string RewriteInputHLSLText(Dictionary<string, TexProp> dicT, Dic
var v = dicC[name];
Color c = ShouldLinear(shader, name) ? v.c.linear : v.c;
sb.AppendLine(GetIndent(indF4 - 8) + "#define " + name + " float4(" + LilF2S(c.r) + "," + LilF2S(c.g) + "," + LilF2S(c.b) + "," + LilF2S(c.a) + ")");

if(name == "_Color" && (v.c.r + v.c.g + v.c.b <= 0.001f)) sb.AppendLine(GetIndent(indF4 - 8) + "#define sampler_MainTex lil_sampler_linear_repeat_");
continue;
}
}
Expand Down
2 changes: 2 additions & 0 deletions Assets/lilToon/Editor/lilStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public static void lilStartupMethod()
{
//------------------------------------------------------------------------------------------------------------------------------
// Variables
#pragma warning disable CS0612
lilLanguageManager.InitializeLanguage();
#pragma warning restore CS0612

AssetDatabase.importPackageStarted -= PackageVersionChecker;
AssetDatabase.importPackageStarted += PackageVersionChecker;
Expand Down
4 changes: 3 additions & 1 deletion Assets/lilToon/Editor/lilToonEditorUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace lilToon
{
public static class lilToonEditorUtils
{
#pragma warning disable CS0612
//------------------------------------------------------------------------------------------------------------------------------
// Constant
private const string menuPathAssets = "Assets/lilToon/";
Expand Down Expand Up @@ -734,7 +735,8 @@ private static bool CheckImageExtension()
assetPath.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase);
}

public static string GetLoc(string value) { return lilLanguageManager.GetLoc(value); }
#pragma warning restore CS0612
[Obsolete] public static string GetLoc(string value) { return lilLanguageManager.GetLoc(value); }
}

#if LILTOON_DISABLE_ASSET_MODIFICATION == false
Expand Down
8 changes: 7 additions & 1 deletion Assets/lilToon/Editor/lilToonPreset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public class lilPresetWindow : EditorWindow
private bool shouldSaveNormalMap = true;
private bool shouldSaveNormalMap2nd = true;
private bool shouldSaveAnisotropy = true;
private bool shouldSaveRimShade = true;
private bool shouldSaveBacklight = true;
private bool shouldSaveReflection = true;
private bool shouldSaveMatCap = true;
Expand Down Expand Up @@ -179,6 +180,7 @@ public class lilPresetWindow : EditorWindow
private bool isShowFeatures = false;
private bool isShowTextures = false;

#pragma warning disable CS0612
private void OnGUI()
{
if(!(Selection.activeObject is Material)){
Expand Down Expand Up @@ -277,6 +279,7 @@ private void OnGUI()
shouldSaveNormalMap = EditorGUILayout.ToggleLeft(GetLoc("sNormalMap"), shouldSaveNormalMap);
shouldSaveNormalMap2nd = EditorGUILayout.ToggleLeft(GetLoc("sNormalMap2nd"), shouldSaveNormalMap2nd);
shouldSaveAnisotropy = EditorGUILayout.ToggleLeft(GetLoc("sAnisotropy"), shouldSaveAnisotropy);
shouldSaveRimShade = EditorGUILayout.ToggleLeft(GetLoc("sRimShade"), shouldSaveRimShade);
shouldSaveBacklight = EditorGUILayout.ToggleLeft(GetLoc("sBacklight"), shouldSaveBacklight);
shouldSaveReflection = EditorGUILayout.ToggleLeft(GetLoc("sReflection"), shouldSaveReflection);
shouldSaveMatCap = EditorGUILayout.ToggleLeft(GetLoc("sMatCap"), shouldSaveMatCap);
Expand Down Expand Up @@ -388,6 +391,7 @@ private void OnGUI()

EditorGUILayout.EndScrollView();
}
#pragma warning restore CS0612

private void CopyPropertiesToPreset(Material material)
{
Expand All @@ -410,6 +414,7 @@ private void CopyPropertiesToPreset(Material material)
shouldSaveNormalMap && lilPropertyNameChecker.IsNormalMapProperty(propName) ||
shouldSaveNormalMap2nd && lilPropertyNameChecker.IsNormalMap2ndProperty(propName) ||
shouldSaveAnisotropy && lilPropertyNameChecker.IsAnisotropyProperty(propName) ||
shouldSaveRimShade && lilPropertyNameChecker.IsRimShadeProperty(propName) ||
shouldSaveBacklight && lilPropertyNameChecker.IsBacklightProperty(propName) ||
shouldSaveReflection && lilPropertyNameChecker.IsReflectionProperty(propName) ||
shouldSaveMatCap && lilPropertyNameChecker.IsMatCapProperty(propName) ||
Expand Down Expand Up @@ -489,6 +494,7 @@ private void ToggleAllFeatures(bool val)
shouldSaveNormalMap = val;
shouldSaveNormalMap2nd = val;
shouldSaveAnisotropy = val;
shouldSaveRimShade = val;
shouldSaveBacklight = val;
shouldSaveReflection = val;
shouldSaveMatCap = val;
Expand Down Expand Up @@ -524,7 +530,7 @@ private void ToggleAllTextures(Material material, bool val)
}
}

public static string GetLoc(string value) { return lilLanguageManager.GetLoc(value); }
[Obsolete] public static string GetLoc(string value) { return lilLanguageManager.GetLoc(value); }
}
#endregion
}
Expand Down
Loading

0 comments on commit 469f50a

Please sign in to comment.