From 0ab60b4ea093a4b7b796a66fbea47a441411362b Mon Sep 17 00:00:00 2001 From: Jason Ma <1312119064@qq.com> Date: Fri, 18 Oct 2024 17:05:44 +0800 Subject: [PATCH] Fix Context Menu Event in Ramp Editor --- .../LwguiGradientEditor/LwguiGradientEditor.cs | 15 ++++++++++++--- package.json | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/UnityEditorExtension/LwguiGradientEditor/LwguiGradientEditor.cs b/UnityEditorExtension/LwguiGradientEditor/LwguiGradientEditor.cs index 6c8a414..7b6c7de 100644 --- a/UnityEditorExtension/LwguiGradientEditor/LwguiGradientEditor.cs +++ b/UnityEditorExtension/LwguiGradientEditor/LwguiGradientEditor.cs @@ -690,7 +690,11 @@ private void InitCurveEditor(bool force = false) } _curveEditor.animationCurves = cws; - _curveEditor.curvesUpdated = () => _curveEditorContextMenuChanged = true; + _curveEditor.curvesUpdated = () => + { + _curveEditorContextMenuChanged = true; + Debug.Log(111111111); + }; SyncCurveEditorRect(); @@ -709,10 +713,15 @@ private void OnCurveEditorGUI() PrepareSyncSelectionFromCurveToGradient(); EditorGUI.BeginChangeCheck(); _curveEditor.OnGUI(); - _changed |= EditorGUI.EndChangeCheck() || _curveEditorContextMenuChanged; - if (_changed) + bool curveEditorChanged = EditorGUI.EndChangeCheck() || _curveEditorContextMenuChanged; + _changed |= curveEditorChanged; + if (curveEditorChanged) { InitGradientEditor(true); + foreach (var cw in _curveEditor.animationCurves) + { + cw.changed = false; + } _curveEditorContextMenuChanged = false; } SyncSelectionFromCurveToGradient(); diff --git a/package.json b/package.json index eab7deb..aa3f82a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.jasonma.lwgui", - "version": "1.19.1", + "version": "1.19.2", "displayName": "LWGUI", "description": "A Lightweight, Flexible, Powerful Shader GUI System for Unity.", "keywords": [