From 194608707321046bf11c358500131b2547287bbb Mon Sep 17 00:00:00 2001 From: Ludovic LEROUGE - TheRed Games Date: Mon, 4 Mar 2024 10:44:49 +0100 Subject: [PATCH 1/3] fix: loading image on first generation Call a refresh of the image window to display first generation of images. --- package/Editor/Images/Images.cs | 20 ++++++++++++-------- package/Editor/_Services/PromptFetcher.cs | 2 ++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/package/Editor/Images/Images.cs b/package/Editor/Images/Images.cs index f398482..0a96f2a 100644 --- a/package/Editor/Images/Images.cs +++ b/package/Editor/Images/Images.cs @@ -24,21 +24,25 @@ public class Images : EditorWindow public static void ShowWindow() { if (isVisible) - return; - - lastPageToken = string.Empty; - imageDataList.Clear(); - GetInferencesData(); + { + GetInferencesData(); + } + else + { + lastPageToken = string.Empty; + imageDataList.Clear(); + GetInferencesData(); - var images = (Images)GetWindow(typeof(Images)); - ImagesUI.Init(images); + var images = (Images)GetWindow(typeof(Images)); + ImagesUI.Init(images); + } } private void OnGUI() { ImagesUI.OnGUI(this.position); } - + private void OnDestroy() { ImagesUI.OnClose(); diff --git a/package/Editor/_Services/PromptFetcher.cs b/package/Editor/_Services/PromptFetcher.cs index e929ef6..810928d 100644 --- a/package/Editor/_Services/PromptFetcher.cs +++ b/package/Editor/_Services/PromptFetcher.cs @@ -90,6 +90,8 @@ private static async void GetInferenceStatus(string inferenceId, string modelId) inferenceStatusRoot.inference.createdAt, img.Seed); } + + Images.ShowWindow(); } }); } From b54573094a2c7f05d0e2a78e34cd2e8941278733 Mon Sep 17 00:00:00 2001 From: Ludovic LEROUGE - TheRed Games Date: Mon, 4 Mar 2024 13:36:07 +0100 Subject: [PATCH 2/3] fix: Reload display on compilation or close/open unity --- package/Editor/Images/Images.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/Editor/Images/Images.cs b/package/Editor/Images/Images.cs index 0a96f2a..5e64bde 100644 --- a/package/Editor/Images/Images.cs +++ b/package/Editor/Images/Images.cs @@ -43,6 +43,11 @@ private void OnGUI() ImagesUI.OnGUI(this.position); } + private void OnEnable() + { + ShowWindow(); + } + private void OnDestroy() { ImagesUI.OnClose(); From 61520ab7ec329d47a1be24a5b93ad025ef3a4658 Mon Sep 17 00:00:00 2001 From: Ludovic LEROUGE - TheRed Games Date: Mon, 4 Mar 2024 13:44:09 +0100 Subject: [PATCH 3/3] fix: Simplify ShowWindow to display and refresh Image Display --- package/Editor/Images/Images.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/package/Editor/Images/Images.cs b/package/Editor/Images/Images.cs index 5e64bde..5b3876d 100644 --- a/package/Editor/Images/Images.cs +++ b/package/Editor/Images/Images.cs @@ -23,19 +23,15 @@ public class Images : EditorWindow [MenuItem("Window/Scenario/Images")] public static void ShowWindow() { - if (isVisible) - { - GetInferencesData(); - } - else + if (!isVisible) { lastPageToken = string.Empty; imageDataList.Clear(); - GetInferencesData(); - - var images = (Images)GetWindow(typeof(Images)); - ImagesUI.Init(images); } + GetInferencesData(); + + var images = (Images)GetWindow(typeof(Images)); + ImagesUI.Init(images); } private void OnGUI()