Remove the 'None' project finder, set 'blender project' as default

The 'None' project finder is the old behaviour of the add-on, and it is not
really necessary. If any of the other finders cannot find the directory
they're looking for, they'll return the current blend file's directory
anyway.

The new default is 'blender project'.
This commit is contained in:
Sybren A. Stüvel 2023-06-01 16:34:13 +02:00
parent f4f61ea593
commit 86514b9342
2 changed files with 5 additions and 9 deletions

View File

@ -143,6 +143,11 @@ class FlamencoPreferences(bpy.types.AddonPreferences):
def project_root(self) -> Path:
"""Use the configured project finder to find the project root directory."""
if not self.project_finder:
# Just a sanity fallback for missing preferences. It should be
# covered by the 'default=...' of the property, but just to be sure.
self.project_finder = "BLENDER_PROJECT"
# It is assumed that the blendfile is saved.
blendfile = Path(bpy.data.filepath)
return projects.for_blendfile(blendfile, self.project_finder)

View File

@ -28,10 +28,6 @@ def for_blendfile(blendfile: Path, strategy: str) -> Path:
return finder_info.finder(blendfile)
def _finder_none(blendfile: Path) -> Path:
return blendfile.absolute().parent
def _finder_blender_project(blendfile: Path) -> Path:
return _search_path_marker(blendfile, ".blender_project")
@ -77,11 +73,6 @@ class FinderInfo:
finders: dict[str, FinderInfo] = {
"NONE": FinderInfo(
"None",
"Just use the directory containing the current blend file as the project directory.",
_finder_none,
),
"BLENDER_PROJECT": FinderInfo(
"Blender Project",
"Find a .blend_project directory and use that as indicator for the top level project directory.",