feat: Add option to sort XYZ plot alphabetically

This commit is contained in:
YSH 2024-08-31 16:28:52 -07:00
parent d5e26274c8
commit d1a262eeea
2 changed files with 6 additions and 1 deletions

View file

@ -417,7 +417,11 @@ class Script(scripts.Script):
return "X/Y/Z plot"
def ui(self, is_img2img):
self.current_axis_options = [x for x in axis_options if type(x) == AxisOption or x.is_img2img == is_img2img]
_axis_options = copy(axis_options)
if opts.xyz_plot_sort_alphabetical:
_axis_options.sort(key=lambda x: (x.label != "Nothing", x.label)) # Sort by label, but keep "Nothing" first
self.current_axis_options = [x for x in _axis_options if type(x) == AxisOption or x.is_img2img == is_img2img]
with gr.Row():
with gr.Column(scale=19):