mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
Fix XYZ grid sub-grid count ignoring sub-grids created with the main grid
draw_xyz_grid inserts one sub-grid per Z value whenever the main grid or sub-grids are enabled, but have_subgrids only counted them when 'Include sub grids' was checked. With main grid on and sub grids off, the Z sub-grids leaked into the results as ordinary images (shown in the gallery, fed into video creation, misaligning infotexts) and the removal branch was unreachable since its condition contradicted itself. Count sub-grids based on the same condition that inserts them. https: //claude.ai/code/session_014QWKWgKvMevcuvfCnsYoT2 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -393,7 +393,7 @@ class XYZGridScript(scripts_manager.Script):
|
||||
return processed # something broke, no further handling needed.
|
||||
|
||||
have_grid = 1 if include_grid else 0
|
||||
have_subgrids = len(zs) if len(zs) > 1 and include_subgrids else 0
|
||||
have_subgrids = len(zs) if len(zs) > 1 and (include_grid or include_subgrids) else 0 # sub-grids are created whenever the main grid is, see draw_xyz_grid
|
||||
have_images = processed.images[have_grid+have_subgrids:]
|
||||
processed.infotexts[:have_grid+have_subgrids] = grid_infotext[:have_grid+have_subgrids] # update infotexts with grid and subgrid info
|
||||
log.debug(f'XYZ grid: grid={have_grid} subgrids={have_subgrids} images={len(have_images)} total={len(processed.images)}')
|
||||
|
||||
@@ -422,7 +422,7 @@ class XYZGridScript(scripts_manager.Script):
|
||||
return processed # something broke, no further handling needed.
|
||||
|
||||
have_grid = 1 if include_grid else 0
|
||||
have_subgrids = len(zs) if len(zs) > 1 and include_subgrids else 0
|
||||
have_subgrids = len(zs) if len(zs) > 1 and (include_grid or include_subgrids) else 0 # sub-grids are created whenever the main grid is, see draw_xyz_grid
|
||||
have_images = processed.images[have_grid+have_subgrids:]
|
||||
processed.infotexts[:have_grid+have_subgrids] = grid_infotext[:have_grid+have_subgrids] # update infotexts with grid and subgrid info
|
||||
log.debug(f'XYZ grid: grid={have_grid} subgrids={have_subgrids} images={len(have_images)} total={len(processed.images)}')
|
||||
|
||||
Reference in New Issue
Block a user