diff --git a/package/Editor/Images/ImageDataClasses.cs b/package/Editor/Images/ImageDataClasses.cs index 9297ccd..1ad9c40 100644 --- a/package/Editor/Images/ImageDataClasses.cs +++ b/package/Editor/Images/ImageDataClasses.cs @@ -53,6 +53,7 @@ public class Parameters public int width { get; set; } public bool hideResults { get; set; } public string type { get; set; } + public string scheduler { get; set; } public string prompt { get; set; } public string negativePrompt { get; set; } public int height { get; set; } diff --git a/package/Editor/Images/Images.cs b/package/Editor/Images/Images.cs index 5b3876d..8299446 100644 --- a/package/Editor/Images/Images.cs +++ b/package/Editor/Images/Images.cs @@ -23,11 +23,12 @@ public class Images : EditorWindow [MenuItem("Window/Scenario/Images")] public static void ShowWindow() { - if (!isVisible) + if (isVisible) { - lastPageToken = string.Empty; - imageDataList.Clear(); + return; } + lastPageToken = string.Empty; + imageDataList.Clear(); GetInferencesData(); var images = (Images)GetWindow(typeof(Images)); @@ -41,7 +42,10 @@ private void OnGUI() private void OnEnable() { - ShowWindow(); + lastPageToken = string.Empty; + imageDataList.Clear(); + GetInferencesData(); + ImagesUI.Init(); } private void OnDestroy() @@ -93,7 +97,7 @@ public static void GetInferencesData(Action callback_OnDataGet = null) //why get Steps = inference.parameters.numInferenceSteps, Size = new Vector2(inference.parameters.width,inference.parameters.height), Guidance = inference.parameters.guidance, - Scheduler = "Default", //TODO : change this to reflect the scheduler used for creating this image + Scheduler = inference.parameters.scheduler, Seed = image.seed, CreatedAt = inference.createdAt, modelId = inference.modelId diff --git a/package/Editor/Images/ImagesUI.cs b/package/Editor/Images/ImagesUI.cs index 5edffbe..27cafd5 100644 --- a/package/Editor/Images/ImagesUI.cs +++ b/package/Editor/Images/ImagesUI.cs @@ -46,6 +46,14 @@ public void Init(Images _images) InitializeButtons(); } + /// + /// Re initialize the Image UI when it's already existing. + /// + public void Init() + { + InitializeButtons(); + } + #endregion @@ -339,7 +347,14 @@ private void DrawImageData() GUILayout.BeginHorizontal(); { CustomStyle.Label($"Guidance: {currentImageData.Guidance}"); - CustomStyle.Label($"Scheduler: {currentImageData.Scheduler}"); + if (string.IsNullOrEmpty(currentImageData.Scheduler)) + { + CustomStyle.Label($"Scheduler: Default"); + } + else + { + CustomStyle.Label($"Scheduler: {currentImageData.Scheduler}"); + } } GUILayout.EndHorizontal(); CustomStyle.Space(padding); diff --git a/package/Editor/_Services/DataCache.cs b/package/Editor/_Services/DataCache.cs index 767208e..85fea90 100644 --- a/package/Editor/_Services/DataCache.cs +++ b/package/Editor/_Services/DataCache.cs @@ -63,7 +63,16 @@ public void ClearAllImageData() return imageDataList.GetRange(firstIndex, count); } - public void FillReservedSpaceForImageData(string inferenceId, string id, string url, DateTime createdAt, string _seed) + /// + /// After inference ending, get image generated and fill the space reserved to it. + /// + /// Id of the Inference + /// Image Id + /// URL Image + /// Date of creation + /// Scheduler of the generation + /// Seed of the generation + public void FillReservedSpaceForImageData(string inferenceId, string id, string url, DateTime createdAt, string _scheduler, string _seed) { var itm = imageDataList.FirstOrDefault(x => { @@ -78,6 +87,7 @@ public void FillReservedSpaceForImageData(string inferenceId, string id, string itm.Id = id; itm.Url = url; itm.CreatedAt = createdAt; + itm.Scheduler = _scheduler; itm.Seed = _seed; CommonUtils.FetchTextureFromURL(itm.Url, texture => { diff --git a/package/Editor/_Services/PromptFetcher.cs b/package/Editor/_Services/PromptFetcher.cs index 810928d..a3bbda9 100644 --- a/package/Editor/_Services/PromptFetcher.cs +++ b/package/Editor/_Services/PromptFetcher.cs @@ -88,6 +88,7 @@ private static async void GetInferenceStatus(string inferenceId, string modelId) img.Id, img.Url, inferenceStatusRoot.inference.createdAt, + inferenceStatusRoot.inference.parameters.scheduler, img.Seed); } @@ -137,6 +138,7 @@ public class Parameters public int width { get; set; } public int height { get; set; } public string type { get; set; } + public string scheduler { get; set; } public string image { get; set; } public string prompt { get; set; } public string mask { get; set; }