Update app.py
Browse files
app.py
CHANGED
|
@@ -1829,6 +1829,7 @@ def similarity_matching(sprites_data: dict, project_folder: str, top_k: int = 1,
|
|
| 1829 |
# Flatten unique matched indices to process copying once per folder
|
| 1830 |
matched_indices = sorted({idx for lst in per_sprite_matched_indices for idx in lst})
|
| 1831 |
print("matched_indices------------------>",matched_indices)
|
|
|
|
| 1832 |
for matched_idx in matched_indices:
|
| 1833 |
matched_image_path = paths_list[matched_idx]
|
| 1834 |
matched_folder = os.path.dirname(matched_image_path)
|
|
@@ -1836,6 +1837,8 @@ def similarity_matching(sprites_data: dict, project_folder: str, top_k: int = 1,
|
|
| 1836 |
|
| 1837 |
print(f"Processing matched image: {matched_image_path}")
|
| 1838 |
print(f" - Folder: {matched_folder}")
|
|
|
|
|
|
|
| 1839 |
print(f" - Filename: {matched_filename}")
|
| 1840 |
|
| 1841 |
# If it's a sprite (under SPRITE_DIR) -> copy sprite assets and read sprite.json
|
|
@@ -1843,6 +1846,8 @@ def similarity_matching(sprites_data: dict, project_folder: str, top_k: int = 1,
|
|
| 1843 |
print(f"Processing SPRITE folder: {matched_folder}")
|
| 1844 |
copied_sprite_folders.add(matched_folder)
|
| 1845 |
sprite_json_path = os.path.join(matched_folder, "sprite.json")
|
|
|
|
|
|
|
| 1846 |
if os.path.exists(sprite_json_path):
|
| 1847 |
try:
|
| 1848 |
with open(sprite_json_path, "r", encoding="utf-8") as f:
|
|
@@ -1876,7 +1881,8 @@ def similarity_matching(sprites_data: dict, project_folder: str, top_k: int = 1,
|
|
| 1876 |
if matched_folder.startswith(backdrop_base_path) and matched_folder not in copied_backdrop_folders:
|
| 1877 |
print(f"Processing BACKDROP folder: {matched_folder}")
|
| 1878 |
copied_backdrop_folders.add(matched_folder)
|
| 1879 |
-
|
|
|
|
| 1880 |
# copy matched backdrop image
|
| 1881 |
backdrop_dst = os.path.join(project_folder, matched_filename)
|
| 1882 |
try:
|
|
|
|
| 1829 |
# Flatten unique matched indices to process copying once per folder
|
| 1830 |
matched_indices = sorted({idx for lst in per_sprite_matched_indices for idx in lst})
|
| 1831 |
print("matched_indices------------------>",matched_indices)
|
| 1832 |
+
|
| 1833 |
for matched_idx in matched_indices:
|
| 1834 |
matched_image_path = paths_list[matched_idx]
|
| 1835 |
matched_folder = os.path.dirname(matched_image_path)
|
|
|
|
| 1837 |
|
| 1838 |
print(f"Processing matched image: {matched_image_path}")
|
| 1839 |
print(f" - Folder: {matched_folder}")
|
| 1840 |
+
print(f" - Sprite path: {sprite_base_path}")
|
| 1841 |
+
print(f" - Backdrop path: {backdrop_base_path}")
|
| 1842 |
print(f" - Filename: {matched_filename}")
|
| 1843 |
|
| 1844 |
# If it's a sprite (under SPRITE_DIR) -> copy sprite assets and read sprite.json
|
|
|
|
| 1846 |
print(f"Processing SPRITE folder: {matched_folder}")
|
| 1847 |
copied_sprite_folders.add(matched_folder)
|
| 1848 |
sprite_json_path = os.path.join(matched_folder, "sprite.json")
|
| 1849 |
+
print("sprite_json_path----------------------->",sprite_json_path)
|
| 1850 |
+
print("copied sprite folder----------------------->",copied_sprite_folders)
|
| 1851 |
if os.path.exists(sprite_json_path):
|
| 1852 |
try:
|
| 1853 |
with open(sprite_json_path, "r", encoding="utf-8") as f:
|
|
|
|
| 1881 |
if matched_folder.startswith(backdrop_base_path) and matched_folder not in copied_backdrop_folders:
|
| 1882 |
print(f"Processing BACKDROP folder: {matched_folder}")
|
| 1883 |
copied_backdrop_folders.add(matched_folder)
|
| 1884 |
+
print("backdrop_base_path----------------------->",backdrop_base_path)
|
| 1885 |
+
print("copied backdrop folder----------------------->",copied_backdrop_folders)
|
| 1886 |
# copy matched backdrop image
|
| 1887 |
backdrop_dst = os.path.join(project_folder, matched_filename)
|
| 1888 |
try:
|