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:
parent
f4f61ea593
commit
86514b9342
@ -143,6 +143,11 @@ class FlamencoPreferences(bpy.types.AddonPreferences):
|
|||||||
def project_root(self) -> Path:
|
def project_root(self) -> Path:
|
||||||
"""Use the configured project finder to find the project root directory."""
|
"""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.
|
# It is assumed that the blendfile is saved.
|
||||||
blendfile = Path(bpy.data.filepath)
|
blendfile = Path(bpy.data.filepath)
|
||||||
return projects.for_blendfile(blendfile, self.project_finder)
|
return projects.for_blendfile(blendfile, self.project_finder)
|
||||||
|
@ -28,10 +28,6 @@ def for_blendfile(blendfile: Path, strategy: str) -> Path:
|
|||||||
return finder_info.finder(blendfile)
|
return finder_info.finder(blendfile)
|
||||||
|
|
||||||
|
|
||||||
def _finder_none(blendfile: Path) -> Path:
|
|
||||||
return blendfile.absolute().parent
|
|
||||||
|
|
||||||
|
|
||||||
def _finder_blender_project(blendfile: Path) -> Path:
|
def _finder_blender_project(blendfile: Path) -> Path:
|
||||||
return _search_path_marker(blendfile, ".blender_project")
|
return _search_path_marker(blendfile, ".blender_project")
|
||||||
|
|
||||||
@ -77,11 +73,6 @@ class FinderInfo:
|
|||||||
|
|
||||||
|
|
||||||
finders: dict[str, 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": FinderInfo(
|
||||||
"Blender Project",
|
"Blender Project",
|
||||||
"Find a .blend_project directory and use that as indicator for the top level project directory.",
|
"Find a .blend_project directory and use that as indicator for the top level project directory.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user