Skip to content

Commit

Permalink
Merge pull request #68 from JasonMa0012/2.x
Browse files Browse the repository at this point in the history
Optimize the display of Advanced Header
  • Loading branch information
JasonMa0012 authored Nov 13, 2024
2 parents 81990ce + c80dff4 commit 029b06f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Editor/LWGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro

private void DrawAdvancedHeader(PropertyStaticData propStaticData, MaterialProperty prop)
{
EditorGUILayout.Space(3);
var rect = EditorGUILayout.GetControlRect();
var revertButtonRect = RevertableHelper.SplitRevertButtonRect(ref rect);
var label = string.IsNullOrEmpty(propStaticData.advancedHeaderString) ? "Advanced" : propStaticData.advancedHeaderString;
propStaticData.isExpanding = EditorGUI.Foldout(rect, propStaticData.isExpanding, label);
propStaticData.isExpanding = EditorGUI.Foldout(rect, propStaticData.isExpanding, label, EditorStyles.foldoutHeader);
if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && rect.Contains(Event.current.mousePosition))
propStaticData.isExpanding = !propStaticData.isExpanding;
RevertableHelper.DrawRevertableProperty(revertButtonRect, prop, metaDatas, true);
Expand All @@ -146,6 +147,9 @@ private void DrawProperty(MaterialProperty prop)
{
var (propStaticData, propDynamicData) = metaDatas.GetPropDatas(prop);
var materialEditor = metaDatas.GetMaterialEditor();

if (propStaticData.isAdvancedHeaderProperty)
EditorGUILayout.Space(3);

Helper.DrawHelpbox(propStaticData, propDynamicData);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.jasonma.lwgui",
"version": "1.19.3",
"version": "1.19.4",
"displayName": "LWGUI",
"description": "A Lightweight, Flexible, Powerful Shader GUI System for Unity.",
"keywords": [
Expand Down

0 comments on commit 029b06f

Please sign in to comment.