@@ -55,7 +55,7 @@ def process_layout_folders(
5555
5656 # Create a set of already processed directories for fast lookups
5757 processed_dirs = set (existing_df ["layout_dir_path" ])
58-
58+
5959 folder_name_pattern = re .compile (
6060 r".*?\[\[\s*(?P<n>\d+)\s*,\s*(?P<k>\d+)\s*,\s*(?P<d>\d+)\s*\]\]"
6161 )
@@ -93,14 +93,16 @@ def process_layout_folders(
9393 image_files = sorted (glob .glob (os .path .join (escaped_source_path , "layer_*.png" )))
9494 image_files_tiers = sorted (glob .glob (os .path .join (escaped_source_path , "tier_*.png" )))
9595
96+ # If neither exists, skip and remove the dest dir
97+ if not image_files and not image_files_tiers :
98+ print (f"--> No 'layer_*.png' or 'tier_*.png' images found in { folder_name } . Skipping." )
99+ os .rmdir (dest_asset_dir )
100+ continue
101+
102+ # Prefer layer_*; otherwise fall back to tier_*
96103 if not image_files :
97- if not image_files_tiers :
98- print (f"--> No 'layer_*.png' or 'tier_*.png' images found in { folder_name } . Skipping." )
99- os .rmdir (dest_asset_dir )
100- continue
101- else :
102- image_files = image_files_tiers
103- tiers_string = "tiers"
104+ image_files = image_files_tiers
105+ tiers_string = "tiers"
104106 else :
105107 tiers_string = "layers"
106108
@@ -109,7 +111,7 @@ def process_layout_folders(
109111 print (f" - Copied { len (image_files )} layer images to { dest_asset_dir } " )
110112
111113 # Extract data for the CSV; Normalize captures from either ordering
112- m = folder_name_pattern .match (folder_name )
114+ m = folder_name_pattern .match (folder_name )
113115 if m :
114116 n , k , d = map (int , (m ["n" ], m ["k" ], m ["d" ]))
115117
0 commit comments