Free Motion Capture for Everyone πβ¨
TypeScript
Fix hand file naming bug (#846)
Aaron Cheriand08ae967ced7
diff --git a/freemocap-docs/docs/architecture/backend-recording-structure.mdx b/freemocap-docs/docs/architecture/backend-recording-structure.mdxindex 18ac40fc..fde4474f 100644--- a/freemocap-docs/docs/architecture/backend-recording-structure.mdx+++ b/freemocap-docs/docs/architecture/backend-recording-structure.mdx@@ -117,8 +117,8 @@ The `RecordingStatus` model (`system/recording_status/recording_status.py`, ~255`blender_export_ready` is `True` when all required .npy files exist:```mediapipe_body_3d_xyz.npy-mediapipe_right_hand_right_hand.npy-mediapipe_left_hand_left_hand.npy+mediapipe_right_hand_3d_xyz.npy+mediapipe_left_hand_3d_xyz.npymediapipe_face_3d_xyz.npymediapipe_body_total_body_center_of_mass.npymediapipe_body_segment_center_of_mass.npydiff --git a/freemocap-docs/docs/guides/blender-export.mdx b/freemocap-docs/docs/guides/blender-export.mdxindex 99ee4a56..d8da3350 100644--- a/freemocap-docs/docs/guides/blender-export.mdx+++ b/freemocap-docs/docs/guides/blender-export.mdx@@ -35,7 +35,7 @@ The Blender addon reads the `.npy` output files and builds a complete 3D scene:| Element | Source Data ||---|---|| **Skeleton mesh** | `mediapipe_body_3d_xyz.npy` β body keypoints connected as a skeleton |-| **Hand meshes** | `mediapipe_right_hand_right_hand.npy`, `mediapipe_left_hand_left_hand.npy` |+| **Hand meshes** | `mediapipe_right_hand_3d_xyz.npy`, `mediapipe_left_hand_3d_xyz.npy` || **Face mesh** | `mediapipe_face_3d_xyz.npy` || **Center of mass** | `mediapipe_body_total_body_center_of_mass.npy` β whole-body COM trajectory || **Camera frustums** | Calibration data β shows where each camera was in 3D space |diff --git a/freemocap/system/recording_status/recording_status.py b/freemocap/system/recording_status/recording_status.pyindex 9cec39c0..6526dde4 100644--- a/freemocap/system/recording_status/recording_status.py+++ b/freemocap/system/recording_status/recording_status.py@@ -20,13 +20,19 @@ VIDEO_EXTENSIONS = {".mp4", ".avi", ".mov", ".mkv", ".webm"}REQUIRED_BLENDER_INPUT_FILES: list[str] = ["mediapipe_body_3d_xyz.npy",- "mediapipe_right_hand_right_hand.npy",- "mediapipe_left_hand_left_hand.npy",+ "mediapipe_right_hand_3d_xyz.npy",+ "mediapipe_left_hand_3d_xyz.npy","mediapipe_face_3d_xyz.npy","mediapipe_body_total_body_center_of_mass.npy","mediapipe_body_segment_center_of_mass.npy",]++LEGACY_BLENDER_INPUT_FILENAMES: dict[str, str] = {+ "mediapipe_right_hand_3d_xyz.npy": "mediapipe_right_hand_right_hand.npy",+ "mediapipe_left_hand_3d_xyz.npy": "mediapipe_left_hand_left_hand.npy",+}+STAGE_RAW_VIDEOS = "Synchronized videos"STAGE_CALIBRATION = "Calibration"STAGE_BLENDER_INPUTS = "Blender input data (.npy)"@@ -69,10 +75,16 @@ class RecordingStatus(BaseModel):has_calibration_toml: bool = False-def missing_blender_input_files(recording_folder_path: str|Path) -> list[str]:+def missing_blender_input_files(+ recording_folder_path: str | Path,+) -> list[str]:output_data = Path(recording_folder_path) / OUTPUT_DATA_FOLDER_NAME- return [name for name in REQUIRED_BLENDER_INPUT_FILES- if not (output_data / name).exists()]++ return [+ name+ for name in REQUIRED_BLENDER_INPUT_FILES+ if not _find_blender_input_file(output_data, name).exists()+ ]def raise_if_not_blender_ready(recording_folder_path: str|Path) -> None:@@ -173,10 +185,21 @@ def _build_calibration_stage(recording_folder: Path) -> tuple[StageStatus, Path)-def _build_blender_inputs_stage(recording_folder: Path) -> StageStatus:+def _build_blender_inputs_stage(+ recording_folder: Path,+) -> StageStatus:output_data = recording_folder / OUTPUT_DATA_FOLDER_NAME- files = [_file_status(output_data / name, display_name=name) for name in REQUIRED_BLENDER_INPUT_FILES]- present = sum(1 for f in files if f.exists)++ files = [+ _file_status(+ _find_blender_input_file(output_data, name),+ display_name=name,+ )+ for name in REQUIRED_BLENDER_INPUT_FILES+ ]++ present = sum(1 for file_status in files if file_status.exists)+return StageStatus(name=STAGE_BLENDER_INPUTS,complete=present == len(files),@@ -220,6 +243,24 @@ def _build_blender_scene_stage(recording_folder: Path) -> tuple[StageStatus, Pat)+def _find_blender_input_file(+ output_data: Path,+ filename: str,+) -> Path:+ expected_path = output_data / filename++ if expected_path.exists():+ return expected_path++ legacy_filename = LEGACY_BLENDER_INPUT_FILENAMES.get(filename)+ if legacy_filename is not None:+ legacy_path = output_data / legacy_filename+ if legacy_path.exists():+ return legacy_path++ return expected_path++def compute_recording_status(recording_folder_path: Path) -> RecordingStatus:recording_folder = Path(recording_folder_path)if not recording_folder.is_dir():diff --git a/uv.lock b/uv.lockindex 01cf9bc1..ce3e8879 100644--- a/uv.lock+++ b/uv.lock@@ -371,7 +371,7 @@ wheels = [[[package]]name = "freemocap"-version = "2.0.0a18"+version = "2.0.0a19"source = { editable = "." }dependencies = [{ name = "beartype" },@@ -475,7 +475,7 @@ tracker-default = [[[package]]name = "freemocap-blender-addon"version = "2026.4.1041"-source = { git = "https://github.com/freemocap/freemocap_blender_addon?branch=main#7ed776647755722cc38f498b68df2e64248fd679" }+source = { git = "https://github.com/freemocap/freemocap_blender_addon?branch=main#980ae856b5575abfaae51bbfc2fd2158f07ecd12" }[[package]]name = "h11"@@ -1960,7 +1960,7 @@ dependencies = [[[package]]name = "skellyforge"version = "2024.12.1009"-source = { git = "https://github.com/freemocap/skellyforge?branch=main#7d39a24aa04a7a40c591ed7cf79a7e73259c51cf" }+source = { git = "https://github.com/freemocap/skellyforge?branch=main#ddf24f3aaa4388e5883afada217137223546c24e" }dependencies = [{ name = "numpy" },{ name = "pandas" },