clear GenerationParametersList before batch

clears any generation parameters that are with the attribute to_be_clear_before_batch = True
prevent buildup of some parameters
This commit is contained in:
w-e-w
2024-11-24 20:07:00 +09:00
parent 025080218f
commit ac8c05398b
2 changed files with 18 additions and 3 deletions

View File

@@ -308,9 +308,17 @@ class GenerationParametersList(list):
if return str, the value will be written to infotext, if return None will be ignored.
"""
def __init__(self, *args, to_be_clear_before_batch=True, **kwargs):
super().__init__(*args, **kwargs)
self._to_be_clear_before_batch = to_be_clear_before_batch
def __call__(self, *args, **kwargs):
return ', '.join(sorted(set(self), key=natural_sort_key))
@property
def to_be_clear_before_batch(self):
return self._to_be_clear_before_batch
def __add__(self, other):
if isinstance(other, GenerationParametersList):
return self.__class__([*self, *other])