diff --git a/package/Editor/Images/Images.cs b/package/Editor/Images/Images.cs index 0d95b4b..4a62033 100644 --- a/package/Editor/Images/Images.cs +++ b/package/Editor/Images/Images.cs @@ -18,13 +18,18 @@ public class Images : EditorWindow /// private static string lastPageToken = string.Empty; + private static bool isVisible = false; + [MenuItem("Window/Scenario/Images")] public static void ShowWindow() { + if (isVisible) + return; + lastPageToken = string.Empty; imageDataList.Clear(); GetInferencesData(); - + var images = (Images)GetWindow(typeof(Images)); ImagesUI.Init(images); } @@ -37,8 +42,19 @@ private void OnGUI() private void OnDestroy() { ImagesUI.CloseSelectedTextureSection(); + DataCache.instance.ClearAllImageData(); } - + + private void OnBecameVisible() + { + isVisible = true; + } + + private void OnBecameInvisible() + { + isVisible = false; + } + public static void GetInferencesData(Action callback_OnDataGet = null) //why get inferences instead of getting the assets ?? { string request = $"inferences"; diff --git a/package/Editor/Images/ImagesUI.cs b/package/Editor/Images/ImagesUI.cs index b263113..4afd850 100644 --- a/package/Editor/Images/ImagesUI.cs +++ b/package/Editor/Images/ImagesUI.cs @@ -190,7 +190,6 @@ public void OnGUI(Rect _dimension) Images.GetInferencesData( () => { isLoading = false; - images.Repaint(); }); } } diff --git a/package/Editor/_Services/DataCache.cs b/package/Editor/_Services/DataCache.cs index a76b53f..0b89752 100644 --- a/package/Editor/_Services/DataCache.cs +++ b/package/Editor/_Services/DataCache.cs @@ -81,7 +81,6 @@ public void FillReservedSpaceForImageData(string inferenceId, string id, string CommonUtils.FetchTextureFromURL(itm.Url, texture => { itm.texture = texture; - RemoveImageDataAtIndex(GetImageDataIndexByUrl(itm.Url)); }); } diff --git a/package/Editor/_Services/PromptFetcher.cs b/package/Editor/_Services/PromptFetcher.cs index c37943e..ea135af 100644 --- a/package/Editor/_Services/PromptFetcher.cs +++ b/package/Editor/_Services/PromptFetcher.cs @@ -36,10 +36,9 @@ public static void PostInferenceRequest(string inputData, int imagesliderIntValu guidancesliderValue, "Default", seedinputText); - - Images.ShowWindow(); GetInferenceStatus(inferenceId, modelId); + Images.ShowWindow(); }); }