Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript

clean up buggos (#509)

jonmatthis788533244114
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_simple.py b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_simple.py
index cde4f2ca..47880c8e 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_simple.py
+++ b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_simple.py
@@ -4,7 +4,8 @@ import sys
def run_simple(recording_path_input: str, blender_file_save_path_input: str):
from ajc27_freemocap_blender_addon.run_as_main import ajc27_run_as_main_function
- ajc27_run_as_main_function(recording_path=str(recording_path_input), save_path=str(blender_file_save_path_input))
+ ajc27_run_as_main_function(recording_path=str(recording_path_input),
+ blend_file_path=str(blender_file_save_path_input))
if __name__ == "__main__":
diff --git a/freemocap/core_processes/export_data/blender_stuff/get_best_guess_of_blender_path.py b/freemocap/core_processes/export_data/blender_stuff/get_best_guess_of_blender_path.py
index b555ad74..26fe4f96 100644
--- a/freemocap/core_processes/export_data/blender_stuff/get_best_guess_of_blender_path.py
+++ b/freemocap/core_processes/export_data/blender_stuff/get_best_guess_of_blender_path.py
@@ -2,31 +2,42 @@ import logging
import platform
from pathlib import Path
from typing import Union
+from packaging import version
logger = logging.getLogger(__name__)
def guess_blender_exe_path_from_path(base_path: Union[str, Path]) -> Path:
- blender_folder_path = [path for path in base_path.glob("Blender*")]
- if len(blender_folder_path) > 0:
- blender_exe_path = blender_folder_path[-1] / "blender.exe"
- return blender_exe_path
+ blender_folder_paths = sorted(
+ [path for path in base_path.rglob("Blender 3*") if "blender.exe" in (p.name for p in path.iterdir())],
+ key=lambda x: version.parse(x.name.split()[-1]),
+ reverse=True
+ )
+ if blender_folder_paths:
+ blender_exe_path = blender_folder_paths[0] / "blender.exe"
+ if blender_exe_path.is_file():
+ return blender_exe_path
+ return None
def get_best_guess_of_blender_path():
if platform.system() == "Windows":
- base_path = Path(r"C:\Program Files\Blender Foundation")
- blender_exe_path = guess_blender_exe_path_from_path(base_path)
-
- if blender_exe_path is not None:
- if not blender_exe_path.is_file():
- base_path = Path(Path.home()) / "Blender Foundation"
- blender_exe_path = guess_blender_exe_path_from_path(base_path)
+ paths_to_check = [
+ Path(r"C:\Program Files\Blender Foundation"),
+ Path(Path.home()) / "Blender Foundation"
+ ]
- if blender_exe_path is not None and blender_exe_path.is_file():
- logger.info(f"Windows machine detected - guessing that `blender` is installed at: {str(blender_exe_path)}")
+ found_paths = []
+ for base_path in paths_to_check:
+ blender_exe_path = guess_blender_exe_path_from_path(base_path)
+ if blender_exe_path is not None and blender_exe_path.is_file():
+ found_paths.append((version.parse(blender_exe_path.parent.name.split()[-1]), blender_exe_path))
- return str(blender_exe_path)
+ if found_paths:
+ highest_version_path = max(found_paths, key=lambda x: x[0])[1]
+ logger.info(
+ f"Windows machine detected - highest version of `blender` found at: {str(highest_version_path)}")
+ return str(highest_version_path)
else:
logger.warning(
"Could not find `blender.exe` in the expected locations. Please locate it manually (or install Blender, if it isn't installed)."
diff --git a/pyproject.toml b/pyproject.toml
index 4a671803..76dea4f3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -66,14 +66,12 @@ keywords = [
"computer vision"
]
-#dynamic = ["dependencies"]
dependencies = [
-
"skellycam==2023.12.1090",
"skelly-viewer==2023.12.1020",
"skellyforge==2023.12.1005",
"skelly_synchronize==2023.12.1029",
- "ajc27_freemocap_blender_addon==0.2.14",
+ "ajc27_freemocap_blender_addon==2023.10.1016",
"mediapipe~=0.10.0",
"opencv-contrib-python==4.8.*",
"toml==0.10.2",