Skip to content

Commit

Permalink
Merge branch 'develop' into 109-isometric-building-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLLspectre committed Jun 3, 2024
2 parents e03071e + fd1cb0f commit 80c6f86
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 173 deletions.
3 changes: 2 additions & 1 deletion package/Editor/PromptWindow/PromptWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class PromptWindow : EditorWindow
[MenuItem("Window/Scenario/Prompt Window", false, 5)]
public static void ShowWindow()
{
GetWindow<PromptWindow>("Prompt Window");
var promptWindow = GetWindow<PromptWindow>("Prompt Window");
promptWindow.minSize = new Vector2(500, 750);
}

#region Static Methods
Expand Down
100 changes: 55 additions & 45 deletions package/Editor/PromptWindow/PromptWindowUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public partial class PromptWindowUI
/// <summary>
/// Reference all dimension values available for SD 1.5 models
/// </summary>
public readonly int[] allowed1_5DimensionValues = { 512, 576, 640, 688, 704, 768, 912, 1024 };
public readonly int[] allowed1_5DimensionValues = { 512, 576, 640, 688, 704, 768, 912 };

/// <summary>
/// Reference all dimension values available for SDXL models
/// </summary>
public readonly int[] allowedSDXLDimensionValues = { 1024, 1152, 1280, 1376, 1408, 1536, 1824, 2048 };
public readonly int[] allowedSDXLDimensionValues = { 1024, 1152, 1280, 1376, 1408, 1536, 1824 };

public string selectedPreset = "";

Expand Down Expand Up @@ -98,10 +98,14 @@ public partial class PromptWindowUI
internal string negativepromptinputText = "";
internal int widthSliderValue = 1024;
internal int heightSliderValue = 1024;
/// <summary>
/// Default slide value for the size slider
/// </summary>
internal float sizeSliderValue = 7;
internal float imagesliderValue = 4;
internal int imagesliderIntValue = 4;
internal int samplesliderValue = 30;
internal int influenceSliderValue = 80;
internal int influenceSliderValue = 25;
internal float guidancesliderValue = 7;
internal string postedModelName = "Choose Model";
internal string seedinputText = "";
Expand Down Expand Up @@ -204,60 +208,66 @@ public void Render(Rect position)
scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUIStyle.none);

promptPusher.modelName = selectedModelName;
EditorGUILayout.BeginVertical(EditorStyles.inspectorFullWidthMargins);
{
CustomStyle.ButtonSecondary(selectedModelName, 30, Models.ShowWindow);
CustomStyle.Separator();
RenderPromptSection();
CustomStyle.Space();
RenderNegativePromptSection();
CustomStyle.Separator();


bool shouldAutoGenerateSeed = imagesliderValue > 1;
if (shouldAutoGenerateSeed) { seedinputText = "-1"; }

CustomStyle.ButtonPrimary("Generate Image", 40, () =>
{
promptPusher.promptInput = SerializeTags(tags);
promptPusher.promptNegativeInput = SerializeTags(negativeTags);

EditorPrefs.SetString("postedModelName", DataCache.instance.SelectedModelId);

CustomStyle.ButtonSecondary(selectedModelName, 30, Models.ShowWindow);
CustomStyle.Separator();
RenderPromptSection();
CustomStyle.Space();
RenderNegativePromptSection();
CustomStyle.Separator();
if (shouldAutoGenerateSeed)
{
promptPusher.GenerateImage(null);
}
else
{
string seed = seedinputText;
if (seed == "-1") { seed = null; }
promptPusher.GenerateImage(seed);
}
});

bool shouldAutoGenerateSeed = imagesliderValue > 1;
if (shouldAutoGenerateSeed) { seedinputText = "-1"; }
CustomStyle.Space();

CustomStyle.ButtonPrimary("Generate Image", 40, 0, () =>
{
promptPusher.promptInput = SerializeTags(tags);
promptPusher.promptNegativeInput = SerializeTags(negativeTags);
RenderImageSettingsSection(shouldAutoGenerateSeed);

EditorPrefs.SetString("postedModelName", DataCache.instance.SelectedModelId);
GUI.enabled = true;

InferenceManager.SilenceMode = false;
CustomStyle.Space();

if (shouldAutoGenerateSeed)
List<string> tabLabels = new List<string>();

foreach (ECreationMode eMode in Enum.GetValues(typeof(ECreationMode)))
{
promptPusher.GenerateImage(null);
string eName = eMode.ToString("G").Replace("__", " + ").Replace("_", " ");
tabLabels.Add(eName);
}
else
{
string seed = seedinputText;
if (seed == "-1") { seed = null; }
promptPusher.GenerateImage(seed);
EditorGUILayout.BeginHorizontal(EditorStyles.inspectorFullWidthMargins);
{
GUILayout.Label("Mode: ", GUILayout.Width(labelWidth));
selectedMode = (ECreationMode)EditorGUILayout.Popup(imageControlTab, tabLabels.ToArray(), GUILayout.Width(sliderWidth));
}
});

CustomStyle.Space();

RenderImageSettingsSection(shouldAutoGenerateSeed);

GUI.enabled = true;
EditorGUILayout.EndHorizontal();

CustomStyle.Space();
imageControlTab = (int)selectedMode;
promptPusher.ActiveMode(imageControlTab);

List<string> tabLabels = new List<string>();

foreach (ECreationMode eMode in Enum.GetValues(typeof(ECreationMode)))
{
string eName = eMode.ToString("G").Replace("__", " + ").Replace("_", " ");
tabLabels.Add(eName);
ManageDrawMode();
}

selectedMode = (ECreationMode)EditorGUILayout.Popup("Mode: ", imageControlTab, tabLabels.ToArray());
imageControlTab = (int)selectedMode;
promptPusher.ActiveMode(imageControlTab);

ManageDrawMode();

EditorGUILayout.EndVertical();
GUILayout.EndScrollView();
}

Expand Down
Loading

0 comments on commit 80c6f86

Please sign in to comment.