Skip to content

Commit 5f2bc09

Browse files
committed
fix broken basepath
1 parent 35d301f commit 5f2bc09

1 file changed

Lines changed: 24 additions & 20 deletions

File tree

fast64_internal/z64/model_classes.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,35 +42,39 @@
4242

4343

4444
# read included asset data
45-
def ootGetIncludedAssetData(basePath: str, currentPaths: list[str], data: str) -> str:
45+
def ootGetIncludedAssetData(
46+
basePath: Union[str, os.PathLike, list[Union[str, os.PathLike]]], currentPaths: list[str], data: str
47+
) -> str:
4648
includeData = ""
49+
basePaths = basePath if isinstance(basePath, list) else [basePath]
4750
searchedPaths = currentPaths[:]
4851

4952
print("Included paths:")
5053
extracted_path = f"{bpy.context.scene.fast64.oot.get_extracted_path()}/"
5154

5255
# search assets
5356
for includeMatch in re.finditer(r"\#include\s*\"(assets/objects/(.*?)\.h)\"", data):
54-
h_p = Path(basePath) / includeMatch.group(1)
55-
print("", str(h_p))
56-
includeData += getImportData([str(h_p)]) + "\n"
57-
for path_p in h_p.parent.glob("*.c"):
58-
path = str(path_p)
59-
if path in searchedPaths:
60-
continue
61-
searchedPaths.append(path)
62-
subIncludeData = getImportData([path]) + "\n"
63-
includeData += subIncludeData
64-
print(" ", path)
65-
66-
for subIncludeMatch in re.finditer(r"\#include\s*\"(((?![/\"]).)*\.[ch])\"", subIncludeData):
67-
sub_inc_p = Path(path).parent / subIncludeMatch.group(1)
68-
subPath = str(sub_inc_p)
69-
if subPath in searchedPaths:
57+
for basePathItem in basePaths:
58+
h_p = Path(basePathItem) / includeMatch.group(1)
59+
print("", str(h_p))
60+
includeData += getImportData([str(h_p)]) + "\n"
61+
for path_p in h_p.parent.glob("*.c"):
62+
path = str(path_p)
63+
if path in searchedPaths:
7064
continue
71-
searchedPaths.append(subPath)
72-
print(" ", subPath)
73-
includeData += getImportData([subPath]) + "\n"
65+
searchedPaths.append(path)
66+
subIncludeData = getImportData([path]) + "\n"
67+
includeData += subIncludeData
68+
print(" ", path)
69+
70+
for subIncludeMatch in re.finditer(r"\#include\s*\"(((?![/\"]).)*\.[ch])\"", subIncludeData):
71+
sub_inc_p = Path(path).parent / subIncludeMatch.group(1)
72+
subPath = str(sub_inc_p)
73+
if subPath in searchedPaths:
74+
continue
75+
searchedPaths.append(subPath)
76+
print(" ", subPath)
77+
includeData += getImportData([subPath]) + "\n"
7478

7579
print("More included paths:")
7680

0 commit comments

Comments
 (0)