fix control handling of init images

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-07-18 07:31:59 -04:00
parent efd86ef901
commit ee57eb6b45
2 changed files with 4 additions and 6 deletions
+1
View File
@@ -369,6 +369,7 @@ def control_run(state: str = '', # pylint: disable=keyword-arg-before-vararg
)
p.state = state
p.is_tile = False
p.orig_init_images = inputs
# TODO modernui: monkey-patch for missing tabs.select event
if p.selected_scale_tab_before == 0 and p.resize_name_before != 'None' and p.scale_by_before != 1 and inputs is not None and len(inputs) > 0:
+3 -6
View File
@@ -289,11 +289,8 @@ def apply_detailer(p, opt, x):
def apply_control(field):
def fun(p, x, xs):
if getattr(p, 'xyz_init_images', None) is not None and len(getattr(p, 'xyz_init_images', [])) > 0: # backup init images since they get modified
p.init_images = getattr(p, 'xyz_init_images', None)
else:
p.xyz_init_images = getattr(p, 'init_images', None)
if getattr(p, 'init_images', None) is None or len(getattr(p, 'init_images', [])) == 0:
init_images = getattr(p, 'orig_init_images', None) or getattr(p, 'init_images', None) or getattr(p, 'orig_init_images', None) or []
if init_images is None or len(init_images) == 0:
shared.log.error('XYZ grid apply control: init image is required')
return
if field in ['controlnet', 't2i adapter', 'processor']:
@@ -331,7 +328,7 @@ def apply_control(field):
active_process, active_model, active_strength, active_start, active_end = run.check_active(p, unit.type, run.unit.current)
has_models, selected_models, control_conditioning, control_guidance_start, control_guidance_end = run.check_enabled(p, unit.type, run.unit.current, active_model, active_strength, active_start, active_end)
pipe = run.set_pipe(p, has_models, unit.type, selected_models, active_model, active_strength, control_conditioning, control_guidance_start, control_guidance_end)
_processed_image = processor.preprocess_image(p, pipe, input_image=p.init_images[0], unit_type=unit.type, active_process=active_process, active_model=active_model, selected_models=selected_models, has_models=has_models)
_processed_image = processor.preprocess_image(p, pipe, input_image=init_images[0], unit_type=unit.type, active_process=active_process, active_model=active_model, selected_models=selected_models, has_models=has_models)
if pipe is not None:
shared.sd_model = pipe
elif field == 'control_start':