From 86514b9342359d405b4a045b327d148ef4a7c8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 1 Jun 2023 16:34:13 +0200 Subject: [PATCH] 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'. --- addon/flamenco/preferences.py | 5 +++++ addon/flamenco/projects.py | 9 --------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/addon/flamenco/preferences.py b/addon/flamenco/preferences.py index 9a05923c..31bc231c 100644 --- a/addon/flamenco/preferences.py +++ b/addon/flamenco/preferences.py @@ -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) diff --git a/addon/flamenco/projects.py b/addon/flamenco/projects.py index cb0eece6..1a090c39 100644 --- a/addon/flamenco/projects.py +++ b/addon/flamenco/projects.py @@ -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.",