Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
z3y committed Jun 26, 2023
2 parents 19f2604 + 8db786d commit f6285ce
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
10 changes: 9 additions & 1 deletion Editor/FreeImage/FreeImagePackingEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,15 @@ public void OnGUI()
{
var texture = AssetDatabase.LoadAssetAtPath<Texture2D>(unityPath);
_packingMaterial.SetTexture(_packingProperty.name, texture);
LitGUI.ApplyChanges(_packingMaterial);
if (_packingMaterial.shader.name == ProjectSettings.ShaderName)
{
LitGUI.ApplyChanges(_packingMaterial);
}
else
{
DefaultInspector.RequestValidate();
}
MaterialEditor.ApplyMaterialPropertyDrawers(_packingMaterial);
}
}
EditorGUILayout.EndHorizontal();
Expand Down
11 changes: 10 additions & 1 deletion Editor/Importer/LitImporterDefaultProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ [ToggleGroupEnd] [UnIndent] [ToggleOff] _OpaqueLights(""Opaque Lights"", Float)

public const string DefaultConfigFile = @"
DEFINES_START
// #define BAKERY_MONOSH // enable mono sh globally
// comment out to set globally
// #define BAKERY_MONOSH // enable mono
// #define _LIGHTMAPPED_SPECULAR // enable lightmapped specular
// #undef APPROXIMATE_AREALIGHT_SPECULAR // lower the smoothness in areas where theres less directionality in directional lightmaps, defined by default
// #define BICUBIC_LIGHTMAP // enable bicubic lightmap
// #define BAKERY_SHNONLINEAR_OFF // disable non linear lightmap sh, enabled by default
// #define NONLINEAR_LIGHTPROBESH // enable non linear lightprobe sh
// #define DISABLE_LIGHT_PROBE_PROXY_VOLUME // enable LPPV
// #undef UNITY_SPECCUBE_BLENDING // disable blending of 2 reflection probes
DEFINES_END
";
Expand Down
25 changes: 15 additions & 10 deletions Editor/Inspector/DefaultInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] mat
materialEditor.EnableInstancingField();
materialEditor.DoubleSidedGIField();

if (EditorGUI.EndChangeCheck())
if (EditorGUI.EndChangeCheck() || _requestValidate)
{
OnValidate(materialEditor, materialProperties);
_requestValidate = false;
}
}

private static bool _requestValidate = false;
public static void RequestValidate() => _requestValidate = true;
private void OnValidate(MaterialEditor materialEditor, MaterialProperty[] materialProperties)
{
foreach (Material mat in materialEditor.targets)
Expand Down Expand Up @@ -258,15 +260,18 @@ private void InitializeEditor(MaterialEditor materialEditor, MaterialProperty[]
rect = MaterialEditor.GetRectAfterLabelWidth(rect);
rect.width = 50;
//rect.position = new Vector2(Screen.width / 2, rect.position.y);
if (GUI.Button(rect, "Pack"))
if (editor.targets.Length == 1)
{
FreeImagePackingEditor.Init();
FreeImagePackingEditor.ChannelR.DisplayName = rName;
FreeImagePackingEditor.ChannelG.DisplayName = gName;
FreeImagePackingEditor.ChannelB.DisplayName = bName;
FreeImagePackingEditor.ChannelA.DisplayName = aName;
FreeImagePackingEditor.Linear = isLinear;
FreeImagePackingEditor.AddPackingMaterial((Material)editor.target, unityProperty[property.index]);
if (GUI.Button(rect, "Pack"))
{
FreeImagePackingEditor.Init();
FreeImagePackingEditor.ChannelR.DisplayName = rName;
FreeImagePackingEditor.ChannelG.DisplayName = gName;
FreeImagePackingEditor.ChannelB.DisplayName = bName;
FreeImagePackingEditor.ChannelA.DisplayName = aName;
FreeImagePackingEditor.Linear = isLinear;
FreeImagePackingEditor.AddPackingMaterial((Material)editor.target, unityProperty[property.index]);
}
}
};
}
Expand Down
1 change: 1 addition & 0 deletions Shaders/Lit.litshader
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ PROPERTIES_START // Properties
FoldoutMainEnd_PropertiesLocal ("", Float) = 0

FoldoutMainStart_Details ("Details", Float) = 0
[TexturePacking(Abledo R, Albedo G, Albedo B, Mask, false)]
[NoScaleOffset] [Toggle(_DETAIL_ALBEDO)] [Tooltip(Albedo (RGB), Mask (A))] [ExtraProperty] _DetailAlbedo ("Detail Albedo", 2D) = "white" {}
[Enum(Multiply X2, 0, Overlay, 1, Screen, 3)] [Indent] [UnIndent] _DetailAlbedoBlendMode ("Blend Mode", Int) = 0
[NoScaleOffset] [Normal] [Toggle(_DETAIL_NORMAL)] [ExtraProperty] _DetailBumpMap ("Detail Normal Map", 2D) = "bump" {}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.z3y.shaders",
"description": "A Standard Shader and Surface Shaders replacement for Unity for Built-In pipeline and forward rendering (VRChat)",
"version": "3.2.2",
"version": "3.2.3",
"unity": "2019.4",
"displayName": "z3y - Shaders",
"hideInEditor": false,
Expand Down

0 comments on commit f6285ce

Please sign in to comment.