diff --git a/CHANGELOG.md b/CHANGELOG.md index e800e47ff..c059dc4a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ - Video: add FasterCache and PAB support to WanDB and LTX models - Progress: add additional fields to progress API - Progress: use batch-count for progress +- Grid: add of max-rows and max-columns in settings to control grid format +- Gallery: add max-columns in settings for gradio gallery components +- Styles: resize and bring quick-ui to forward on hover ## Update for 2025-04-03 diff --git a/extensions-builtin/sdnext-modernui b/extensions-builtin/sdnext-modernui index 9bed415dc..777f6bdca 160000 --- a/extensions-builtin/sdnext-modernui +++ b/extensions-builtin/sdnext-modernui @@ -1 +1 @@ -Subproject commit 9bed415dccad1041e0573134d2f214e40bd310f1 +Subproject commit 777f6bdca27abe39cbfe050f83cbd5bd71f8f84a diff --git a/javascript/sdnext.css b/javascript/sdnext.css index 5ffc03d36..8b52b1a47 100644 --- a/javascript/sdnext.css +++ b/javascript/sdnext.css @@ -148,6 +148,7 @@ div#extras_scale_to_tab div.form { flex-direction: row; } #txt2img_prompt, #txt2img_neg_prompt, #img2img_prompt, #img2img_neg_prompt, #control_prompt, #control_neg_prompt, #video_prompt, #video_neg_prompt { background-color: var(--background-color); box-shadow: none !important; } #txt2img_prompt > label > textarea, #txt2img_neg_prompt > label > textarea, #img2img_prompt > label > textarea, #img2img_neg_prompt > label > textarea, #control_prompt > label > textarea, #control_neg_prompt > label > textarea, #video_prompt > label > textarea, #video_neg_prompt > label > textarea { font-size: 1.0em; line-height: 1.4em; } #txt2img_styles, #img2img_styles, #control_styles, #video_styles { padding: 0; margin-top: 2px; } +#txt2img_styles:hover, #img2img_styles:hover, #control_styles:hover, #video_styles:hover { z-index: 1000; } #txt2img_styles_refresh, #img2img_styles_refresh, #control_styles_refresh, #video_styles_refresh { padding: 0; margin-top: 1em; } /* settings */ diff --git a/modules/images_grid.py b/modules/images_grid.py index a7f10396e..262440f75 100644 --- a/modules/images_grid.py +++ b/modules/images_grid.py @@ -19,24 +19,40 @@ def check_grid_size(imgs): return ok -def get_grid_size(imgs, batch_size=1, rows=None): - if rows is None: +def get_grid_size(imgs, batch_size=1, rows=None, cols=None): + if rows and rows > len(imgs): + rows = len(imgs) + if cols and cols > len(imgs): + cols = len(imgs) + if rows is None and cols is None: if shared.opts.n_rows > 0: rows = shared.opts.n_rows + cols = math.ceil(len(imgs) / rows) elif shared.opts.n_rows == 0: rows = batch_size + cols = math.ceil(len(imgs) / rows) + elif shared.opts.n_cols > 0: + cols = shared.opts.n_cols + rows = math.ceil(len(imgs) / cols) + elif shared.opts.n_cols == 0: + cols = batch_size + rows = math.ceil(len(imgs) / cols) else: rows = math.floor(math.sqrt(len(imgs))) while len(imgs) % rows != 0: rows -= 1 - if rows > len(imgs): - rows = len(imgs) - cols = math.ceil(len(imgs) / rows) + cols = math.ceil(len(imgs) / rows) + elif cols is None: + cols = math.ceil(len(imgs) / rows) + elif rows is None: + rows = math.ceil(len(imgs) / cols) + else: + pass return rows, cols -def image_grid(imgs, batch_size=1, rows=None): - rows, cols = get_grid_size(imgs, batch_size, rows=rows) +def image_grid(imgs, batch_size:int=1, rows:int=None, cols:int=None): + rows, cols = get_grid_size(imgs, batch_size, rows=rows, cols=cols) params = script_callbacks.ImageGridLoopParams(imgs, cols, rows) script_callbacks.image_grid_callback(params) imgs = [i for i in imgs if i is not None] if imgs is not None else [] diff --git a/modules/processing.py b/modules/processing.py index 2728903a2..619b544dc 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -455,7 +455,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed: p.color_corrections = None index_of_first_image = 0 - if (shared.opts.return_grid or shared.opts.grid_save) and not p.do_not_save_grid and len(output_images) > 1: + if (shared.opts.return_grid or shared.opts.grid_save) and (not p.do_not_save_grid) and (len(output_images) > 1): if images.check_grid_size(output_images): r, c = images.get_grid_size(output_images, p.batch_size) grid = images.image_grid(output_images, p.batch_size) diff --git a/modules/shared.py b/modules/shared.py index 1db4c2935..8e84c71eb 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -677,7 +677,8 @@ options_templates.update(options_section(('saving-images', "Image Options"), { "image_sep_grid": OptionInfo("