From dd84423cd13cac6477247a40cd4fe82402ce24b4 Mon Sep 17 00:00:00 2001 From: Won-Kyu Park Date: Fri, 15 Sep 2023 18:43:59 +0900 Subject: [PATCH] xyz_grid: add raw_mode --- scripts/xyz_grid.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py index 939d86053bd..2412850e395 100644 --- a/scripts/xyz_grid.py +++ b/scripts/xyz_grid.py @@ -439,6 +439,7 @@ def ui(self, is_img2img): with gr.Column(): include_lone_images = gr.Checkbox(label='Include Sub Images', value=False, elem_id=self.elem_id("include_lone_images")) include_sub_grids = gr.Checkbox(label='Include Sub Grids', value=False, elem_id=self.elem_id("include_sub_grids")) + raw_mode = gr.Checkbox(label='Use raw text lines', value=False, elem_id=self.elem_id("raw_mode")) with gr.Column(): margin_size = gr.Slider(label="Grid margins (px)", minimum=0, maximum=500, value=0, step=2, elem_id=self.elem_id("margin_size")) with gr.Column(): @@ -521,9 +522,9 @@ def get_dropdown_update_from_params(axis, params): (z_values_dropdown, lambda params: get_dropdown_update_from_params("Z", params)), ) - return [x_type, x_values, x_values_dropdown, y_type, y_values, y_values_dropdown, z_type, z_values, z_values_dropdown, draw_legend, include_lone_images, include_sub_grids, no_fixed_seeds, margin_size, csv_mode] + return [x_type, x_values, x_values_dropdown, y_type, y_values, y_values_dropdown, z_type, z_values, z_values_dropdown, draw_legend, include_lone_images, include_sub_grids, no_fixed_seeds, margin_size, csv_mode, raw_mode] - def run(self, p, x_type, x_values, x_values_dropdown, y_type, y_values, y_values_dropdown, z_type, z_values, z_values_dropdown, draw_legend, include_lone_images, include_sub_grids, no_fixed_seeds, margin_size, csv_mode): + def run(self, p, x_type, x_values, x_values_dropdown, y_type, y_values, y_values_dropdown, z_type, z_values, z_values_dropdown, draw_legend, include_lone_images, include_sub_grids, no_fixed_seeds, margin_size, csv_mode, raw_mode): if not no_fixed_seeds: modules.processing.fix_seed(p) @@ -536,6 +537,8 @@ def process_axis(opt, vals, vals_dropdown): if opt.choices is not None and not csv_mode: valslist = vals_dropdown + elif raw_mode and vals.strip().find("\n") != -1: + valslist = vals.strip().split("\n") else: valslist = csv_string_to_list_strip(vals)