Skip to content

Commit

Permalink
Merge pull request #58 from JasonMa0012/2.x
Browse files Browse the repository at this point in the history
Fix LwguiGradientPresetLibrary changed event
  • Loading branch information
JasonMa0012 authored Aug 9, 2024
2 parents 3ca75b0 + a0ada9e commit 46398cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions Runtime/LwguiGradient/LwguiGradient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,13 @@ public void Clear(ChannelMask channelMask = ChannelMask.All)

public void DeepCopyFrom(LwguiGradient src)
{
_curves = new List<AnimationCurve>();
for (int c = 0; c < (int)Channel.Num; c++)
_curves.Add(new AnimationCurve());
{
if (_curves.Count == c)
_curves.Add(new AnimationCurve());

_curves[c].keys = new Keyframe[0];
}

for (int c = 0; c < src._curves.Count; c++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public static void UpdateCurrentGradient(LwguiGradient newGradient, bool doDeepC
// Debug.Log("Update");
_lwguiGradientWindow.Init();
_lwguiGradientWindow.Repaint();
GUI.changed = true;
}

private static LwguiGradientWindow GetWindow(bool focus = true) => (LwguiGradientWindow)GetWindow(typeof(LwguiGradientWindow), true, "LWGUI Gradient Editor", focus);
Expand Down Expand Up @@ -259,6 +260,7 @@ private void Clear()
{
_lwguiGradientEditor = null;
_lwguiGradientWindow = null;
_lwguiGradientLibraryEditor = null;
}

private void RegisterEvents()
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.18.3",
"version": "1.18.4",
"displayName": "LWGUI",
"description": "A Lightweight, Flexible, Powerful Shader GUI System for Unity.",
"keywords": [
Expand Down

0 comments on commit 46398cd

Please sign in to comment.