diff --git a/Editor/AssetProcessor/ExcludeFromBuild.cs b/Editor/AssetProcessor/ExcludeFromBuild.cs index 8302f56..0071e61 100644 --- a/Editor/AssetProcessor/ExcludeFromBuild.cs +++ b/Editor/AssetProcessor/ExcludeFromBuild.cs @@ -1,12 +1,13 @@ -using System.Collections.Generic; -using System.IO; -using UnityEditor; -using UnityEditor.Build; -using UnityEditor.Build.Reporting; -using UnityEngine; +// using System.Collections.Generic; +// using System.IO; +// using UnityEditor; +// using UnityEditor.Build; +// using UnityEditor.Build.Reporting; +// using UnityEngine; namespace LWGUI { + /* /// /// Used to exclude textures referenced by ImageDrawer in Build /// @@ -109,4 +110,5 @@ public void OnPostprocessBuild(BuildReport report) OutputLogs(); } } + */ } \ No newline at end of file diff --git a/Editor/MetaData/PerShaderData.cs b/Editor/MetaData/PerShaderData.cs index 653aed0..04318c4 100644 --- a/Editor/MetaData/PerShaderData.cs +++ b/Editor/MetaData/PerShaderData.cs @@ -31,7 +31,7 @@ public class DisplayModeData public bool IsDefaultDisplayMode() { return !(showAllAdvancedProperties || showAllHiddenProperties || showOnlyModifiedProperties || showOnlyModifiedGroups); } } - public class PropertyStaticData + public partial class PropertyStaticData { public string name = string.Empty; public string displayName = string.Empty; // Decoded displayName (Helpbox and Tooltip are encoded in displayName) @@ -105,6 +105,7 @@ public PerShaderData(Shader shader, MaterialProperty[] props) propStaticDatas[prop.name] = propStaticData; // Get Drawers and Build Drawer StaticMetaData + bool hasDecodedStaticMetaData = false; { var drawer = ReflectionHelper.GetPropertyDrawer(shader, prop, out var decoratorDrawers); @@ -116,6 +117,7 @@ public PerShaderData(Shader shader, MaterialProperty[] props) { propStaticData.baseDrawers = new List() { baseDrawer }; baseDrawer.BuildStaticMetaData(shader, prop, props, propStaticData); + hasDecodedStaticMetaData = true; } decoratorDrawers?.ForEach(decoratorDrawer => @@ -133,7 +135,8 @@ public PerShaderData(Shader shader, MaterialProperty[] props) }); } - DecodeMetaDataFromDisplayName(prop, propStaticData); + if (!hasDecodedStaticMetaData) + DecodeMetaDataFromDisplayName(prop, propStaticData); } // Check Data @@ -245,7 +248,7 @@ public PropertyStaticData GetPropStaticData(string propName) private static readonly string _helpboxSplitter = "%"; - public void DecodeMetaDataFromDisplayName(MaterialProperty prop, PropertyStaticData propStaticData) + public static void DecodeMetaDataFromDisplayName(MaterialProperty prop, PropertyStaticData propStaticData) { var tooltips = prop.displayName.Split(new String[] { _tooltipSplitter }, StringSplitOptions.None); if (tooltips.Length > 1) diff --git a/Editor/ShaderDrawer.cs b/Editor/ShaderDrawer.cs index 7632dd3..c2addc6 100644 --- a/Editor/ShaderDrawer.cs +++ b/Editor/ShaderDrawer.cs @@ -2,7 +2,9 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Reflection; using LWGUI.LwguiGradientEditor; using LWGUI.Runtime.LwguiGradient; using UnityEditor; @@ -25,6 +27,17 @@ public interface IBasePresetDrawer { ShaderPropertyPreset.Preset GetActivePreset(MaterialProperty inProp, ShaderPropertyPreset shaderPropertyPreset); } + + public partial class PropertyStaticData + { + // Image + public Texture2D image; + + // Button + public List buttonDisplayNames = new(); + public List buttonCommands = new(); + public List buttonDisplayNameWidths = new(); + } /// /// Create a Folding Group @@ -66,6 +79,7 @@ public virtual void BuildStaticMetaData(Shader inShader, MaterialProperty inProp inoutPropertyStaticData.groupName = _group; inoutPropertyStaticData.isMain = true; inoutPropertyStaticData.isExpanding = _defaultFoldingState; + PerShaderData.DecodeMetaDataFromDisplayName(inProp, inoutPropertyStaticData); } public virtual void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) @@ -137,6 +151,7 @@ protected virtual float GetVisibleHeight(MaterialProperty prop) public virtual void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) { inoutPropertyStaticData.groupName = group; + PerShaderData.DecodeMetaDataFromDisplayName(inProp, inoutPropertyStaticData); } public virtual void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) { } @@ -691,15 +706,12 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l } /// - /// Draw a read only texture preview. Select the default texture to be displayed in the shader import settings. - /// Note: Selected default textures will always be excluded from the build!!! + /// Draw an image preview. + /// display name: The path of the image file relative to the Unity project, such as: "Assets/test.png", "Doc/test.png", "../test.png" /// group:father group name, support suffix keyword for conditional display (Default: none) - /// Target Property Type: Texture /// public class ImageDrawer : SubDrawer { - private Texture _defaultTex = null; - public ImageDrawer() { } public ImageDrawer(string group) @@ -709,23 +721,39 @@ public ImageDrawer(string group) protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } - protected override bool IsMatchPropType(MaterialProperty property) { return property.type == MaterialProperty.PropType.Texture; } - - public override void OverrideDefaultValue(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData) + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) { - // To disable revert button - _defaultTex = inDefaultProp.textureValue; - inDefaultProp.textureValue = null; + var imagePath = Application.dataPath.Substring(0, Application.dataPath.Length - 6) + inProp.displayName; + if (File.Exists(imagePath)) + { + var fileData = File.ReadAllBytes(imagePath); + Texture2D texture = new Texture2D(2, 2); + + // LoadImage will auto-resize the texture dimensions + if (texture.LoadImage(fileData)) + { + inoutPropertyStaticData.image = texture; + } + else + { + Debug.LogError($"LWGUI: Failed to load image data into texture: { imagePath }"); + } + } + else + { + Debug.LogError($"LWGUI: Image path not found: { imagePath }"); + } } public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { - if (_defaultTex) + var image = metaDatas.GetPropStaticData(prop).image; + if (image) { - var scaledheight = Mathf.Max(0, _defaultTex.height / (_defaultTex.width / Helper.GetCurrentPropertyLayoutWidth())); + var scaledheight = Mathf.Max(0, image.height / (image.width / Helper.GetCurrentPropertyLayoutWidth())); var rect = EditorGUILayout.GetControlRect(true, scaledheight); rect = RevertableHelper.IndentRect(EditorGUI.IndentedRect(rect)); - EditorGUI.DrawPreviewTexture(rect, _defaultTex); + EditorGUI.DrawPreviewTexture(rect, image); if (GUI.enabled) prop.textureValue = null; @@ -1176,6 +1204,167 @@ public override void Apply(MaterialProperty prop) presetFile.presets[(int)prop.floatValue].ApplyKeywordsToMaterials(prop.targets); } } + + /// + /// Draw one or more Buttons within the same row, using the Display Name to control the appearance and behavior of the buttons + /// + /// Declaring a set of Button Name and Button Command in Display Name generates a Button, separated by '@': + /// ButtonName0@ButtonCommand0@ButtonName1@ButtonCommand1 + /// + /// Button Name can be any other string, the format of Button Command is: + /// TYPE:Argument + /// + /// The following TYPEs are currently supported: + /// - URL: Open the URL, Argument is the URL + /// - C#: Call the public static C# function, Argument is NameSpace.Class.Method(arg0, arg1, ...), + /// for target function signatures, see: LWGUI.ButtonDrawer.TestMethod(). + /// + /// The full example: + /// [Button(_)] _button0 ("URL Button@URL:https://github.com/JasonMa0012/LWGUI@C#:LWGUI.ButtonDrawer.TestMethod(1234, abcd)", Float) = 0 + /// + /// group:father group name, support suffix keyword for conditional display (Default: none) + /// + public class ButtonDrawer : SubDrawer + { + private const string _urlPrefix = "URL:"; + private const string _csPrefix = "C#:"; + private const string _separator = "@"; + + public ButtonDrawer() { } + + public ButtonDrawer(string group) + { + this.group = group; + } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + inoutPropertyStaticData.groupName = group; + + // Display Name: ButtonName@URL:XXX@ButtonName@CS:NameSpace.Class.Method(arg0, arg1, ...)@... + var buttonNameAndCommands = inProp.displayName.Split(_separator); + if (buttonNameAndCommands != null && buttonNameAndCommands.Length > 0 && buttonNameAndCommands.Length % 2 == 0) + { + for (int i = 0; i < buttonNameAndCommands.Length; i++) + { + if (i % 2 == 0) + { + inoutPropertyStaticData.buttonDisplayNames.Add(buttonNameAndCommands[i]); + inoutPropertyStaticData.buttonDisplayNameWidths.Add(EditorStyles.label.CalcSize(new GUIContent(buttonNameAndCommands[i])).x); + } + else + { + inoutPropertyStaticData.buttonCommands.Add(buttonNameAndCommands[i]); + } + } + } + else + { + Debug.LogError($"LWGUI: ButtonDrawer with invalid Display Name Commands: { buttonNameAndCommands } ! prop: { inProp.name }"); + } + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + var buttonDisplayNames = metaDatas.GetPropStaticData(prop).buttonDisplayNames; + var buttonDisplayNameWidths = metaDatas.GetPropStaticData(prop).buttonDisplayNameWidths; + var buttonCommands = metaDatas.GetPropStaticData(prop).buttonCommands; + if (buttonDisplayNames == null || buttonCommands == null || buttonDisplayNames.Count == 0 || buttonCommands.Count == 0 + || buttonDisplayNames.Count != buttonCommands.Count) + { + return; + } + + var enbaled = GUI.enabled; + GUI.enabled = true; + + position = EditorGUI.IndentedRect(position); + var rect = new Rect(position.x, position.y, 0, position.height); + var spaceWidth = (position.width - buttonDisplayNameWidths.Sum()) / buttonDisplayNames.Count; + + for (int i = 0; i < buttonDisplayNames.Count; i++) + { + var displayName = buttonDisplayNames[i]; + var displayNameRelativeWidth = buttonDisplayNameWidths[i]; + var command = buttonCommands[i]; + rect.xMax = rect.xMin + displayNameRelativeWidth + spaceWidth; + + if (GUI.Button(rect, new GUIContent(displayName, command))) + { + if (command.StartsWith(_urlPrefix)) + { + Application.OpenURL(command.Substring(_urlPrefix.Length, command.Length - _urlPrefix.Length)); + } + else if (command.StartsWith(_csPrefix)) + { + var csCommand = command.Substring(_csPrefix.Length, command.Length - _csPrefix.Length); + + // Get method name and args + string className = null, methodName = null; + string[] args = null; + { + var lastPointIndex = csCommand.LastIndexOf('.'); + if (lastPointIndex != -1) + { + className = csCommand.Substring(0, lastPointIndex); + var leftBracketIndex = csCommand.IndexOf('('); + if (leftBracketIndex != -1) + { + methodName = csCommand.Substring(lastPointIndex + 1, leftBracketIndex - lastPointIndex - 1); + args = csCommand.Substring(leftBracketIndex + 1, csCommand.Length - leftBracketIndex - 2) + ?.Split(',').Select(s => s.TrimStart()).ToArray(); + } + } + } + + // Find and call method + if (!string.IsNullOrEmpty(className) && !string.IsNullOrEmpty(methodName) && args != null) + { + Type type = ReflectionHelper.GetAllTypes().FirstOrDefault((type1 => type1.Name == className || type1.FullName == className)); + if (type != null) + { + var methodInfo = type.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public); + if (methodInfo != null) + { + methodInfo.Invoke(null, new object[]{ prop, editor, metaDatas, args }); + } + else + { + Debug.LogError($"LWGUI: Method {methodName} not found in {className}"); + } + } + else + { + Debug.LogError($"LWGUI: Class {className} not found"); + } + } + else + { + Debug.LogError($"LWGUI: Invalid C# command: {csCommand}"); + } + } + else + { + Debug.LogError($"LWGUI: Unknown command type: {command}"); + } + } + + rect.xMin = rect.xMax; + } + + GUI.enabled = enbaled; + } + + public static void TestMethod(MaterialProperty prop, MaterialEditor editor, LWGUIMetaDatas metaDatas, string[] args) + { + Debug.Log($"LWGUI: ButtonDrawer.TestMethod({prop}, {editor}, {metaDatas}, {args})"); + + foreach (var arg in args) + { + Debug.Log(arg); + } + } + } /// /// Similar to Header() diff --git a/README.md b/README.md index 48edf97..812c378 100644 --- a/README.md +++ b/README.md @@ -343,10 +343,9 @@ Result: #### Image ```c# -/// Draw a read only texture preview. Select the default texture to be displayed in the shader import settings. -/// Note: Selected default textures will always be excluded from the build!!! +/// Draw an image preview. +/// display name: The path of the image file relative to the Unity project, such as: "Assets/test.png", "Doc/test.png", "../test.png" /// group:father group name, support suffix keyword for conditional display (Default: none) -/// Target Property Type: Texture public ImageDrawer() { } public ImageDrawer(string group) ``` @@ -451,7 +450,7 @@ Default display settings can be set using the LwguiGradientUsage() Attribute. The new LWGUI Gradient Editor integrates with Unity's built-in [Gradient Editor](https://docs.unity3d.com/Manual/EditingValueProperties.html) and [Curve Editor](https://docs.unity3d.com/Manual/EditingCurves.html), enabling more powerful features than UE's Gradient Editor. -![image-20241126110012922](./assets/image-20241126110012922.png) +![image-20241126110012922](./README_CN.assets/image-20241126110012922.png) | Editor | Description | | --------------------- | ------------------------------------------------------------ | @@ -464,7 +463,7 @@ The new LWGUI Gradient Editor integrates with Unity's built-in [Gradient Editor] | Curve Editor | Similar to Unity's built-in Curve Editor, it displays the XY 0-1 range by default, and you can use the scroll wheel to zoom or move the display range.
As you can see in the image below, the context menu has a number of functions for controlling the shape of the curve, and you can consult the [Unity documentation](https://docs.unity3d.com/Manual/EditingCurves.html) to get the most out of these functions. | | Presets | You can save the current LWGUI Gradient as a preset and apply it anytime. These presets are common between different engine versions on the local computer, but are not saved to the project. | -![image-20241126105823397](./assets/image-20241126105823397.png)![image-20241126112320151](./assets/image-20241126112320151.png) +![image-20241126105823397](./README_CN.assets/image-20241126105823397.png)![image-20241126112320151](./README_CN.assets/image-20241126112320151.png) @@ -526,6 +525,40 @@ The Property Value in the selected Preset will be the default value +#### Button + +```c# +/// Draw one or more Buttons within the same row, using the Display Name to control the appearance and behavior of the buttons +/// +/// Declaring a set of Button Name and Button Command in Display Name generates a Button, separated by '@': +/// ButtonName0@ButtonCommand0@ButtonName1@ButtonCommand1 +/// +/// Button Name can be any other string, the format of Button Command is: +/// TYPE:Argument +/// +/// The following TYPEs are currently supported: +/// - URL: Open the URL, Argument is the URL +/// - C#: Call the public static C# function, Argument is NameSpace.Class.Method(arg0, arg1, ...), +/// for target function signatures, see: LWGUI.ButtonDrawer.TestMethod(). +/// +/// The full example: +/// [Button(_)] _button0 ("URL Button@URL:https://github.com/JasonMa0012/LWGUI@C#:LWGUI.ButtonDrawer.TestMethod(1234, abcd)", Float) = 0 +/// +/// group:father group name, support suffix keyword for conditional display (Default: none) +public ButtonDrawer() { } +public ButtonDrawer(string group) +``` + +Example: + +```c# +[Title(Button Samples)] +[Button(_)] _button0 ("URL Button@URL:https://github.com/JasonMa0012/LWGUI@C# Button@C#:LWGUI.ButtonDrawer.TestMethod(1234, abcd)", Float) = 0 + +``` + +![image-20241127180711449](./README_CN.assets/image-20241127180711449.png) + ### LWGUI Decorator diff --git a/README_CN.assets/image-20240416142736663.png b/README_CN.assets/image-20240416142736663.png index aa7c6c7..9f2fee3 100644 Binary files a/README_CN.assets/image-20240416142736663.png and b/README_CN.assets/image-20240416142736663.png differ diff --git a/assets/image-20241126105823397.png b/README_CN.assets/image-20241126105823397.png similarity index 100% rename from assets/image-20241126105823397.png rename to README_CN.assets/image-20241126105823397.png diff --git a/README_CN.assets/image-20241126105823397.png.meta b/README_CN.assets/image-20241126105823397.png.meta new file mode 100644 index 0000000..b12aa1f --- /dev/null +++ b/README_CN.assets/image-20241126105823397.png.meta @@ -0,0 +1,153 @@ +fileFormatVersion: 2 +guid: 0b6df23f9d012a74abed6b4f422d9442 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: 25 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: 50 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: 50 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: VisionOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/assets/image-20241126110012922.png b/README_CN.assets/image-20241126110012922.png similarity index 100% rename from assets/image-20241126110012922.png rename to README_CN.assets/image-20241126110012922.png diff --git a/README_CN.assets/image-20241126110012922.png.meta b/README_CN.assets/image-20241126110012922.png.meta new file mode 100644 index 0000000..ea662b6 --- /dev/null +++ b/README_CN.assets/image-20241126110012922.png.meta @@ -0,0 +1,153 @@ +fileFormatVersion: 2 +guid: cc772ea50f72a6e44b0f6190010a6424 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: 25 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: 50 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: 50 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: VisionOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/assets/image-20241126112320151.png b/README_CN.assets/image-20241126112320151.png similarity index 100% rename from assets/image-20241126112320151.png rename to README_CN.assets/image-20241126112320151.png diff --git a/README_CN.assets/image-20241126112320151.png.meta b/README_CN.assets/image-20241126112320151.png.meta new file mode 100644 index 0000000..025a4ea --- /dev/null +++ b/README_CN.assets/image-20241126112320151.png.meta @@ -0,0 +1,153 @@ +fileFormatVersion: 2 +guid: c387c6327985b4f419caee4e22ffbb9b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: 25 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: 50 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: 50 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: VisionOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/README_CN.assets/image-20241127180711449.png b/README_CN.assets/image-20241127180711449.png new file mode 100644 index 0000000..bcb036b Binary files /dev/null and b/README_CN.assets/image-20241127180711449.png differ diff --git a/README_CN.assets/image-20241127180711449.png.meta b/README_CN.assets/image-20241127180711449.png.meta new file mode 100644 index 0000000..4e548a2 --- /dev/null +++ b/README_CN.assets/image-20241127180711449.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: b307e0433bc4e724180c49d205d9060e +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/README_CN.md b/README_CN.md index dabcd04..0655c99 100644 --- a/README_CN.md +++ b/README_CN.md @@ -342,10 +342,9 @@ Result: #### Image ```c# -/// Draw a read only texture preview. Select the default texture to be displayed in the shader import settings. -/// Note: Selected default textures will always be excluded from the build!!! +/// Draw an image preview. +/// display name: The path of the image file relative to the Unity project, such as: "Assets/test.png", "Doc/test.png", "../test.png" /// group:father group name, support suffix keyword for conditional display (Default: none) -/// Target Property Type: Texture public ImageDrawer() { } public ImageDrawer(string group) ``` @@ -449,7 +448,7 @@ Result: 新的LWGUI Gradient Editor集成了Unity内置的[Gradient Editor](https://docs.unity3d.com/Manual/EditingValueProperties.html)和[Curve Editor](https://docs.unity3d.com/Manual/EditingCurves.html), 实现了比UE的Gradient Editor更加强大的功能. -![image-20241126110012922](./assets/image-20241126110012922.png) +![image-20241126110012922](./README_CN.assets/image-20241126110012922.png) | 编辑器 | 解释 | | --------------------- | ------------------------------------------------------------ | @@ -462,7 +461,7 @@ Result: | Curve Editor | 类似于Unity内置的Curve Editor, 默认显示XY 0-1的范围, 你可以用滚轮缩放或移动显示范围.
如下图所示, 右键菜单中有大量控制曲线形态的功能, 你可以查阅[Unity文档](https://docs.unity3d.com/Manual/EditingCurves.html)以充分利用这些功能. | | Presets | 你可以保存当前LWGUI Gradient为预设, 并随时调用这些预设. 这些预设在本地计算机的不同引擎版本之间通用, 但不会保存到项目中. | -![image-20241126105823397](./assets/image-20241126105823397.png)![image-20241126112320151](./assets/image-20241126112320151.png) +![image-20241126105823397](./README_CN.assets/image-20241126105823397.png)![image-20241126112320151](./README_CN.assets/image-20241126112320151.png) **已知问题:** @@ -520,6 +519,40 @@ Result: ![image-20221122232354623](README_CN.assets/image-20221122232354623.png)![image-20221122232415972](README_CN.assets/image-20221122232415972.png)![image-20221122232425194](README_CN.assets/image-20221122232425194.png) +#### Button + +```c# +/// Draw one or more Buttons within the same row, using the Display Name to control the appearance and behavior of the buttons +/// +/// Declaring a set of Button Name and Button Command in Display Name generates a Button, separated by '@': +/// ButtonName0@ButtonCommand0@ButtonName1@ButtonCommand1 +/// +/// Button Name can be any other string, the format of Button Command is: +/// TYPE:Argument +/// +/// The following TYPEs are currently supported: +/// - URL: Open the URL, Argument is the URL +/// - C#: Call the public static C# function, Argument is NameSpace.Class.Method(arg0, arg1, ...), +/// for target function signatures, see: LWGUI.ButtonDrawer.TestMethod(). +/// +/// The full example: +/// [Button(_)] _button0 ("URL Button@URL:https://github.com/JasonMa0012/LWGUI@C#:LWGUI.ButtonDrawer.TestMethod(1234, abcd)", Float) = 0 +/// +/// group:father group name, support suffix keyword for conditional display (Default: none) +public ButtonDrawer() { } +public ButtonDrawer(string group) +``` + +Example: + +```c# +[Title(Button Samples)] +[Button(_)] _button0 ("URL Button@URL:https://github.com/JasonMa0012/LWGUI@C# Button@C#:LWGUI.ButtonDrawer.TestMethod(1234, abcd)", Float) = 0 + +``` + +![image-20241127180711449](./README_CN.assets/image-20241127180711449.png) + ### LWGUI Decorator diff --git a/Test/LWGUI_SampleDrawer 1.mat b/Test/LWGUI_SampleDrawer 1.mat index e63a365..25da097 100644 --- a/Test/LWGUI_SampleDrawer 1.mat +++ b/Test/LWGUI_SampleDrawer 1.mat @@ -9,16 +9,20 @@ Material: m_PrefabAsset: {fileID: 0} m_Name: LWGUI_SampleDrawer 1 m_Shader: {fileID: 4800000, guid: 7ee048c9536c0344bb8b4860595a4d9b, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 m_ValidKeywords: [] m_InvalidKeywords: - _GROUP_ON - _KEY2 + - _KEY3 m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 m_CustomRenderQueue: 3000 stringTagMap: {} disabledShaderPasses: [] + m_LockedProperties: m_SavedProperties: serializedVersion: 3 m_TexEnvs: diff --git a/Test/RampMap_sRGB.png.meta b/Test/RampMap_sRGB.png.meta index 44c48f0..c33ff11 100644 --- a/Test/RampMap_sRGB.png.meta +++ b/Test/RampMap_sRGB.png.meta @@ -122,6 +122,6 @@ TextureImporter: nameFileIdTable: {} mipmapLimitGroupName: pSDRemoveMatte: 0 - userData: '{"MonoBehaviour":{"m_Enabled":true,"m_EditorHideFlags":0,"m_Name":"","m_EditorClassIdentifier":"","gradient":{"serializedVersion":"2","key0":{"r":0.0,"g":0.0,"b":0.0,"a":1.0},"key1":{"r":1.0,"g":1.0,"b":1.0,"a":1.0},"key2":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"key3":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"key4":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"key5":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"key6":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"key7":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"ctime0":0,"ctime1":65535,"ctime2":0,"ctime3":0,"ctime4":0,"ctime5":0,"ctime6":0,"ctime7":0,"atime0":0,"atime1":65535,"atime2":0,"atime3":0,"atime4":0,"atime5":0,"atime6":0,"atime7":0,"m_Mode":0,"m_ColorSpace":0,"m_NumColorKeys":2,"m_NumAlphaKeys":2}}}#{"MonoBehaviour":{"m_Enabled":true,"m_EditorHideFlags":0,"m_Name":"","m_EditorClassIdentifier":"","gradient":{"serializedVersion":"2","key0":{"r":0.0,"g":0.0,"b":0.0,"a":1.0},"key1":{"r":1.0,"g":1.0,"b":1.0,"a":1.0},"key2":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"key3":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"key4":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"key5":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"key6":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"key7":{"r":0.0,"g":0.0,"b":0.0,"a":0.0},"ctime0":0,"ctime1":65535,"ctime2":0,"ctime3":0,"ctime4":0,"ctime5":0,"ctime6":0,"ctime7":0,"atime0":0,"atime1":65535,"atime2":0,"atime3":0,"atime4":0,"atime5":0,"atime6":0,"atime7":0,"m_Mode":0,"m_ColorSpace":0,"m_NumColorKeys":2,"m_NumAlphaKeys":2}}}' + userData: '{"_curves":[{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":0.0,"inSlope":0.0,"outSlope":1.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":1.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":0.0,"inSlope":0.0,"outSlope":1.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":1.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":0.0,"inSlope":0.0,"outSlope":1.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":1.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4}]}#{"_curves":[{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.19993001222610475,"value":0.25,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3509286344051361,"value":0.713207483291626,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.4040227234363556,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.711692214012146,"inSlope":1.9705389738082886,"outSlope":1.9705389738082886,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.19993001222610475,"value":0.25,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3509286344051361,"value":0.6254975199699402,"inSlope":1.174917459487915,"outSlope":1.174917459487915,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.7129190564155579,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.46618008613586428,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.19993001222610475,"value":0.25,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3509286344051361,"value":0.38082584738731387,"inSlope":1.6324135065078736,"outSlope":1.6324135065078736,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.7358490228652954,"inSlope":1.55451500415802,"outSlope":1.55451500415802,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.849056601524353,"inSlope":0.8733886480331421,"outSlope":0.8733886480331421,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.20000000298023225,"value":0.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3499511182308197,"value":0.13333334028720857,"inSlope":1.2060123682022095,"outSlope":1.2060123682022095,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4}]}' assetBundleName: assetBundleVariant: diff --git a/Test/SampleDrawer 1.shader b/Test/SampleDrawer 1.shader index f521617..19a2de2 100644 --- a/Test/SampleDrawer 1.shader +++ b/Test/SampleDrawer 1.shader @@ -36,7 +36,7 @@ [Advanced][Tex(Group2, _AdvancedColor0)] _AdvancedTex1 ("Advanced Tex 1", 2D) = "white" { } [Advanced][HideInInspector] _AdvancedColor0 ("Advanced Color 0", Color) = (1, 1, 1, 1) [AdvancedHeaderProperty][Sub(Group2)] _AdvancedFloat ("Advanced Image", float) = 0 - [Advanced][Image(Group2)] _AdvancedImage ("Advanced Image", 2D) = "white" { } + [Advanced][Image(Group2)] _AdvancedImage ("../image-20220828003810353.png", float) = 0 [Title(Channel Samples)] [Channel] _textureChannelMask ("Texture Channel Mask (Default G)", Vector) = (0, 1, 0, 0) @@ -76,6 +76,9 @@ [MinMaxSlider(_rangeStart, _rangeEnd)] _minMaxSlider ("Min Max Slider (0 - 1)", Range(0.0, 1.0)) = 1.0 _rangeStart ("Range Start", Range(0.0, 0.5)) = 0.0 [PowerSlider(10)] _rangeEnd ("Range End PowerSlider", Range(0.5, 1.0)) = 1.0 + + [Title(Button Samples)] + [Button(_)] _button0 ("URL Button@URL:https://github.com/JasonMa0012/LWGUI@C# Button@C#:LWGUI.ButtonDrawer.TestMethod(1234, abcd)", Float) = 0 } HLSLINCLUDE diff --git a/package.json b/package.json index e18fca5..474aead 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.jasonma.lwgui", - "version": "1.19.5", + "version": "1.20.0", "displayName": "LWGUI", "description": "A Lightweight, Flexible, Powerful Shader GUI System for Unity.", "keywords": [