Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in spawn_util #405

Merged
merged 8 commits into from
Mar 25, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions MCprep_addon/spawner/spawn_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,24 @@ def tuple_from_match(match):
base_afile = os.path.splitext(afile)[0]
matches = find_suffix.search(base_afile)
if matches:
tuple_ver = tuple_from_match(matches)
res = util.min_bv(tuple_ver)
# If the suffix = 3.0 in `afile` file, and current blender is
# below 3, then `afile` is the file that should be loaded, and the
# current file `this_file` is to be skipped.
return res
# afile is guaranteed to have the same basename, not be the same file, and has a suffix
CFeeney333 marked this conversation as resolved.
Show resolved Hide resolved
# because it has a suffix, the recursively called function will not reach the containing for loop
if not check_blend_eligible(afile, all_files):
# if afile is not eligible, we can continue to the next iteration to see if there is another
# file with a suffix that is eligible
# previously this only allowed for 1 other file with a suffix to be checked
continue
else:
# if a file with a suffix is eligible here, we should not use the current file, but should use afile
# instead, so return False for the current file
return False

# tuple_ver = tuple_from_match(matches)
CFeeney333 marked this conversation as resolved.
Show resolved Hide resolved
# res = util.min_bv(tuple_ver)
# # If the suffix = 3.0 in `afile` file, and current blender is
# # below 3, then `afile` is the file that should be loaded, and the
# # current file `this_file` is to be skipped.
# return not res

# If no matches (the most common case), then this file is eligible.
return True
Expand Down