Free Motion Capture for Everyone πβ¨
TypeScript
not bad
jonmatthisc237389d8bdb
diff --git a/freemocap-ui/src/components/common/RecordingStatusPanel.tsx b/freemocap-ui/src/components/common/RecordingStatusPanel.tsxnew file mode 100644index 00000000..36aec702--- /dev/null+++ b/freemocap-ui/src/components/common/RecordingStatusPanel.tsx@@ -0,0 +1,362 @@+import React from "react";+import {+ Accordion,+ AccordionDetails,+ AccordionSummary,+ Alert,+ Box,+ Chip,+ CircularProgress,+ IconButton,+ Stack,+ Tooltip,+ Typography,+ useTheme,+} from "@mui/material";+import CheckCircleIcon from "@mui/icons-material/CheckCircle";+import CloseIcon from "@mui/icons-material/Close";+import ExpandMoreIcon from "@mui/icons-material/ExpandMore";+import InfoIcon from "@mui/icons-material/Info";+import RefreshIcon from "@mui/icons-material/Refresh";+import {RecordingStatus} from "@/types/recording-status";++interface RecordingStatusPanelProps {+ status: RecordingStatus | null;+ isLoading?: boolean;+ error?: string | null;+ onRefresh?: () => void;+ defaultExpanded?: boolean;+ /** Path to the calibration TOML the user has currently selected (shown at top). */+ activeCalibrationTomlPath?: string | null;+ /** When false, the panel shows a "folder doesn't exist yet" notice instead of status. */+ folderExists?: boolean;+ /** Path shown in the "folder missing" notice for clarity. */+ recordingFolderPath?: string | null;+}++const humanizeBytes = (bytes: number | null): string => {+ if (bytes == null) return "β";+ if (bytes < 1024) return `${bytes} B`;+ const units = ["KB", "MB", "GB", "TB"];+ let value = bytes / 1024;+ let i = 0;+ while (value >= 1024 && i < units.length - 1) {+ value /= 1024;+ i++;+ }+ return `${value.toFixed(value >= 10 ? 0 : 1)} ${units[i]}`;+};++const formatTimestamp = (iso: string | null): string => {+ if (!iso) return "";+ try {+ const d = new Date(iso);+ if (Number.isNaN(d.getTime())) return iso;+ return d.toLocaleString();+ } catch {+ return iso;+ }+};++const StageChip: React.FC<{name: string; complete: boolean; present: number; total: number}> = ({+ name,+ complete,+ present,+ total,+}) => {+ const theme = useTheme();+ const label = total > 1 ? `${name} (${present}/${total})` : name;+ return (+ <Chip+ size="small"+ label={label}+ color={complete ? "success" : "default"}+ icon={complete ? <CheckCircleIcon/> : <CloseIcon/>}+ variant={complete ? "filled" : "outlined"}+ sx={+ !complete+ ? {+ borderColor: theme.palette.grey[400],+ "& .MuiChip-icon": {color: theme.palette.grey[600]},+ }+ : {}+ }+ />+ );+};++export const RecordingStatusPanel: React.FC<RecordingStatusPanelProps> = ({+ status,+ isLoading = false,+ error = null,+ onRefresh,+ defaultExpanded = false,+ activeCalibrationTomlPath = null,+ folderExists = true,+ recordingFolderPath = null,+}) => {+ const theme = useTheme();++ const stagesComplete = status ? status.stages.filter((s) => s.complete).length : 0;+ const stagesTotal = status ? status.stages.length : 0;+ const allStagesComplete = stagesTotal > 0 && stagesComplete === stagesTotal;+ const hasBlend = !!status?.has_blend_file;+ const exportReady = !!status?.blender_export_ready;++ // Fully processed = every stage complete (including the blender scene).+ // Ready for Blender = inputs present but no .blend yet.+ const summaryLabel = !folderExists+ ? "Folder not created yet"+ : status+ ? allStagesComplete && hasBlend+ ? "Fully processed"+ : exportReady && !hasBlend+ ? "Ready for Blender"+ : `${stagesComplete}/${stagesTotal} stages complete`+ : isLoading+ ? "Checkingβ¦"+ : error+ ? "Status unavailable"+ : "No status";++ const summaryColor: "success" | "info" | "warning" | "default" = !folderExists+ ? "warning"+ : allStagesComplete && hasBlend+ ? "success"+ : exportReady && !hasBlend+ ? "info"+ : "default";+ const accentBorder =+ summaryColor === "success"+ ? "#00e5ff66"+ : summaryColor === "info"+ ? `${theme.palette.info.main}44`+ : summaryColor === "warning"+ ? `${theme.palette.warning.main}55`+ : theme.palette.divider;++ return (+ <Accordion+ defaultExpanded={defaultExpanded}+ disableGutters+ square+ sx={{+ "&:before": {display: "none"},+ borderRadius: 1,+ border: `2px solid ${accentBorder}`,+ bgcolor: "transparent",+ boxShadow: "none",+ }}+ >+ <AccordionSummary+ expandIcon={<ExpandMoreIcon/>}+ sx={{+ minHeight: 40,+ "& .MuiAccordionSummary-content": {+ my: 0.5,+ alignItems: "center",+ gap: 1,+ minWidth: 0,+ },+ }}+ >+ <InfoIcon fontSize="small" color="info"/>+ <Typography+ variant="caption"+ fontWeight="medium"+ noWrap+ sx={{flex: "0 1 auto", minWidth: 0}}+ >+ Recording folder+ </Typography>+ <Chip+ size="small"+ label={summaryLabel}+ color={summaryColor === "default" ? "default" : summaryColor}+ icon={summaryColor !== "default" ? <CheckCircleIcon/> : undefined}+ variant={summaryColor !== "default" ? "filled" : "outlined"}+ sx={{flexShrink: 0}}+ />+ <Box sx={{flex: 1}}/>+ {onRefresh && (+ <Tooltip title="Re-check folder">+ <span>+ <IconButton+ size="small"+ onClick={(e) => {+ e.stopPropagation();+ onRefresh();+ }}+ disabled={isLoading}+ sx={{p: 0.25, flexShrink: 0}}+ >+ {isLoading ? (+ <CircularProgress size={14} color="inherit"/>+ ) : (+ <RefreshIcon sx={{fontSize: 14}}/>+ )}+ </IconButton>+ </span>+ </Tooltip>+ )}+ </AccordionSummary>++ <AccordionDetails sx={{pt: 0, pb: 1.5, px: 1.5}}>+ <Stack spacing={1}>+ {error && <Alert severity="error" variant="outlined">{error}</Alert>}++ {!folderExists && (+ <Alert severity="warning" variant="outlined">+ <Typography variant="caption" sx={{display: "block"}}>+ Recording folder does not exist yet. It will be created when you start recording.+ </Typography>+ {recordingFolderPath && (+ <Typography+ variant="caption"+ sx={{+ fontFamily: "monospace",+ display: "block",+ wordBreak: "break-all",+ mt: 0.5,+ }}+ >+ {recordingFolderPath}+ </Typography>+ )}+ </Alert>+ )}++ {activeCalibrationTomlPath && (+ <Box>+ <Typography variant="caption" color="text.secondary">+ Active calibration TOML:+ </Typography>+ <Typography+ variant="caption"+ sx={{+ fontFamily: "monospace",+ display: "block",+ color: "success.main",+ wordBreak: "break-all",+ }}+ >+ {activeCalibrationTomlPath}+ </Typography>+ </Box>+ )}++ {!status && !isLoading && !error && (+ <Typography variant="caption" color="text.secondary">+ No status loaded.+ </Typography>+ )}++ {status && (+ <>+ <Box>+ {status.stages.map((stage) => (+ <Accordion+ key={stage.name}+ defaultExpanded={false}+ disableGutters+ square+ sx={{+ "&:before": {display: "none"},+ bgcolor: "transparent",+ boxShadow: "none",+ border: `1px solid ${theme.palette.divider}`,+ mb: 0.5,+ }}+ >+ <AccordionSummary+ expandIcon={<ExpandMoreIcon/>}+ sx={{minHeight: 32, "& .MuiAccordionSummary-content": {my: 0.5}}}+ >+ <Stack direction="row" spacing={1} alignItems="center">+ {stage.complete ? (+ <CheckCircleIcon+ fontSize="small"+ sx={{color: theme.palette.success.main}}+ />+ ) : (+ <CloseIcon+ fontSize="small"+ sx={{color: theme.palette.grey[500]}}+ />+ )}+ <Typography variant="body2">{stage.name}</Typography>+ <Typography variant="caption" color="text.secondary">+ {stage.present_count}/{stage.total_count}+ </Typography>+ </Stack>+ </AccordionSummary>+ <AccordionDetails sx={{pt: 0, pb: 1}}>+ {stage.files.length === 0 ? (+ <Typography variant="caption" color="text.secondary">+ No files found.+ </Typography>+ ) : (+ <Stack spacing={0.25}>+ {stage.files.map((f) => (+ <Box+ key={f.path ?? f.name}+ sx={{+ display: "flex",+ alignItems: "center",+ gap: 1,+ fontFamily: "monospace",+ }}+ >+ {f.exists ? (+ <CheckCircleIcon+ sx={{+ fontSize: 14,+ color: theme.palette.success.main,+ }}+ />+ ) : (+ <CloseIcon+ sx={{+ fontSize: 14,+ color: theme.palette.grey[500],+ }}+ />+ )}+ <Typography+ variant="caption"+ sx={{+ fontFamily: "monospace",+ color: f.exists+ ? "text.primary"+ : "text.secondary",+ flex: 1,+ wordBreak: "break-all",+ }}+ >+ {f.name}+ </Typography>+ {f.exists && (+ <>+ <Typography variant="caption" color="text.secondary">+ {humanizeBytes(f.size_bytes)}+ </Typography>+ <Typography variant="caption" color="text.secondary">+ {formatTimestamp(f.modified_timestamp)}+ </Typography>+ </>+ )}+ </Box>+ ))}+ </Stack>+ )}+ </AccordionDetails>+ </Accordion>+ ))}+ </Box>+ </>+ )}+ </Stack>+ </AccordionDetails>+ </Accordion>+ );+};diff --git a/freemocap-ui/src/components/control-panels/calibration-control-panel/CalibrationPanel.tsx b/freemocap-ui/src/components/control-panels/calibration-control-panel/CalibrationPanel.tsxindex 567c9bd5..75ea10df 100644--- a/freemocap-ui/src/components/control-panels/calibration-control-panel/CalibrationPanel.tsx+++ b/freemocap-ui/src/components/control-panels/calibration-control-panel/CalibrationPanel.tsx@@ -16,6 +16,7 @@ import SquareFootIcon from "@mui/icons-material/SquareFoot";import PlayArrowIcon from "@mui/icons-material/PlayArrow";import StopIcon from "@mui/icons-material/Stop";import FolderOpenIcon from "@mui/icons-material/FolderOpen";+import LaunchIcon from "@mui/icons-material/Launch";import ClearIcon from "@mui/icons-material/Clear";import RefreshIcon from "@mui/icons-material/Refresh";import {DirectoryStatusPanel} from "@/components/common/DirectoryStatusPanel";@@ -75,6 +76,16 @@ export const CalibrationPanel: React.FC = () => {}};+ const handleOpenFolder = async (): Promise<void> => {+ if (!api || !calibrationRecordingPath) return;+ try {+ await api.fileSystem.openFolder.mutate({path: calibrationRecordingPath});+ } catch (err) {+ console.error("Failed to open folder:", err);+ setLocalError("Failed to open folder in file explorer");+ }+ };+const handlePathInputChange = async (e: React.ChangeEvent<HTMLInputElement>,): Promise<void> => {@@ -212,6 +223,18 @@ export const CalibrationPanel: React.FC = () => {</IconButton></span></Tooltip>+ <Tooltip title="Open folder in file explorer">+ <span>+ <IconButton+ onClick={handleOpenFolder}+ edge="end"+ size="small"+ disabled={!calibrationRecordingPath}+ >+ <LaunchIcon fontSize="small"/>+ </IconButton>+ </span>+ </Tooltip><Tooltip title="Select directory"><IconButton onClick={handleSelectDirectory} edge="end"><FolderOpenIcon/>diff --git a/freemocap-ui/src/components/control-panels/mocap-control-panel/BlenderSection.tsx b/freemocap-ui/src/components/control-panels/mocap-control-panel/BlenderSection.tsxindex 7395e8ff..3c3cca56 100644--- a/freemocap-ui/src/components/control-panels/mocap-control-panel/BlenderSection.tsx+++ b/freemocap-ui/src/components/control-panels/mocap-control-panel/BlenderSection.tsx@@ -14,6 +14,7 @@ import {Typography,} from '@mui/material';import FolderOpenIcon from '@mui/icons-material/FolderOpen';+import LaunchIcon from '@mui/icons-material/Launch';import RefreshIcon from '@mui/icons-material/Refresh';import ClearIcon from '@mui/icons-material/Clear';import MovieFilterIcon from '@mui/icons-material/MovieFilter';@@ -23,11 +24,14 @@ import {useElectronIPC} from '@/services';interface BlenderSectionProps {recordingFolderPath: string | null | undefined;disabled?: boolean;+ /** When provided, the "Open .blend in Blender" button is disabled unless true. */+ hasBlendFile?: boolean;}export const BlenderSection: React.FC<BlenderSectionProps> = ({recordingFolderPath,disabled = false,+ hasBlendFile,}) => {const {api, isElectron} = useElectronIPC();const {@@ -37,6 +41,7 @@ export const BlenderSection: React.FC<BlenderSectionProps> = ({autoOpenBlendFile,isExporting,isDetecting,+ isOpening,lastBlendFilePath,error,redetectBlender,@@ -45,6 +50,7 @@ export const BlenderSection: React.FC<BlenderSectionProps> = ({setExportToBlenderEnabled,setAutoOpenBlendFile,triggerBlenderExport,+ triggerOpenInBlender,clearError,} = useBlender();@@ -65,12 +71,24 @@ export const BlenderSection: React.FC<BlenderSectionProps> = ({void triggerBlenderExport(recordingFolderPath);};+ const handleOpenInBlender = (): void => {+ if (!recordingFolderPath) return;+ void triggerOpenInBlender(recordingFolderPath);+ };+const canExport =!!recordingFolderPath &&!!effectiveBlenderExePath &&!isExporting &&!disabled;+ const canOpen =+ !!recordingFolderPath &&+ !!effectiveBlenderExePath &&+ !isOpening &&+ !disabled &&+ (hasBlendFile === undefined || hasBlendFile);+return (<Box sx={{mt: 1}}><Divider sx={{mb: 2}}>@@ -175,6 +193,16 @@ export const BlenderSection: React.FC<BlenderSectionProps> = ({{isExporting ? 'Exporting to Blenderβ¦' : 'Process Recording with Blender'}</Button>+ <Button+ variant="outlined"+ startIcon={<LaunchIcon/>}+ onClick={handleOpenInBlender}+ disabled={!canOpen}+ fullWidth+ >+ {isOpening ? 'Openingβ¦' : 'Open .blend in Blender'}+ </Button>+{lastBlendFilePath && (<Typography variant="caption" color="text.secondary" sx={{fontFamily: 'monospace'}}>Last export: {lastBlendFilePath}diff --git a/freemocap-ui/src/components/control-panels/mocap-control-panel/MocapPanel.tsx b/freemocap-ui/src/components/control-panels/mocap-control-panel/MocapPanel.tsxindex 448b7683..badde5c8 100644--- a/freemocap-ui/src/components/control-panels/mocap-control-panel/MocapPanel.tsx+++ b/freemocap-ui/src/components/control-panels/mocap-control-panel/MocapPanel.tsx@@ -20,9 +20,9 @@ import DirectionsRunIcon from "@mui/icons-material/DirectionsRun";import PlayArrowIcon from "@mui/icons-material/PlayArrow";import StopIcon from "@mui/icons-material/Stop";import FolderOpenIcon from "@mui/icons-material/FolderOpen";+import LaunchIcon from "@mui/icons-material/Launch";import ClearIcon from "@mui/icons-material/Clear";import RefreshIcon from "@mui/icons-material/Refresh";-import {DirectoryStatusPanel} from "@/components/common/DirectoryStatusPanel";import {useMocap} from "@/hooks/useMocap";import {useCalibration} from "@/hooks/useCalibration";import {useDirectoryWatcher} from "@/hooks/useDirectoryWatcher";@@ -33,6 +33,8 @@ import {useServer} from "@/services/server/ServerContextProvider";import SquareFootIcon from "@mui/icons-material/SquareFoot";import {CollapsibleSidebarSection} from "@/components/common/CollapsibleSidebarSection";import {BlenderSection} from "@/components/control-panels/mocap-control-panel/BlenderSection";+import {RecordingStatusPanel} from "@/components/common/RecordingStatusPanel";+import {useRecordingStatus} from "@/hooks/useRecordingStatus";export const MocapPanel: React.FC = () => {const theme = useTheme();@@ -110,6 +112,16 @@ export const MocapPanel: React.FC = () => {}};+ const handleOpenFolder = async (): Promise<void> => {+ if (!isElectron || !api || !mocapRecordingPath) return;+ try {+ await api.fileSystem.openFolder.mutate({path: mocapRecordingPath});+ } catch (err) {+ console.error("Failed to open folder:", err);+ setLocalError("Failed to open folder in file explorer");+ }+ };+const handlePathInputChange = async (e: React.ChangeEvent<HTMLInputElement>,): Promise<void> => {@@ -171,6 +183,28 @@ export const MocapPanel: React.FC = () => {return parts[parts.length - 1] || null;}, [mocapRecordingPath]);+ // Derive parent directory so the backend can resolve non-default recording roots+ const recordingParentDirectory = useMemo(() => {+ if (!mocapRecordingPath) return null;+ const trimmed = mocapRecordingPath.replace(/[/\\]+$/, "");+ const idx = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));+ return idx > 0 ? trimmed.slice(0, idx) : null;+ }, [mocapRecordingPath]);++ // Only auto-fetch if the folder exists on disk β otherwise recordingId+ // may tick every second (default path embeds a timestamp) and we'd spam+ // the backend with 404s for folders that don't exist yet.+ const directoryExists = directoryInfo?.exists ?? false;+ const {+ status: recordingStatus,+ isLoading: recordingStatusLoading,+ error: recordingStatusError,+ refresh: refreshRecordingStatus,+ } = useRecordingStatus(recordingId, {+ recordingParentDirectory,+ autoFetch: directoryExists,+ });+const formatPhase = (phase: string): string => {const labels: Record<string, string> = {detecting_frames: "Detecting",@@ -300,7 +334,10 @@ export const MocapPanel: React.FC = () => {<Tooltip title="Re-check folder"><span><IconButton- onClick={triggerRefresh}+ onClick={() => {+ triggerRefresh();+ refreshRecordingStatus();+ }}edge="end"size="small"disabled={!mocapRecordingPath || isLoading}@@ -309,6 +346,18 @@ export const MocapPanel: React.FC = () => {</IconButton></span></Tooltip>+ <Tooltip title="Open folder in file explorer">+ <span>+ <IconButton+ onClick={handleOpenFolder}+ edge="end"+ size="small"+ disabled={!isElectron || !mocapRecordingPath}+ >+ <LaunchIcon fontSize="small" />+ </IconButton>+ </span>+ </Tooltip><Tooltip title="Select directory"><IconButton onClick={handleSelectDirectory} edge="end" disabled={!isElectron}><FolderOpenIcon />@@ -319,19 +368,21 @@ export const MocapPanel: React.FC = () => {}}/>- {/* Directory Status (auto-refreshing) */}- <DirectoryStatusPanel- title="Mocap Folder Status"- tomlLabel="Has calibration TOML"- directoryInfo={directoryInfo ? {- ...directoryInfo,- tomlPath: directoryInfo.cameraMocapTomlPath,- } : null}- status={mocapStatus}- onRefresh={triggerRefresh}- refreshDisabled={!mocapRecordingPath || isLoading}- isRefreshing={false}- />+ {/* Recording folder status (collapsed by default) */}+ {recordingId && (+ <RecordingStatusPanel+ status={recordingStatus}+ isLoading={recordingStatusLoading}+ error={recordingStatusError}+ onRefresh={() => {+ triggerRefresh();+ refreshRecordingStatus();+ }}+ activeCalibrationTomlPath={effectiveCalibrationTomlPath}+ folderExists={directoryExists}+ recordingFolderPath={mocapRecordingPath}+ />+ )}{/* Calibration TOML β redesigned compact picker */}<CalibrationTomlPicker@@ -414,6 +465,7 @@ export const MocapPanel: React.FC = () => {<BlenderSectionrecordingFolderPath={mocapRecordingPath}disabled={isLoading}+ hasBlendFile={recordingStatus?.has_blend_file}/></Stack></Box>diff --git a/freemocap-ui/src/components/playback/RecordingBrowser.tsx b/freemocap-ui/src/components/playback/RecordingBrowser.tsxindex 02942e08..8c6906a7 100644--- a/freemocap-ui/src/components/playback/RecordingBrowser.tsx+++ b/freemocap-ui/src/components/playback/RecordingBrowser.tsx@@ -10,9 +10,11 @@ import {Button,Chip,CircularProgress,+ Collapse,IconButton,InputAdornment,List,+ ListItem,ListItemButton,ListItemIcon,ListItemText,@@ -24,6 +26,8 @@ import {Typography,useTheme,} from '@mui/material';+import CheckCircleIcon from '@mui/icons-material/CheckCircle';+import ExpandMoreIcon from '@mui/icons-material/ExpandMore';import FolderIcon from '@mui/icons-material/Folder';import PlayArrowIcon from '@mui/icons-material/PlayArrow';import RefreshIcon from '@mui/icons-material/Refresh';@@ -34,6 +38,9 @@ import SearchIcon from '@mui/icons-material/Search';import SortIcon from '@mui/icons-material/Sort';import {serverUrls} from '@/constants/server-urls';import {useTranslation} from 'react-i18next';+import {RecordingStatusSummary} from '@/types/recording-status';+import {RecordingStatusPanel} from '@/components/common/RecordingStatusPanel';+import {useRecordingStatus} from '@/hooks/useRecordingStatus';// ---------------------------------------------------------------------------// Types@@ -49,6 +56,7 @@ interface RecordingEntry {total_frames?: number;duration_seconds?: number;fps?: number;+ status_summary?: RecordingStatusSummary;}/** Shape passed up to the parent when a recording is loaded */@@ -63,6 +71,8 @@ interface RecordingBrowserProps {onRecordingLoaded: (videos: LoadedVideo[], recordingPath: string, recordingFps?: number) => void;/** If set, automatically load this recording path on mount. */initialLoadPath?: string | null;+ /** Name/path of the recording currently loaded into the Playback view β highlighted in the list. */+ activeRecordingPath?: string | null;}type SortField = 'date' | 'name' | 'size' | 'cameras' | 'frames' | 'duration';@@ -196,7 +206,7 @@ const SORT_OPTIONS: { value: SortField; labelKey: string }[] = [// Component// ----------------------------------------------------------------------------export const RecordingBrowser: React.FC<RecordingBrowserProps> = ({ onRecordingLoaded, initialLoadPath }) => {+export const RecordingBrowser: React.FC<RecordingBrowserProps> = ({ onRecordingLoaded, initialLoadPath, activeRecordingPath }) => {const theme = useTheme();const { t } = useTranslation();const isDark = theme.palette.mode === 'dark';@@ -562,7 +572,9 @@ export const RecordingBrowser: React.FC<RecordingBrowserProps> = ({ onRecordingLisLoading={loadingPath === rec.path}isAnyLoading={isLoadingRecording}isDark={isDark}+ isActive={!!activeRecordingPath && (activeRecordingPath === rec.name || activeRecordingPath === rec.path)}onClick={() => loadRecording(rec.path)}+ recordingsRootPath={rec.path.slice(0, Math.max(rec.path.lastIndexOf('/'), rec.path.lastIndexOf('\\'))) || null}/>))}</List>@@ -580,25 +592,61 @@ interface RecordingRowProps {isLoading: boolean;isAnyLoading: boolean;isDark: boolean;+ isActive: boolean;onClick: () => void;+ recordingsRootPath: string | null;}const RecordingRow: React.FC<RecordingRowProps> = React.memo(- ({ rec, isLoading, isAnyLoading, isDark, onClick }) => {+ ({ rec, isLoading, isAnyLoading, isDark, isActive, onClick, recordingsRootPath }) => {const theme = useTheme();const parsedDate = parseTimestampFromName(rec.name);- const { t } = useTranslation();+ const { t } = useTranslation();+ const [expanded, setExpanded] = useState(false);++ const {+ status: detailedStatus,+ isLoading: statusLoading,+ error: statusError,+ refresh: refreshStatus,+ } = useRecordingStatus(expanded ? rec.name : null, {+ autoFetch: expanded,+ recordingParentDirectory: recordingsRootPath,+ });++ const summary = rec.status_summary;+ const ready = summary?.blender_export_ready ?? false;+ const stagesComplete = summary?.stages_complete ?? 0;+ const stagesTotal = summary?.stages_total ?? 0;++ const toggleExpand = (e: React.MouseEvent): void => {+ e.stopPropagation();+ setExpanded((v) => !v);+ };return (- <ListItemButton- onClick={onClick}- disabled={isAnyLoading}+ <ListItem+ disablePaddingsx={{- py: 1.25,- px: 2,- opacity: isAnyLoading && !isLoading ? 0.5 : 1,+ flexDirection: 'column',+ alignItems: 'stretch',+ ...(isActive && {+ backgroundColor: isDark ? 'rgba(41,182,246,0.12)' : 'rgba(41,182,246,0.10)',+ borderLeft: `3px solid ${ACCENT_BLUE}`,+ }),}}>+ <Box sx={{display: 'flex', alignItems: 'stretch'}}>+ <ListItemButton+ onClick={onClick}+ disabled={isAnyLoading}+ sx={{+ py: 1.25,+ px: 2,+ flex: 1,+ opacity: isAnyLoading && !isLoading ? 0.5 : 1,+ }}+ >{/* Folder icon or spinner */}<ListItemIcon sx={{ minWidth: 36 }}>{isLoading ? (@@ -618,18 +666,38 @@ const RecordingRow: React.FC<RecordingRowProps> = React.memo(<ListItemTextdisableTypographyprimary={- <Typography- variant="body2"- sx={{- fontFamily: MONO_FONT,- fontWeight: 600,- fontSize: '0.85rem',- mb: 0.5,- color: theme.palette.text.primary,- }}- >- {rec.name}- </Typography>+ <Box sx={{display: 'flex', alignItems: 'center', gap: 1, mb: 0.5}}>+ <Typography+ variant="body2"+ sx={{+ fontFamily: MONO_FONT,+ fontWeight: 600,+ fontSize: '0.85rem',+ color: isActive+ ? (isDark ? ACCENT_BLUE : theme.palette.primary.main)+ : theme.palette.text.primary,+ }}+ >+ {rec.name}+ </Typography>+ {isActive && (+ <Chip+ size="small"+ icon={<PlayArrowIcon sx={{fontSize: '12px !important'}}/>}+ label="loaded in playback"+ sx={{+ height: 18,+ fontSize: '0.65rem',+ fontFamily: MONO_FONT,+ backgroundColor: isDark ? `${ACCENT_BLUE}22` : 'rgba(41,182,246,0.15)',+ color: isDark ? ACCENT_BLUE : theme.palette.primary.main,+ border: `1px solid ${isDark ? `${ACCENT_BLUE}55` : 'rgba(41,182,246,0.4)'}`,+ '& .MuiChip-icon': {color: 'inherit'},+ '& .MuiChip-label': {px: 0.75},+ }}+ />+ )}+ </Box>}secondary={<Box@@ -750,10 +818,60 @@ const RecordingRow: React.FC<RecordingRowProps> = React.memo(</Typography></Tooltip>)}++ {/* Status summary */}+ {summary && (+ <Tooltip+ title={+ ready+ ? 'All pipeline stages complete β ready for Blender'+ : `${stagesComplete}/${stagesTotal} pipeline stages complete`+ }+ >+ <Chip+ size="small"+ label={+ ready+ ? 'Blender ready'+ : `${stagesComplete}/${stagesTotal} stages`+ }+ color={ready ? 'success' : 'default'}+ icon={ready ? <CheckCircleIcon/> : undefined}+ variant={ready ? 'filled' : 'outlined'}+ sx={{height: 18, fontSize: '0.65rem', '& .MuiChip-label': {px: 0.75}}}+ />+ </Tooltip>+ )}</Box>}/>- </ListItemButton>+ </ListItemButton>+ <Tooltip title={expanded ? 'Hide folder detail' : 'Show folder detail'}>+ <IconButton+ size="small"+ onClick={toggleExpand}+ sx={{+ mr: 1,+ alignSelf: 'center',+ transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',+ transition: 'transform 0.2s ease',+ }}+ >+ <ExpandMoreIcon fontSize="small"/>+ </IconButton>+ </Tooltip>+ </Box>+ <Collapse in={expanded} unmountOnExit>+ <Box sx={{px: 2, pb: 2}}>+ <RecordingStatusPanel+ status={detailedStatus}+ isLoading={statusLoading}+ error={statusError}+ onRefresh={refreshStatus}+ />+ </Box>+ </Collapse>+ </ListItem>);},);diff --git a/freemocap-ui/src/components/ui-components/MainNavTabs.tsx b/freemocap-ui/src/components/ui-components/MainNavTabs.tsxindex ac418684..ca61f1d8 100644--- a/freemocap-ui/src/components/ui-components/MainNavTabs.tsx+++ b/freemocap-ui/src/components/ui-components/MainNavTabs.tsx@@ -6,6 +6,7 @@ import {Tab, Tabs} from "@mui/material";const NAV_TABS = [{path: '/welcome', label: 'Home'},{path: '/streaming', label: 'Streaming'},+ {path: '/browse', label: 'Browse'},{path: '/playback', label: 'Playback'},] as const;diff --git a/freemocap-ui/src/constants/server-urls.ts b/freemocap-ui/src/constants/server-urls.tsindex 5b76effa..a9743148 100644--- a/freemocap-ui/src/constants/server-urls.ts+++ b/freemocap-ui/src/constants/server-urls.ts@@ -62,6 +62,8 @@ class ServerUrls {`${baseUrl}/freemocap/playback/${encodeURIComponent(recordingId)}/timestamps`,playbackVideoTimestamps: (recordingId: string, videoId: string) =>`${baseUrl}/freemocap/playback/${encodeURIComponent(recordingId)}/videos/${encodeURIComponent(videoId)}/timestamps`,+ playbackRecordingStatus: (recordingId: string) =>+ `${baseUrl}/freemocap/playback/${encodeURIComponent(recordingId)}/status`,// Recording endpointsstartRecording: `${baseUrl}/freemocap/camera/group/all/record/start`,@@ -84,6 +86,7 @@ class ServerUrls {// Blender endpointsblenderDetect: `${baseUrl}/freemocap/blender/detect`,blenderExport: `${baseUrl}/freemocap/blender/export`,+ blenderOpen: `${baseUrl}/freemocap/blender/open`,// WebSocketwebsocket: this.getWebSocketUrl(),diff --git a/freemocap-ui/src/hooks/useBlender.ts b/freemocap-ui/src/hooks/useBlender.tsindex c55d2f33..6f76d158 100644--- a/freemocap-ui/src/hooks/useBlender.ts+++ b/freemocap-ui/src/hooks/useBlender.ts@@ -8,6 +8,7 @@ import {detectBlender,exportRecordingToBlender,exportToBlenderToggled,+ openRecordingInBlender,selectBlender,selectEffectiveBlenderExePath,} from '@/store/slices/blender';@@ -63,6 +64,17 @@ export function useBlender() {[dispatch]);+ const triggerOpenInBlender = useCallback(+ (recordingFolderPath?: string) => {+ return dispatch(+ openRecordingInBlender(+ recordingFolderPath ? {recordingFolderPath} : undefined+ )+ );+ },+ [dispatch]+ );+const clearError = useCallback(() => {dispatch(blenderErrorCleared());}, [dispatch]);@@ -75,6 +87,7 @@ export function useBlender() {autoOpenBlendFile: blender.autoOpenBlendFile,isExporting: blender.isExporting,isDetecting: blender.isDetecting,+ isOpening: blender.isOpening,lastBlendFilePath: blender.lastBlendFilePath,error: blender.error,isUsingManualBlenderPath: blender.blenderExePath !== null,@@ -84,6 +97,7 @@ export function useBlender() {setExportToBlenderEnabled,setAutoOpenBlendFile,triggerBlenderExport,+ triggerOpenInBlender,clearError,};}diff --git a/freemocap-ui/src/hooks/useRecordingStatus.ts b/freemocap-ui/src/hooks/useRecordingStatus.tsnew file mode 100644index 00000000..12172b19--- /dev/null+++ b/freemocap-ui/src/hooks/useRecordingStatus.ts@@ -0,0 +1,37 @@+import {useCallback, useEffect} from 'react';+import {useAppDispatch, useAppSelector} from '@/store/hooks';+import {+ fetchRecordingStatus,+ selectRecordingStatusEntry,+} from '@/store/slices/recording-status';++export function useRecordingStatus(+ recordingId: string | null | undefined,+ options: { autoFetch?: boolean; recordingParentDirectory?: string | null } = {}+) {+ const {autoFetch = true, recordingParentDirectory = null} = options;+ const dispatch = useAppDispatch();+ const entry = useAppSelector(selectRecordingStatusEntry(recordingId));++ const refresh = useCallback(() => {+ if (!recordingId) return;+ void dispatch(fetchRecordingStatus({recordingId, recordingParentDirectory}));+ }, [dispatch, recordingId, recordingParentDirectory]);++ // Auto-fetch exactly once per (recordingId) β don't retry on error.+ // If we already have an entry (success OR failure OR in-flight), skip.+ useEffect(() => {+ if (!autoFetch) return;+ if (!recordingId) return;+ if (entry) return;+ refresh();+ }, [autoFetch, recordingId, entry, refresh]);++ return {+ status: entry?.status ?? null,+ isLoading: entry?.isLoading ?? false,+ error: entry?.error ?? null,+ fetchedAt: entry?.fetchedAt ?? null,+ refresh,+ };+}diff --git a/freemocap-ui/src/layout/content/BaseContentRouter.tsx b/freemocap-ui/src/layout/content/BaseContentRouter.tsxindex c511c989..b8a007bf 100644--- a/freemocap-ui/src/layout/content/BaseContentRouter.tsx+++ b/freemocap-ui/src/layout/content/BaseContentRouter.tsx@@ -3,6 +3,7 @@ import {Navigate, Route, Routes} from 'react-router-dom';import WelcomePage from "@/pages/WelcomePage";import {StreamingViewPage} from "@/pages/StreamingViewPage";import PlaybackPage from "@/pages/PlaybackPage";+import BrowsePage from "@/pages/BrowsePage";export const BaseContentRouter: React.FC = () => {return (@@ -10,6 +11,7 @@ export const BaseContentRouter: React.FC = () => {<Route path="/" element={<Navigate to="/welcome" replace/>}/><Route path="/welcome" element={<WelcomePage/>}/><Route path="/streaming" element={<StreamingViewPage/>}/>+ <Route path="/browse" element={<BrowsePage/>}/><Route path="/playback" element={<PlaybackPage/>}/><Route path="*" element={<Navigate to="/welcome" replace/>}/></Routes>diff --git a/freemocap-ui/src/pages/BrowsePage.tsx b/freemocap-ui/src/pages/BrowsePage.tsxnew file mode 100644index 00000000..11e5bffd--- /dev/null+++ b/freemocap-ui/src/pages/BrowsePage.tsx@@ -0,0 +1,47 @@+import React from 'react';+import {Box, useTheme} from '@mui/material';+import {useNavigate} from 'react-router-dom';+import {Footer} from '@/components/ui-components/Footer';+import ErrorBoundary from '@/components/common/ErrorBoundary';+import {RecordingBrowser} from '@/components/playback/RecordingBrowser';+import {usePlaybackContext} from '@/components/playback/PlaybackContext';++const BrowsePage: React.FC = () => {+ const theme = useTheme();+ const navigate = useNavigate();+ const ctx = usePlaybackContext();++ return (+ <Box+ sx={{+ flex: 1,+ display: 'flex',+ flexDirection: 'column',+ height: '100%',+ backgroundColor: theme.palette.mode === 'dark'+ ? theme.palette.background.default+ : theme.palette.background.paper,+ borderStyle: 'solid',+ borderWidth: '1px',+ borderColor: theme.palette.divider,+ }}+ >+ <Box sx={{flex: 1, display: 'flex', flexDirection: 'column', overflow: 'hidden'}}>+ <ErrorBoundary>+ <RecordingBrowser+ activeRecordingPath={ctx?.recordingPath ?? null}+ onRecordingLoaded={(videos, recPath, recFps) => {+ ctx?.onRecordingLoaded(videos, recPath, recFps);+ navigate('/playback');+ }}+ />+ </ErrorBoundary>+ </Box>+ <Box component="footer" sx={{p: 0.5}}>+ <Footer/>+ </Box>+ </Box>+ );+};++export default BrowsePage;diff --git a/freemocap-ui/src/pages/PlaybackPage.tsx b/freemocap-ui/src/pages/PlaybackPage.tsxindex 56e50cdf..f0ac6c00 100644--- a/freemocap-ui/src/pages/PlaybackPage.tsx+++ b/freemocap-ui/src/pages/PlaybackPage.tsx@@ -4,17 +4,15 @@ import VideocamIcon from '@mui/icons-material/Videocam';import StorageIcon from '@mui/icons-material/Storage';import FolderOpenIcon from '@mui/icons-material/FolderOpen';import VideoLibraryIcon from '@mui/icons-material/VideoLibrary';-import CloseIcon from '@mui/icons-material/Close';import {Footer} from '@/components/ui-components/Footer';import ErrorBoundary from '@/components/common/ErrorBoundary';import {SyncedVideoPlayer} from '@/components/playback/SyncedVideoPlayer';import {PlaybackControls} from '@/components/playback/PlaybackControls';import {usePlaybackController} from '@/components/playback/usePlaybackController';import {usePlaybackContext} from '@/components/playback/PlaybackContext';-import {RecordingBrowser} from '@/components/playback/RecordingBrowser';import {useElectronIPC} from '@/services';import {useTranslation} from 'react-i18next';-import {useLocation} from 'react-router-dom';+import {useLocation, useNavigate} from 'react-router-dom';import type {CameraSettings} from '@/pages/StreamingViewPage';import {SettingsOverlay} from "@/components/ui-components/SettingsOverlay";import {Panel, PanelGroup, PanelResizeHandle} from "react-resizable-panels";@@ -25,6 +23,7 @@ const PlaybackPage: React.FC = () => {const {t} = useTranslation();const {api} = useElectronIPC();const location = useLocation();+ const navigate = useNavigate();const isDark = theme.palette.mode === 'dark';const locationState = location.state as { loadRecordingPath?: string } | null;@@ -43,14 +42,6 @@ const PlaybackPage: React.FC = () => {});const [resetKey, setResetKey] = useState<number>(0);- const [isBrowsing, setIsBrowsing] = useState<boolean>(!ctx?.recordingPath);-- useEffect(() => {- if (!ctx?.recordingPath) {- setIsBrowsing(true);- }- }, [ctx?.recordingPath]);-const isHorizontal = settings.layoutDirection === 'horizontal';const loadedVideos = ctx?.loadedVideos ?? [];@@ -149,11 +140,11 @@ const PlaybackPage: React.FC = () => {{recordingName}</Typography>- {/* Browse Recordings button */}- <Tooltip title={isBrowsing ? "Close browser" : "Browse recordings"}>+ {/* Browse Recordings button β navigates to the Browse tab */}+ <Tooltip title="Browse recordings"><IconButtonsize="small"- onClick={() => setIsBrowsing(!isBrowsing)}+ onClick={() => navigate('/browse')}sx={{color: isDark ? '#b3b9c6' : theme.palette.text.secondary,border: `1px solid ${isDark ? 'rgba(255,255,255,0.15)' : theme.palette.divider}`,@@ -167,8 +158,8 @@ const PlaybackPage: React.FC = () => {},}}>- {isBrowsing ? <CloseIcon sx={{fontSize: 16}}/> : <VideoLibraryIcon sx={{fontSize: 16}}/>}- {isBrowsing ? 'Close' : 'Browse'}+ <VideoLibraryIcon sx={{fontSize: 16}}/>+ Browse</IconButton></Tooltip>@@ -253,7 +244,7 @@ const PlaybackPage: React.FC = () => {</Box>{/* Video + 3D viewport area */}- <Box sx={{ flex: 1, minHeight: 0, display: isBrowsing ? 'none' : 'flex', flexDirection: 'column' }}>+ <Box sx={{ flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column' }}>{settings.show3dView ? (<PanelGroupkey={`main-panels-${resetKey}-${settings.layoutDirection}`}@@ -323,19 +314,6 @@ const PlaybackPage: React.FC = () => {)}</Box>- {/* Recording Browser Area */}- {isBrowsing && (- <Box sx={{ flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column' }}>- <RecordingBrowser- onRecordingLoaded={(videos, recPath, recFps) => {- ctx?.onRecordingLoaded(videos, recPath, recFps);- setIsBrowsing(false);- }}- initialLoadPath={ctx?.initialLoadPath}- />- </Box>- )}-{/* Playback controls β full width below video + 3D area */}<PlaybackControlsisPlaying={controller.isPlaying}diff --git a/freemocap-ui/src/store/slices/blender/blender-slice.ts b/freemocap-ui/src/store/slices/blender/blender-slice.tsindex 31a903a1..5939ce1c 100644--- a/freemocap-ui/src/store/slices/blender/blender-slice.ts+++ b/freemocap-ui/src/store/slices/blender/blender-slice.ts@@ -1,6 +1,6 @@import {createSlice, PayloadAction} from '@reduxjs/toolkit';import {RootState} from '@/store/types';-import {detectBlender, exportRecordingToBlender} from './blender-thunks';+import {detectBlender, exportRecordingToBlender, openRecordingInBlender} from './blender-thunks';export interface BlenderState {blenderExePath: string | null;@@ -9,6 +9,7 @@ export interface BlenderState {autoOpenBlendFile: boolean;isExporting: boolean;isDetecting: boolean;+ isOpening: boolean;lastBlendFilePath: string | null;error: string | null;}@@ -20,6 +21,7 @@ const initialState: BlenderState = {autoOpenBlendFile: true,isExporting: false,isDetecting: false,+ isOpening: false,lastBlendFilePath: null,error: null,};@@ -72,6 +74,22 @@ export const blenderSlice = createSlice({state.isExporting = false;state.error = action.payload || 'Failed to export to Blender';});++ builder+ .addCase(openRecordingInBlender.pending, (state) => {+ state.isOpening = true;+ state.error = null;+ })+ .addCase(openRecordingInBlender.fulfilled, (state, action) => {+ state.isOpening = false;+ if (action.payload.blendFilePath) {+ state.lastBlendFilePath = action.payload.blendFilePath;+ }+ })+ .addCase(openRecordingInBlender.rejected, (state, action) => {+ state.isOpening = false;+ state.error = action.payload || 'Failed to open Blender';+ });},});diff --git a/freemocap-ui/src/store/slices/blender/blender-thunks.ts b/freemocap-ui/src/store/slices/blender/blender-thunks.tsindex 043a3069..7c017d24 100644--- a/freemocap-ui/src/store/slices/blender/blender-thunks.ts+++ b/freemocap-ui/src/store/slices/blender/blender-thunks.ts@@ -84,3 +84,54 @@ export const exportRecordingToBlender = createAsyncThunk<}});++interface OpenBlenderResult {+ success: boolean;+ message?: string | null;+ blendFilePath?: string | null;+}++export const openRecordingInBlender = createAsyncThunk<+ OpenBlenderResult,+ { recordingFolderPath: string } | void,+ { state: RootState; rejectValue: string }+>(+ 'blender/open',+ async (arg, {getState, rejectWithValue}) => {+ try {+ const state = getState();+ const blender = state.blender;+ const recordingFolderPath =+ (arg && arg.recordingFolderPath) ||+ state.mocap.manualMocapRecordingPath ||+ state.mocap.lastMocapRecordingPath;++ if (!recordingFolderPath) {+ return rejectWithValue('No recording folder path available to open in Blender');+ }++ const blenderExePath = blender.blenderExePath ?? blender.detectedBlenderExePath;++ const response = await fetch(serverUrls.endpoints.blenderOpen, {+ method: 'POST',+ headers: {'Content-Type': 'application/json'},+ body: JSON.stringify({+ recordingFolderPath,+ blenderExePath,+ }),+ });++ if (!response.ok) {+ return rejectWithValue(await getDetailedErrorMessage(response));+ }+ const data = await response.json();+ return {+ success: !!data.success,+ message: data.message ?? null,+ blendFilePath: data.blend_file_path ?? null,+ };+ } catch (e) {+ return rejectWithValue(e instanceof Error ? e.message : 'Unknown error');+ }+ }+);diff --git a/freemocap-ui/src/store/slices/recording-status/index.ts b/freemocap-ui/src/store/slices/recording-status/index.tsnew file mode 100644index 00000000..6ffa0622--- /dev/null+++ b/freemocap-ui/src/store/slices/recording-status/index.ts@@ -0,0 +1,2 @@+export * from './recording-status-slice';+export * from './recording-status-thunks';diff --git a/freemocap-ui/src/store/slices/recording-status/recording-status-slice.ts b/freemocap-ui/src/store/slices/recording-status/recording-status-slice.tsnew file mode 100644index 00000000..7dcd1416--- /dev/null+++ b/freemocap-ui/src/store/slices/recording-status/recording-status-slice.ts@@ -0,0 +1,66 @@+import {createSlice} from '@reduxjs/toolkit';+import {RootState} from '@/store/types';+import {RecordingStatus} from '@/types/recording-status';+import {fetchRecordingStatus} from './recording-status-thunks';++export interface PerRecordingStatusState {+ status: RecordingStatus | null;+ isLoading: boolean;+ error: string | null;+ fetchedAt: number | null;+}++export interface RecordingStatusState {+ byRecordingId: Record<string, PerRecordingStatusState>;+}++const initialState: RecordingStatusState = {+ byRecordingId: {},+};++const emptyEntry = (): PerRecordingStatusState => ({+ status: null,+ isLoading: false,+ error: null,+ fetchedAt: null,+});++export const recordingStatusSlice = createSlice({+ name: 'recordingStatus',+ initialState,+ reducers: {},+ extraReducers: (builder) => {+ builder+ .addCase(fetchRecordingStatus.pending, (state, action) => {+ const id = action.meta.arg.recordingId;+ const prev = state.byRecordingId[id] ?? emptyEntry();+ state.byRecordingId[id] = {...prev, isLoading: true, error: null};+ })+ .addCase(fetchRecordingStatus.fulfilled, (state, action) => {+ const {recordingId, status} = action.payload;+ state.byRecordingId[recordingId] = {+ status,+ isLoading: false,+ error: null,+ fetchedAt: Date.now(),+ };+ })+ .addCase(fetchRecordingStatus.rejected, (state, action) => {+ const id = action.meta.arg.recordingId;+ const prev = state.byRecordingId[id] ?? emptyEntry();+ state.byRecordingId[id] = {+ ...prev,+ isLoading: false,+ error: action.payload?.error ?? 'Failed to fetch recording status',+ };+ });+ },+});++export const selectRecordingStatusEntry = (recordingId: string | null | undefined) =>+ (state: RootState): PerRecordingStatusState | null => {+ if (!recordingId) return null;+ return state.recordingStatus.byRecordingId[recordingId] ?? null;+ };++export default recordingStatusSlice.reducer;diff --git a/freemocap-ui/src/store/slices/recording-status/recording-status-thunks.ts b/freemocap-ui/src/store/slices/recording-status/recording-status-thunks.tsnew file mode 100644index 00000000..70d194cc--- /dev/null+++ b/freemocap-ui/src/store/slices/recording-status/recording-status-thunks.ts@@ -0,0 +1,32 @@+import {createAsyncThunk} from '@reduxjs/toolkit';+import {RootState} from '@/store/types';+import {serverUrls} from '@/services';+import {getDetailedErrorMessage} from '@/store/slices/thunk-helpers';+import {RecordingStatus} from '@/types/recording-status';++export const fetchRecordingStatus = createAsyncThunk<+ { recordingId: string; status: RecordingStatus },+ { recordingId: string; recordingParentDirectory?: string | null },+ { state: RootState; rejectValue: { recordingId: string; error: string } }+>(+ 'recordingStatus/fetch',+ async ({recordingId, recordingParentDirectory}, {rejectWithValue}) => {+ try {+ const base = serverUrls.endpoints.playbackRecordingStatus(recordingId);+ const url = recordingParentDirectory+ ? `${base}?recording_parent_directory=${encodeURIComponent(recordingParentDirectory)}`+ : base;+ const response = await fetch(url);+ if (!response.ok) {+ return rejectWithValue({recordingId, error: await getDetailedErrorMessage(response)});+ }+ const status = (await response.json()) as RecordingStatus;+ return {recordingId, status};+ } catch (e) {+ return rejectWithValue({+ recordingId,+ error: e instanceof Error ? e.message : 'Unknown error',+ });+ }+ }+);diff --git a/freemocap-ui/src/store/store.ts b/freemocap-ui/src/store/store.tsindex 0ad0fcee..9cd2d0c4 100644--- a/freemocap-ui/src/store/store.ts+++ b/freemocap-ui/src/store/store.ts@@ -9,6 +9,7 @@ import {mocapSlice} from "@/store/slices/mocap/mocap-slice";import {localeSlice} from "@/store/slices/locale";import {pipelinesSlice} from "@/store/slices/pipelines/pipelines-slice";import {blenderSlice} from "@/store/slices/blender/blender-slice";+import {recordingStatusSlice} from "@/store/slices/recording-status/recording-status-slice";export const store = configureStore({reducer: {@@ -22,5 +23,6 @@ export const store = configureStore({locale: localeSlice.reducer,pipelines: pipelinesSlice.reducer,blender: blenderSlice.reducer,+ recordingStatus: recordingStatusSlice.reducer,},});diff --git a/freemocap-ui/src/types/recording-status.ts b/freemocap-ui/src/types/recording-status.tsnew file mode 100644index 00000000..ca8f4286--- /dev/null+++ b/freemocap-ui/src/types/recording-status.ts@@ -0,0 +1,38 @@+export interface FileStatus {+ name: string;+ path: string | null;+ exists: boolean;+ size_bytes: number | null;+ modified_timestamp: string | null;+}++export interface StageStatus {+ name: string;+ complete: boolean;+ present_count: number;+ total_count: number;+ files: FileStatus[];+}++export interface RecordingStatus {+ has_blend_file: boolean;+ blend_file_path: string | null;+ has_annotated_videos: boolean;+ annotated_videos_path: string | null;+ blender_export_ready: boolean;+ missing_blender_inputs: string[];+ stages: StageStatus[];+ synchronized_video_count: number;+ annotated_video_count: number;+ calibration_toml_path: string | null;+ has_calibration_toml: boolean;+}++export interface RecordingStatusSummary {+ blender_export_ready: boolean;+ has_blend_file: boolean;+ has_annotated_videos: boolean;+ has_calibration_toml: boolean;+ stages_complete: number;+ stages_total: number;+}diff --git a/freemocap/api/http/blender/blender_router.py b/freemocap/api/http/blender/blender_router.pyindex fe9a3d1f..7e2927e0 100644--- a/freemocap/api/http/blender/blender_router.py+++ b/freemocap/api/http/blender/blender_router.py@@ -1,5 +1,6 @@import inspectimport logging+import subprocessfrom pathlib import Pathfrom fastapi import APIRouter, HTTPException@@ -9,6 +10,7 @@ from freemocap.core.blender.export_to_blender import export_to_blenderfrom freemocap.core.blender.helpers.install_blender_addon import \install_freemocap_blender_addonfrom freemocap.core.blender.helpers.get_best_guess_of_blender_path import get_best_guess_of_blender_path+from freemocap.system.recording_status.recording_status import compute_recording_statusfrom freemocap.system.default_paths import FREEMOCAP_TEST_DATA_PATHlogger = logging.getLogger(__name__)@@ -66,6 +68,26 @@ class ExportToBlenderResponse(BaseModel):blender_file_path: str | None = None+class OpenInBlenderRequest(BaseModel):+ model_config = ConfigDict(+ populate_by_name=True,+ json_schema_extra={+ "example": {+ "recordingFolderPath": FREEMOCAP_TEST_DATA_PATH,+ "blenderExePath": None,+ }+ },+ )+ recording_folder_path: str = Field(alias="recordingFolderPath")+ blender_exe_path: str | None = Field(alias="blenderExePath", default=None)+++class OpenInBlenderResponse(BaseModel):+ success: bool+ message: str | None = None+ blend_file_path: str | None = None++# ==================== Endpoints ====================@@ -147,3 +169,37 @@ def export_to_blender_endpoint(request: ExportToBlenderRequest) -> ExportToBlendexcept Exception as e:logger.exception(f"Error exporting to Blender: {e}")raise HTTPException(status_code=500, detail=str(e))+++@blender_router.post("/open")+def open_in_blender_endpoint(request: OpenInBlenderRequest) -> OpenInBlenderResponse:+ """Open an existing .blend file in the given recording folder with Blender (GUI, non-blocking)."""+ try:+ recording_folder = Path(request.recording_folder_path)+ if not recording_folder.is_dir():+ raise HTTPException(status_code=400, detail=f"Recording folder not found: {request.recording_folder_path}")++ blender_exe_path = request.blender_exe_path or get_best_guess_of_blender_path()+ if blender_exe_path is None:+ raise HTTPException(status_code=400, detail="Could not find a Blender executable on this system - install from https://blender.org/download")+ blender_exe = Path(blender_exe_path)+ if not blender_exe.is_file():+ raise HTTPException(status_code=400, detail=f"Blender executable not found at: {blender_exe_path}")++ status = compute_recording_status(recording_folder)+ if not status.has_blend_file or not status.blend_file_path:+ raise HTTPException(status_code=400, detail=f"No .blend file found in {recording_folder}")++ logger.info(f"Launching Blender ({blender_exe}) with {status.blend_file_path}")+ subprocess.Popen([str(blender_exe), status.blend_file_path], shell=False)++ return OpenInBlenderResponse(+ success=True,+ message="Launched Blender",+ blend_file_path=status.blend_file_path,+ )+ except HTTPException:+ raise+ except Exception as e:+ logger.exception(f"Error opening .blend in Blender: {e}")+ raise HTTPException(status_code=500, detail=str(e))diff --git a/freemocap/api/http/playback/playback_router.py b/freemocap/api/http/playback/playback_router.pyindex 86e3ea81..dcd9e055 100644--- a/freemocap/api/http/playback/playback_router.py+++ b/freemocap/api/http/playback/playback_router.py@@ -22,6 +22,10 @@ from fastapi import APIRouter, HTTPException, Queryfrom fastapi.responses import FileResponsefrom pydantic import BaseModel+from freemocap.system.recording_status.recording_status import (+ RecordingStatus,+ compute_recording_status,+)from freemocap.system.default_paths import get_default_freemocap_recordings_path_VIEWER_HTML = Path(__file__).parent.parent.parent.parent / "core" / "viz" / "parquet_viewer.html"@@ -45,6 +49,15 @@ class VideoInfo(BaseModel):stream_url: str+class RecordingStatusSummary(BaseModel):+ blender_export_ready: bool = False+ has_blend_file: bool = False+ has_annotated_videos: bool = False+ has_calibration_toml: bool = False+ stages_complete: int = 0+ stages_total: int = 0++class RecordingListEntry(BaseModel):name: strpath: str@@ -54,6 +67,7 @@ class RecordingListEntry(BaseModel):total_frames: Optional[int] = Noneduration_seconds: Optional[float] = Nonefps: Optional[float] = None+ status_summary: RecordingStatusSummary = RecordingStatusSummary()# ---------------------------------------------------------------------------@@ -311,7 +325,9 @@ def list_recordings(total_size = _get_total_size(video_folder)created_ts = _get_created_timestamp(child)stats = _get_recording_stats(child, video_folder)+ status = compute_recording_status(child)+ stages_complete = sum(1 for s in status.stages if s.complete)entries.append(RecordingListEntry(name=child.name,path=str(child),@@ -321,6 +337,14 @@ def list_recordings(total_frames=stats.get("total_frames"),duration_seconds=stats.get("duration_seconds"),fps=stats.get("fps"),+ status_summary=RecordingStatusSummary(+ blender_export_ready=status.blender_export_ready,+ has_blend_file=status.has_blend_file,+ has_annotated_videos=status.has_annotated_videos,+ has_calibration_toml=status.has_calibration_toml,+ stages_complete=stages_complete,+ stages_total=len(status.stages),+ ),))except (FileNotFoundError, PermissionError):continue@@ -328,6 +352,21 @@ def list_recordings(return entries+@playback_router.get(+ "/{recording_id}/status",+ summary="Health/readiness status for a recording (blender inputs, blend file, annotated videos)",+)+def get_recording_status(+ recording_id: str,+ recording_parent_directory: str | None = Query(+ default=None,+ description="Override the default recordings directory",+ ),+) -> RecordingStatus:+ recording_path = _resolve_recording_path(recording_id, recording_parent_directory)+ return compute_recording_status(recording_path)++@playback_router.get("/{recording_id}/videos",summary="List videos in a recording",diff --git a/freemocap/core/blender/export_to_blender.py b/freemocap/core/blender/export_to_blender.pyindex cd1f6989..53938ab6 100644--- a/freemocap/core/blender/export_to_blender.py+++ b/freemocap/core/blender/export_to_blender.py@@ -2,13 +2,14 @@ import inspectimport loggingimport subprocessfrom pathlib import Path-from typing import Union, List+from typing import Listimport freemocap_blender_addonfrom freemocap.core.blender.helpers import run_blender_export as run_blender_export_modulefrom freemocap.core.blender.helpers.run_blender_export import run_blender_exportfrom freemocap.core.blender.helpers.get_best_guess_of_blender_path import get_best_guess_of_blender_path+from freemocap.system.recording_status.recording_status import raise_if_not_blender_readyfrom freemocap.utilities.open_file import open_filelogger = logging.getLogger(__name__)@@ -25,15 +26,10 @@ RIGHT_HAND_3D_DATAFRAME_CSV_FILE_NAME = "right_hand_right_hand.csv" # TODO - thLEFT_HAND_3D_DATAFRAME_CSV_FILE_NAME = "left_hand_left_hand.csv" # TODO - the names are duplicated in the right/left hand, needs fixed in skellyforge.skellymodels.human (i think?)FACE_3D_DATAFRAME_CSV_FILE_NAME = "face_3d_xyz.csv"-TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME = "body_total_body_center_of_mass.npy"-SEGMENT_CENTER_OF_MASS_NPY_FILE_NAME = "body_segment_center_of_mass.npy"-OLD_DATA_2D_NPY_FILE_NAME = "mediapipe2dData_numCams_numFrames_numTrackedPoints_pixelXY.npy"OLD_RAW_3D_NPY_FILE_NAME = "mediapipe3dData_numFrames_numTrackedPoints_spatialXYZ.npy"OLD_REPROJECTION_ERROR_NPY_FILE_NAME = "mediapipe3dData_numFrames_numTrackedPoints_reprojectionError.npy"OLD_DATA_3D_NPY_FILE_NAME = "mediaPipeSkel_3d_body_hands_face.npy"-OLD_TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME = "total_body_center_of_mass_xyz.npy"-OLD_SEGMENT_CENTER_OF_MASS_NPY_FILE_NAME = "segmentCOM_frame_joint_xyz.npy"def run_subprocess(command_list: List[str]):@@ -49,10 +45,10 @@ def export_to_blender(open_file_on_completion:bool=True,):try:- freemocap_blender_addon_validator(recording_folder_path=recording_folder_path)- except FileNotFoundError as e:+ raise_if_not_blender_ready(recording_folder_path)+ except FileNotFoundError:logger.error("Missing required files to run AJC addon, did something go wrong during processing?")- raise e+ raiseif blender_exe_path is None:blender_exe_path:Path = Path(get_best_guess_of_blender_path())@@ -111,64 +107,6 @@ def export_to_blender(-def freemocap_blender_addon_validator(recording_folder_path: Union[str, Path], active_tracker: str = "mediapipe"):- """- Check if the required files exist in the recording folder- """- recording_path = Path(recording_folder_path)- output_data_path = recording_path / "output_data"-- if active_tracker[-1] != "_":- active_tracker = active_tracker + "_"-- if not (output_data_path / (active_tracker + "body_3d_xyz.npy")).exists():- raise FileNotFoundError(- f"Could not find required file: {output_data_path / (active_tracker + 'body_3d_xyz.npy')}"- )-- if not (output_data_path / (active_tracker + "right_hand_right_hand.npy")).exists(): #duplicated hand dnames need fixed in skforge- raise FileNotFoundError(- f"Could not find required file: {output_data_path / (active_tracker + 'right_hand_right_hand.npy')}"- )-- if not (output_data_path / (active_tracker + "left_hand_left_hand.npy")).exists():- raise FileNotFoundError(- f"Could not find required file: {output_data_path / (active_tracker + 'left_hand_left_hand.npy')}"- )-- if not (output_data_path / (active_tracker + "face_3d_xyz.npy")).exists():- raise FileNotFoundError(- f"Could not find required file: {output_data_path / (active_tracker + 'face_3d_xyz.npy')}"- )-- if not (output_data_path / (active_tracker + TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME)).exists():- if (- active_tracker != "mediapipe_"- or not (output_data_path / OLD_TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME).exists()- ):- raise FileNotFoundError(- f"Could not find required file: {output_data_path / (active_tracker + TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME)}"- )-- if not (output_data_path / (active_tracker + SEGMENT_CENTER_OF_MASS_NPY_FILE_NAME)).exists():- if (- active_tracker != "mediapipe_"- or not (output_data_path / OLD_SEGMENT_CENTER_OF_MASS_NPY_FILE_NAME).exists()- ):- raise FileNotFoundError(- f"Could not find required file: {output_data_path / 'center_of_mass' / (active_tracker + SEGMENT_CENTER_OF_MASS_NPY_FILE_NAME)}"- )-- # if not (output_data_path / "raw_data" / (active_tracker + REPROJECTION_ERROR_NPY_FILE_NAME)).exists():- # if (- # active_tracker != "mediapipe_"- # or not (output_data_path / "raw_data" / OLD_REPROJECTION_ERROR_NPY_FILE_NAME).exists()- # ):- # raise FileNotFoundError(- # f"Could not find required file: {output_data_path / 'raw_data' / (active_tracker + REPROJECTION_ERROR_NPY_FILE_NAME)}"- # )--if __name__ == "__main__":diff --git a/freemocap/core/pipeline/posthoc/posthoc_aggregation_node.py b/freemocap/core/pipeline/posthoc/posthoc_aggregation_node.pyindex fdf186f6..49ac8d38 100644--- a/freemocap/core/pipeline/posthoc/posthoc_aggregation_node.py+++ b/freemocap/core/pipeline/posthoc/posthoc_aggregation_node.py@@ -204,9 +204,14 @@ class PosthocAggregationNode(AggregatorNode):exc_info=True,)progress_message.error = True+ progress_message.error_message = f"{type(e).__name__}: {e}"+ progress_message.running_aggregation_task = Falseaggregator_progress_pub.put(progress_message)ipc.shutdown_pipeline()- raise+ # Do NOT re-raise: an unhandled exception here kills the worker, and the WorkerRegistry+ # child monitor treats that as a fatal failure and shuts down the parent server.+ # The error has already been surfaced via the progress message (error=True, error_message=...)+ # so the frontend can display a meaningful message to the user.finally:progress_message.complete = Trueaggregator_progress_pub.put(progress_message)diff --git a/freemocap/core/pipeline/posthoc/video_node.py b/freemocap/core/pipeline/posthoc/video_node.pyindex e2e7732f..2c9a57fe 100644--- a/freemocap/core/pipeline/posthoc/video_node.py+++ b/freemocap/core/pipeline/posthoc/video_node.py@@ -28,10 +28,10 @@ from freemocap.core.types.type_overloads import VideoIdString, TopicPublicationQfrom freemocap.pubsub.pubsub_manager import PubSubTopicManagerfrom freemocap.pubsub.pubsub_topics import VideoNodeOutputTopic, VideoNodeOutputMessage, VideoNodeProgressTopic, \VideoNodeProgressMessage, PipelineProgressMessage+from freemocap.system.default_paths import ANNOTATED_VIDEOS_FOLDER_NAMElogger = logging.getLogger(__name__)-ANNOTATED_VIDEOS_FOLDER_NAME = "annotated_videos"@dataclass@@ -246,9 +246,12 @@ class VideoNode(SourceNode):f"Exception in VideoNode for {video_path.stem}: {e}")progress_message.error = True+ progress_message.error_message = f"{type(e).__name__}: {e}"video_progress_pub.put(progress_message)ipc.shutdown_pipeline()- raise+ # Do NOT re-raise: unhandled exceptions here kill the worker, and the WorkerRegistry+ # child monitor escalates that to a parent-process shutdown (exit code 15).+ # The error is surfaced via the progress message so the frontend can report it.finally:video_reader.release()progress_message.complete = Truediff --git a/freemocap/core/tasks/calibration/anipose_calibration/helpers/freemocap_anipose.py b/freemocap/core/tasks/calibration/anipose_calibration/helpers/freemocap_anipose.pyindex ca9bf222..a42b3463 100644--- a/freemocap/core/tasks/calibration/anipose_calibration/helpers/freemocap_anipose.py+++ b/freemocap/core/tasks/calibration/anipose_calibration/helpers/freemocap_anipose.py@@ -993,6 +993,19 @@ class AniposeCameraGroup:for i, (row, cam) in enumerate(zip(all_rows, self.cameras)):all_rows[i] = board.estimate_pose_rows(cam, row)+ # Verify each camera has at least some frames with a successfully estimated board pose.+ # solvePnP needs >= 6 charuco corners per frame; if a camera never saw that many, calibration cannot proceed.+ for cam_idx, (rows, camera) in enumerate(zip(all_rows, self.cameras)):+ valid_poses = sum(1 for r in rows if r.get("rvec") is not None and r.get("tvec") is not None)+ if valid_poses == 0:+ raise ValueError(+ f"Camera {cam_idx} ({camera.get_name()}) has no frames with enough charuco corners "+ f"for pose estimation (need >= 6 per frame). "+ f"Ensure the charuco board is clearly visible and well-lit in every camera's view, "+ f"and that the correct board dimensions are configured."+ )+ logger.info(f" Camera {cam_idx} ({camera.get_name()}): {valid_poses}/{len(rows)} frames have valid board pose")+charuco_frames = [f["framenum"][1] for f in all_rows[0]]logger.info("Merging observations across cameras...")@@ -1117,7 +1130,8 @@ class AniposeCharucoBoard(CharucoBoard):ids: np.ndarray | None,) -> tuple[np.ndarray | None, np.ndarray | None]:"""Estimate board pose via solvePnP using detected charuco corner positions and their known 3D locations."""- if corners is None or ids is None or len(corners) < 5:+ # cv2.solvePnP's DLT algorithm requires >= 6 point correspondences; skip frames below that.+ if corners is None or ids is None or len(corners) < 6:return None, Noneflat_ids = ids.flatten()diff --git a/freemocap/pubsub/pubsub_topics.py b/freemocap/pubsub/pubsub_topics.pyindex 1067f66c..26f50e81 100644--- a/freemocap/pubsub/pubsub_topics.py+++ b/freemocap/pubsub/pubsub_topics.py@@ -158,6 +158,7 @@ class PipelineProgressMessage(TopicMessageABC):working: bool = Falsecomplete: bool = Falseerror: bool = False+ error_message: str | None = Nonedef __post_init__(self) -> None:if self.frame_count < 0:diff --git a/freemocap/system/default_paths.py b/freemocap/system/default_paths.pyindex dbcddebc..1d43bfdf 100644--- a/freemocap/system/default_paths.py+++ b/freemocap/system/default_paths.py@@ -4,6 +4,7 @@ from pathlib import PathDEFAULT_FREEMOCAP_BASE_FOLDER_NAME = "freemocap_data"SYNCHRONIZED_VIDEOS_FOLDER_NAME = "synchronized_videos"+ANNOTATED_VIDEOS_FOLDER_NAME = "annotated_videos"LOGS_INFO_AND_SETTINGS_FOLDER_NAME = "logs_info_and_settings"LOG_FILE_FOLDER_NAME = "logs"TIMESTAMPS_FOLDER_NAME = "timestamps"diff --git a/freemocap/system/recording_status/__init__.py b/freemocap/system/recording_status/__init__.pynew file mode 100644index 00000000..e69de29bdiff --git a/freemocap/system/recording_status/recording_status.py b/freemocap/system/recording_status/recording_status.pynew file mode 100644index 00000000..9cec39c0--- /dev/null+++ b/freemocap/system/recording_status/recording_status.py@@ -0,0 +1,255 @@+"""Recording folder health/status checks.++Single source of truth for "is this recording ready to export / open in Blender?"+Owns the list of required Blender-input files and the per-folder checks. Consumed+by the playback router (list + per-recording status), the blender router+(`/blender/open` pre-flight), and `export_to_blender` (pre-flight before subprocess).+"""+from datetime import datetime, timezone+from pathlib import Path+from pydantic import BaseModel++from freemocap.system.default_paths import (+ ANNOTATED_VIDEOS_FOLDER_NAME,+ SYNCHRONIZED_VIDEOS_FOLDER_NAME,+)++OUTPUT_DATA_FOLDER_NAME = "output_data"++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_face_3d_xyz.npy",+ "mediapipe_body_total_body_center_of_mass.npy",+ "mediapipe_body_segment_center_of_mass.npy",+]++STAGE_RAW_VIDEOS = "Synchronized videos"+STAGE_CALIBRATION = "Calibration"+STAGE_BLENDER_INPUTS = "Blender input data (.npy)"+STAGE_ANNOTATED_VIDEOS = "Annotated videos"+STAGE_BLENDER_SCENE = "Blender scene"+++class FileStatus(BaseModel):+ name: str+ path: str | None = None+ exists: bool = False+ size_bytes: int | None = None+ modified_timestamp: str | None = None # ISO-8601 UTC+++class StageStatus(BaseModel):+ name: str+ complete: bool+ present_count: int+ total_count: int+ files: list[FileStatus] = []+++class RecordingStatus(BaseModel):+ # Top-level readiness (stable consumers: blender_router, export_to_blender)+ has_blend_file: bool = False+ blend_file_path: str | None = None+ has_annotated_videos: bool = False+ annotated_videos_path: str | None = None+ blender_export_ready: bool = False+ missing_blender_inputs: list[str] = []++ # Richer per-stage breakdown+ stages: list[StageStatus] = []++ # Raw contents summary+ synchronized_video_count: int = 0+ annotated_video_count: int = 0+ calibration_toml_path: str | None = None+ has_calibration_toml: bool = False+++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()]+++def raise_if_not_blender_ready(recording_folder_path: str|Path) -> None:+ """Pre-flight check for export_to_blender. Raises FileNotFoundError listing all missing files."""+ missing = missing_blender_input_files(recording_folder_path)+ if missing:+ output_data = Path(recording_folder_path) / OUTPUT_DATA_FOLDER_NAME+ raise FileNotFoundError(+ f"Missing {len(missing)} required Blender input file(s) in {output_data}: "+ + ", ".join(missing)+ )+++def _find_blend_file(recording_folder: str|Path) -> Path | None:+ expected = recording_folder / f"{recording_folder.stem}.blend"+ if expected.is_file():+ return expected+ for p in recording_folder.iterdir():+ if p.is_file() and p.suffix.lower() == ".blend":+ return p+ return None+++def _find_calibration_toml(recording_folder: str|Path) -> Path | None:+ for p in recording_folder.iterdir():+ if p.is_file() and p.suffix.lower() == ".toml" and "calibration" in p.name.lower():+ return p+ return None+++def _file_status(path: Path, display_name: str | None = None) -> FileStatus:+ name = display_name or path.name+ if not path.exists():+ return FileStatus(name=name, path=str(path), exists=False)+ try:+ stat = path.stat()+ mtime = datetime.fromtimestamp(stat.st_mtime, tz=timezone.utc).isoformat(timespec="seconds")+ return FileStatus(+ name=name,+ path=str(path),+ exists=True,+ size_bytes=stat.st_size,+ modified_timestamp=mtime,+ )+ except OSError:+ return FileStatus(name=name, path=str(path), exists=True)+++def _count_videos(folder: Path) -> int:+ if not folder.is_dir():+ return 0+ return sum(+ 1 for p in folder.iterdir()+ if p.is_file() and p.suffix.lower() in VIDEO_EXTENSIONS+ )+++def _list_videos(folder: Path) -> list[Path]:+ if not folder.is_dir():+ return []+ return sorted(+ p for p in folder.iterdir()+ if p.is_file() and p.suffix.lower() in VIDEO_EXTENSIONS+ )+++def _build_raw_videos_stage(recording_folder: Path) -> tuple[StageStatus, int]:+ synced_folder = recording_folder / SYNCHRONIZED_VIDEOS_FOLDER_NAME+ videos = _list_videos(synced_folder)+ if not videos:+ videos = _list_videos(recording_folder)+ count = len(videos)+ files = [_file_status(v) for v in videos]+ return (+ StageStatus(+ name=STAGE_RAW_VIDEOS,+ complete=count > 0,+ present_count=count,+ total_count=count,+ files=files,+ ),+ count,+ )+++def _build_calibration_stage(recording_folder: Path) -> tuple[StageStatus, Path | None]:+ toml_path = _find_calibration_toml(recording_folder)+ files = [_file_status(toml_path)] if toml_path else []+ return (+ StageStatus(+ name=STAGE_CALIBRATION,+ complete=toml_path is not None,+ present_count=1 if toml_path else 0,+ total_count=1,+ files=files,+ ),+ toml_path,+ )+++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)+ return StageStatus(+ name=STAGE_BLENDER_INPUTS,+ complete=present == len(files),+ present_count=present,+ total_count=len(files),+ files=files,+ )+++def _build_annotated_videos_stage(recording_folder: Path) -> tuple[StageStatus, bool, int]:+ annotated_dir = recording_folder / ANNOTATED_VIDEOS_FOLDER_NAME+ videos = _list_videos(annotated_dir)+ count = len(videos)+ has_any = count > 0+ files = [_file_status(v) for v in videos]+ return (+ StageStatus(+ name=STAGE_ANNOTATED_VIDEOS,+ complete=has_any,+ present_count=count,+ total_count=count if has_any else 1,+ files=files,+ ),+ has_any,+ count,+ )+++def _build_blender_scene_stage(recording_folder: Path) -> tuple[StageStatus, Path | None]:+ blend_file = _find_blend_file(recording_folder)+ files = [_file_status(blend_file)] if blend_file else []+ return (+ StageStatus(+ name=STAGE_BLENDER_SCENE,+ complete=blend_file is not None,+ present_count=1 if blend_file else 0,+ total_count=1,+ files=files,+ ),+ blend_file,+ )+++def compute_recording_status(recording_folder_path: Path) -> RecordingStatus:+ recording_folder = Path(recording_folder_path)+ if not recording_folder.is_dir():+ return RecordingStatus()++ raw_videos_stage, synced_video_count = _build_raw_videos_stage(recording_folder)+ calibration_stage, calibration_toml = _build_calibration_stage(recording_folder)+ blender_inputs_stage = _build_blender_inputs_stage(recording_folder)+ annotated_stage, has_annotated, annotated_count = _build_annotated_videos_stage(recording_folder)+ blender_scene_stage, blend_file = _build_blender_scene_stage(recording_folder)++ annotated_videos_dir = recording_folder / ANNOTATED_VIDEOS_FOLDER_NAME+ missing = [f.name for f in blender_inputs_stage.files if not f.exists]++ return RecordingStatus(+ has_blend_file=blend_file is not None,+ blend_file_path=str(blend_file) if blend_file else None,+ has_annotated_videos=has_annotated,+ annotated_videos_path=str(annotated_videos_dir) if has_annotated else None,+ blender_export_ready=len(missing) == 0,+ missing_blender_inputs=missing,+ stages=[+ raw_videos_stage,+ calibration_stage,+ blender_inputs_stage,+ annotated_stage,+ blender_scene_stage,+ ],+ synchronized_video_count=synced_video_count,+ annotated_video_count=annotated_count,+ calibration_toml_path=str(calibration_toml) if calibration_toml else None,+ has_calibration_toml=calibration_toml is not None,+ )