Native Windows video motion capture with ExMR, FlowHMR and GVHMR, contact correction, humanoid retargeting, and FBX/VMD export.
Python
"""Editor workspace layout; processing and playback live in MainWindow."""
from .tooltips import tooltip_text, plain_tooltip
from .console_log import ConsoleLog
from PySide6.QtCore import Qt, QSize
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import (QWidget, QFrame, QLabel, QPushButton, QComboBox, QCheckBox,
QVBoxLayout, QHBoxLayout, QGroupBox, QSplitter,
QSpinBox, QDoubleSpinBox, QProgressBar, QTextEdit, QMessageBox, QSizePolicy, QStackedWidget)
from .viewer import VideoView, MotionView
from .timeline import TimelineSlider
from .motion_tools import MOTION_TOOLS
from .paths import ROOT
from .correction_settings import PRESETS
from .sidebar_scroll import SettingsScrollArea
class WrappedLabel(QLabel):
"""Reserve wrapped text height inside stacked, scrollable settings pages."""
def __init__(self, text=''):
super().__init__(text)
self.setWordWrap(True)
self.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
def setText(self, text):
super().setText(text)
self.fit_height()
def resizeEvent(self, event):
super().resizeEvent(event)
self.fit_height()
def fit_height(self):
height=max(self.fontMetrics().height(),self.heightForWidth(max(1,self.width())))
if self.minimumHeight()!=height or self.maximumHeight()!=height:self.setFixedHeight(height)
class TooltipHelp(WrappedLabel):
"""Keep dynamic help on its controls without occupying sidebar space."""
def __init__(self,text='',*controls):
super().__init__('')
self.controls=controls
for control in controls:
if not hasattr(control,'_sidebar_tooltip_parts'):
control._sidebar_tooltip_parts={'base':plain_tooltip(control.toolTip())}
self.setText(text)
self.hide()
def setText(self,text):
super().setText(text)
for control in getattr(self,'controls',()):
control._sidebar_tooltip_parts[id(self)]=text
parts=dict.fromkeys(part for part in control._sidebar_tooltip_parts.values() if part)
control.setToolTip(tooltip_text('\n\n'.join(parts)))
def setVisible(self,visible):
super().setVisible(False)
class SettingsStack(QStackedWidget):
"""Hidden model pages must not reserve their height in the sidebar."""
def __init__(self):
super().__init__()
self.currentChanged.connect(lambda _: self.updateGeometry())
def sizeHint(self):
page=self.currentWidget()
return page.sizeHint() if page else QSize(0,0)
def minimumSizeHint(self):
page=self.currentWidget()
return page.minimumSizeHint() if page else QSize(0,0)
def build_workspace(w):
def button(text, callback, parent_layout):
control = QPushButton(text)
control.clicked.connect(callback)
parent_layout.addWidget(control)
return control
def group(title, parent_layout):
control = QGroupBox(title)
control.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Maximum)
box = QVBoxLayout(control)
box.setSpacing(7)
box.setAlignment(Qt.AlignTop)
parent_layout.addWidget(control)
return box
def editor(title, widget):
panel = QFrame()
panel.setObjectName("editor")
layout = QVBoxLayout(panel)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
bar = QWidget()
bar.setObjectName("editorHeader")
bar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
header = QHBoxLayout(bar)
header.setContentsMargins(9, 3, 6, 3)
header.addWidget(QLabel(title))
header.addStretch()
layout.addWidget(bar)
layout.addWidget(widget, 1)
return panel, header
central = QWidget()
w.setCentralWidget(central)
root = QVBoxLayout(central)
root.setContentsMargins(4, 3, 4, 3)
root.setSpacing(4)
top = QHBoxLayout()
brand = QLabel("RGB MoCap")
brand.setObjectName("brand")
top.addWidget(brand)
workspace = QLabel("Motion Workspace |")
workspace.setObjectName("muted")
top.addWidget(workspace)
w.filename = QLabel("Open a video or drop it into the workspace")
w.filename.setObjectName("muted")
w.filename.setMinimumWidth(0)
w.filename.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred)
top.addWidget(w.filename, 1)
root.addLayout(top)
main = QSplitter(Qt.Horizontal)
main.setHandleWidth(4)
workspace_split = QSplitter(Qt.Vertical)
w.workspace_split = workspace_split
workspace_split.setHandleWidth(4)
editors = QSplitter(Qt.Horizontal)
editors.setHandleWidth(4)
w.video_view = VideoView()
w.motion_view = MotionView()
w.video_view.frame_presented.connect(w.present_frame)
w.video_view.metadata_ready.connect(w.video_ready)
w.video_view.decode_error.connect(w.video_failed)
video_panel, video_header = editor("Movie Clip", w.build_people_editor(w.video_view))
w.build_pear_header(video_header)
w.fps_label = QLabel("No clip loaded")
w.fps_label.setObjectName("muted")
w.fps_label.setMinimumWidth(0)
w.fps_label.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred)
w.fps_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
video_header.addWidget(w.fps_label, 1)
overlay = QCheckBox("Overlays")
overlay.setChecked(True)
overlay.setToolTip(tooltip_text('Show tracked people, detected points and the reconstructed skeleton projected through the saved camera over the video. Display only.'))
def toggle_overlay(enabled):
w.video_view.show_observations = enabled
if hasattr(w,'camera_tools'):w.camera_tools.sync()
w.video_view.update()
overlay.toggled.connect(toggle_overlay)
w.video_overlay=overlay
video_header.addWidget(overlay)
from PySide6.QtWidgets import QStackedWidget
camera_stack=QStackedWidget()
motion_panel, motion_header = editor("3D Viewport", camera_stack)
w.bone_overlay=QCheckBox('Bone Overlay')
w.bone_overlay.setChecked(True)
w.bone_overlay.setToolTip(tooltip_text('Show the skeleton used for FBX export over the motion mesh. Display only.'))
w.bone_overlay.toggled.connect(w.render_changed)
motion_header.addWidget(w.bone_overlay)
w.view_choice = QComboBox()
w.view_choice.setToolTip(tooltip_text('Choose a viewing direction. This changes the camera, not the motion.'))
w.view_choice.addItems(["Perspective", "Front", "Back", "Right", "Left", "Top", "Bottom", "Camera Preview"])
from .camera_ui import CameraTools
w.camera_tools=CameraTools(w,camera_stack,motion_header)
w.view_choice.currentTextChanged.connect(w.camera_tools.set_view)
def view_changed(name):
w.view_choice.blockSignals(True)
w.view_choice.setCurrentText(name)
w.view_choice.blockSignals(False)
w.motion_view.view_changed.connect(view_changed)
motion_header.addWidget(w.view_choice)
frame_view = button("Frame All", lambda:w.camera_tools.canvas.reset_view() if w.camera_tools.preview() else w.motion_view.frame_all(), motion_header)
frame_view.setToolTip('Fit all visible people in the 3D view.')
w.viewport_footer = QWidget()
w.viewport_footer.setObjectName("editorHeader")
w.viewport_footer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
viewport_footer = QHBoxLayout(w.viewport_footer)
viewport_footer.setContentsMargins(9, 3, 6, 3)
w.viewport_checks={}
for label, attribute in (("Floor Grid", "show_grid"), ("Correction Floor", "show_correction_floor"), ("Motion Path", "show_trajectory"),
("Lock", "show_foot_locks"), ("Name", "show_names"), ("Camera", "show_cameras")):
check = QCheckBox(label)
w.viewport_checks[attribute]=check
check.setChecked(getattr(w.motion_view, attribute))
check.setToolTip(tooltip_text({'show_grid': 'Show the reference grid at height zero. Does not change ground contact.', 'show_correction_floor': 'Show the correction floor height as an orange plane. Display only.', 'show_trajectory': 'Show the path followed by the person.', 'show_foot_locks': '', 'show_names': 'Show each person\'s name above their mesh. Rename people by right-clicking the People list. Display only.', 'show_cameras':'Show saved camera frustums and available camera motion. Display only; does not estimate or refit cameras.'}[attribute]))
if attribute=='show_names':w.name_labels=check
if attribute=='show_foot_locks':
check.setToolTip(tooltip_text('Show active foot and hand contacts as colored discs. Colors match the timeline. Display only; does not enable correction.'))
def toggle(enabled, attr=attribute):
setattr(w.motion_view, attr, enabled)
if attr=='show_cameras':w.camera_tools.sync()
w.motion_view.update()
check.toggled.connect(toggle)
viewport_footer.addWidget(check)
w.follow_actor = QCheckBox("Follow Actor")
w.follow_actor.setToolTip(tooltip_text('Move the viewing camera with the person during playback. Does not change the animation.'))
w.follow_actor.setChecked(True)
w.follow_actor.toggled.connect(w.motion_view.set_follow)
viewport_footer.addWidget(w.follow_actor)
viewport_footer.addStretch()
motion_panel.layout().addWidget(w.viewport_footer)
editors.addWidget(video_panel)
editors.addWidget(motion_panel)
editors.setSizes([460, 650])
workspace_split.addWidget(editors)
w.slider = TimelineSlider(Qt.Horizontal)
w.motion_view.foot_lock_activity = w.slider.active_contacts
w.motion_view.hand_lock_activity = w.slider.active_hand_contacts
w.slider.contacts_preview_changed.connect(w.motion_view.update)
w.slider.trim_started.connect(w.stop_playback)
w.slider.clip_changed.connect(w.clip_changed)
w.slider.contacts_edit_started.connect(w.stop_playback)
w.slider.contacts_changed.connect(w.foot_contacts_changed)
w.slider.contacts_reset.connect(w.reset_foot_contacts)
timeline_panel, timeline_header = editor("Timeline", w.slider)
w.timeline_panel = timeline_panel
timeline_panel.setMinimumHeight(260)
w.timeline_help_dialog = QMessageBox(w)
w.timeline_help_dialog.setWindowTitle("Timeline Help")
w.timeline_help_dialog.setTextFormat(Qt.PlainText)
w.timeline_help_dialog.setText(
"Click or drag the frame ruler, or drag the blue frame-number box to seek.\n"
"The thin playhead line does not capture clicks.\n"
"Wheel: zoom | Shift + wheel or MMB: pan\n\n"
"Video clip edges: trim the playback and reconstruction range.\n"
"Frame All: fit the full timeline | Reset Trim: restore the full clip.\n\n"
"L/R foot and L/R hand: drag empty space to add a lock.\n"
"Drag a lock to move it; drag its edges to resize it.\n"
"Double-click empty space to add a short lock.\n"
"Delete: remove selected lock | Ctrl+Z / Ctrl+Y: undo / redo\n"
"Right-click: editing and reset-to-automatic commands.\n\n"
"Apply Correction updates the preview motion and FBX after timing edits.")
w.timeline_help_dialog.setStandardButtons(QMessageBox.Close)
w.timeline_help_button = QPushButton("?")
w.timeline_help_button.setFixedWidth(26)
w.timeline_help_button.setAccessibleName("Timeline Help")
w.timeline_help_button.setToolTip('Show how to seek, trim and edit contact timings.')
w.timeline_help_button.clicked.connect(w.timeline_help_dialog.open)
timeline_header.insertWidget(1, w.timeline_help_button)
timeline_header.addStretch()
first = button("|<", lambda: w.step_frames(-w.slider.maximum()), timeline_header)
first.setObjectName("transport")
first.setToolTip(tooltip_text("First Frame (Home)"))
w.previous_frame = button("<", lambda: w.step_frames(-1), timeline_header)
w.previous_frame.setObjectName("transport")
w.previous_frame.setToolTip(tooltip_text("Previous Frame (Left Arrow)"))
w.play_button = button("", w.toggle_play, timeline_header)
w.play_button.setObjectName("transport")
w.play_button.setFixedWidth(34)
w.play_button.setIconSize(QSize(16, 16))
w.play_icon = QIcon(str(ROOT / "assets/icons/play.svg"))
w.pause_icon = QIcon(str(ROOT / "assets/icons/pause.svg"))
w.set_playback_indicator(False)
w.next_frame_button = button(">", lambda: w.step_frames(1), timeline_header)
w.next_frame_button.setObjectName("transport")
w.next_frame_button.setToolTip(tooltip_text("Next Frame (Right Arrow)"))
last = button(">|", lambda: w.step_frames(w.slider.maximum()), timeline_header)
last.setObjectName("transport")
last.setToolTip(tooltip_text("Last Frame (End)"))
timeline_header.addStretch()
w.frame_number = QSpinBox()
w.frame_number.setRange(1, 1)
w.frame_number.setMinimumWidth(70)
w.frame_number.setToolTip(tooltip_text("Enter a frame number to jump to it. The first frame is 1."))
w.frame_number.valueChanged.connect(lambda value: w.slider.setValue(value - 1))
timeline_header.addWidget(w.frame_number)
w.time_label = QLabel("0.00 / 0.00 s")
w.time_label.setToolTip('Current playback time / clip duration, in seconds.')
timeline_header.addWidget(w.time_label)
w.play_speed = QComboBox()
w.play_speed.setToolTip('Change preview playback speed. Exported timing stays unchanged.')
for label, speed in [("0.25x", .25), ("0.5x", .5), ("1x", 1.), ("1.5x", 1.5), ("2x", 2.)]:
w.play_speed.addItem(label, speed)
w.play_speed.setCurrentIndex(2)
w.play_speed.currentIndexChanged.connect(w.reset_play_clock)
timeline_header.addWidget(w.play_speed)
actions = QWidget()
actions.setObjectName("editorHeader")
actions.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
action_bar = QHBoxLayout(actions)
action_bar.setContentsMargins(9, 3, 6, 3)
w.clip_label = QLabel("Clip: no video")
w.clip_label.setMinimumWidth(0)
w.clip_label.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred)
action_bar.addWidget(w.clip_label, 1)
w.reset_footlocks_button=button('Reset Locks',w.reset_foot_contacts,action_bar)
w.reset_footlocks_button.setToolTip(tooltip_text('Restore automatic foot and hand contact timings for this person. Click Apply Correction to update the motion.'))
w.timeline_frame_all_button = button("Frame All", w.slider.frame_all, action_bar)
w.timeline_frame_all_button.setToolTip('Fit the full clip in the timeline.')
w.reset_trim_button = button("Reset Trim", w.slider.reset_trim, action_bar)
w.reset_trim_button.setToolTip(tooltip_text("Restore the full clip for playback and reconstruction"))
timeline_panel.layout().insertWidget(1, actions)
def frame_range(_, maximum):
w.frame_number.setMaximum(maximum + 1)
w.slider.rangeChanged.connect(frame_range)
w.slider.valueChanged.connect(w.seek)
w.slider.setRange(0, 0)
workspace_split.addWidget(timeline_panel)
workspace_split.setSizes([650, 150])
workspace_split.setStretchFactor(0, 1)
workspace_split.setStretchFactor(1, 0)
main.addWidget(workspace_split)
sidebar = QWidget()
sidebar.setObjectName("modelSidebar")
sidebar.setMinimumWidth(235)
sidebar.setMaximumWidth(330)
side_layout = QVBoxLayout(sidebar)
side_layout.setContentsMargins(4, 0, 4, 0)
side_layout.setSpacing(7)
scroll = SettingsScrollArea()
scroll.setObjectName("modelSettings")
scroll.viewport().setObjectName("modelSettingsViewport")
scroll.setWidgetResizable(True)
scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
content=QWidget();content_layout=QVBoxLayout(content)
content_layout.setContentsMargins(4,4,4,8)
content_layout.setSpacing(10)
selector = group("AI Motion Model", content_layout)
w.model_choice = QComboBox()
w.model_choice.setToolTip(tooltip_text('Choose the AI model used to create motion. Open Model Guide for a comparison.'))
for tool in MOTION_TOOLS.values():
w.model_choice.addItem(tool.label, tool.key)
w.model_choice.setCurrentIndex(w.model_choice.findData('exmr'))
w.model_choice.setItemData(w.model_choice.findData('gvhmr'), tooltip_text('GVHMR: body tracking with optional hand and foot refinement. Sometimes better for unusual poses such as backflips in our subjective tests.'), Qt.ToolTipRole)
selector.addWidget(w.model_choice)
w.htd_refine = QCheckBox("HTD Refine")
w.htd_refine.setChecked(True)
w.htd_refine.setToolTip(tooltip_text("Improve body motion consistency over time. Uses a saved result when available; otherwise run Reconstruct 3D."))
selector.addWidget(w.htd_refine)
w.refine_description = TooltipHelp("",w.htd_refine)
w.refine_description.setObjectName("muted")
w.refine_description.setWordWrap(True)
selector.addWidget(w.refine_description)
w.footmr_refine = QCheckBox("FootMR")
w.footmr_refine.setChecked(True)
w.footmr_refine.setToolTip(tooltip_text("Improve foot angles using foot keypoints, after HTD if enabled. This does not lock feet to the floor. Run Reconstruct 3D if no saved result is available."))
selector.addWidget(w.footmr_refine)
w.footmr_description = TooltipHelp("",w.footmr_refine)
w.footmr_description.setObjectName("muted")
w.footmr_description.setWordWrap(True)
selector.addWidget(w.footmr_description)
w.handflow_refine = QCheckBox("HandFlow")
w.handflow_refine.setChecked(True)
w.handflow_refine.setToolTip(tooltip_text("Add finger tracking to GVHMR without changing body or wrist motion. Requires HandFlow and MANO files in Model Manager. Run Reconstruct 3D if no saved result is available."))
selector.addWidget(w.handflow_refine)
w.handflow_refine.toggled.connect(w.refinement_changed)
w.refine_preview_note = WrappedLabel()
w.refine_preview_note.setObjectName("muted")
w.refine_preview_note.setWordWrap(True)
w.refine_preview_note.setVisible(False)
selector.addWidget(w.refine_preview_note)
model_help_row = QHBoxLayout()
model_help_row.addStretch()
w.model_help = QPushButton('? Model Guide')
w.model_help.setToolTip(tooltip_text('Compare motion quality, finger support, speed and memory use.'))
w.model_help.clicked.connect(w.show_model_guide)
model_help_row.addWidget(w.model_help)
selector.addLayout(model_help_row)
w.htd_refine.toggled.connect(w.refinement_changed)
w.footmr_refine.toggled.connect(w.refinement_changed)
w.model_pages = SettingsStack()
w.model_pages.setObjectName("modelPages")
w.model_pages.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Maximum)
w.gvhmr_page = QWidget()
w.gvhmr_page.setProperty("motion_tool", "gvhmr")
w.model_pages.addWidget(w.gvhmr_page)
w.flow_page = QWidget()
w.flow_page.setProperty('motion_tool', 'flowhmr')
flow_settings = QVBoxLayout(w.flow_page)
flow_settings.setContentsMargins(0, 0, 0, 0)
flow_settings.setSpacing(10)
flow_settings.setAlignment(Qt.AlignTop)
flow_camera = group('FlowHMR Settings', flow_settings)
w.fast_sam = QCheckBox('Fast SAM')
w.fast_sam.setChecked(True)
w.fast_sam.setToolTip(tooltip_text('Speed up image processing with the same model files. Small differences in motion and automatic contacts are possible. Applies next time you run Reconstruct 3D.'))
flow_camera.addWidget(w.fast_sam)
acceleration=group('Fast SAM Acceleration',flow_camera)
w.flow_acceleration=acceleration.parentWidget()
w.flow_batch4=QCheckBox('Adaptive Batching')
w.flow_gpu_crop=QCheckBox('GPU Hand Crops')
w.flow_hand_stride4=QCheckBox('4-Frame Hand Sampling')
w.flow_hand_stride4.setToolTip(tooltip_text('Infer hands every 4 frames and interpolate the hand features between them. Faster and uses less VRAM, but finger accuracy may decrease. Body/wrist motion and automatic contact timing can also change. Tests: 41-49% less SAM feature time and allocated VRAM 5.43 to 4.21 GiB at batch 16. Off infers hands every frame. Applies on Reconstruct 3D.'))
w.flow_batch4.setToolTip(tooltip_text('Automatic selects 1-16 frames from available VRAM/RAM and image size. Tests of 4 to 16 frames reduced warm SAM feature time by 16-23%, with allocated VRAM about 3.84 to 5.43 GiB. Low Memory and this option off use one frame. Small numerical motion differences are possible. Applies on Reconstruct 3D; whole-job gains vary.'))
w.flow_gpu_crop.setToolTip(tooltip_text('Prepare hand crops on the GPU. Short tests: about 10-15% faster SAM features, with little extra VRAM beyond the selected batch size. Different image interpolation can change motion (about 1 mm at the 95th percentile; up to 5 mm in these tests). Model precision stays unchanged. Applies on Reconstruct 3D; results vary.'))
for check in (w.flow_batch4,w.flow_gpu_crop,w.flow_hand_stride4):
check.setChecked(True)
acceleration.addWidget(check)
check.toggled.connect(lambda _: w.update_readiness())
w.fast_sam.toggled.connect(lambda _: w.update_readiness())
w.flow_hamer=QCheckBox('HaMeR Finger Refinement')
w.flow_hamer.setToolTip(tooltip_text('Use HaMeR for more accurate finger tracking with every-frame hand inference and ExMR crop/rotation smoothing. Accuracy varies; jitter can remain. Slower and uses additional VRAM. Keeps FlowHMR body, wrists and movement. Requires HaMeR and MANO files. Automatically enables Fast SAM and 4-Frame Hand Sampling. Applies on Reconstruct 3D.'))
flow_camera.addWidget(w.flow_hamer)
w.flow_hamer.toggled.connect(lambda _: w.update_readiness())
flow_camera.addWidget(QLabel('Camera / Sampling'))
w.flow_sampling = QComboBox()
for label, interval in [('Moving / Unknown - Auto', 0), ('Static Camera', -1), ('Every Frame', 1), ('Every 2 Frames', 2), ('Every 5 Frames', 5), ('Every 10 Frames', 10), ('Every 30 Frames', 30)]:
w.flow_sampling.addItem(label, interval)
w.flow_sampling.setToolTip(tooltip_text('Choose Static Camera only if the camera stays still without zooming. Otherwise start with Moving / Unknown - Auto. Frame intervals control camera analysis only; shorter intervals use more memory. Applies on Reconstruct 3D.'))
w.flow_sampling.currentIndexChanged.connect(lambda _: w.update_readiness())
flow_camera.addWidget(w.flow_sampling)
from .camera_ui import BACKGROUND_HELP
w.flowhmr_background=QCheckBox('Refine Camera Rotation')
w.flowhmr_background.setChecked(False);w.flowhmr_background.setToolTip(tooltip_text(BACKGROUND_HELP))
w.flowhmr_background.toggled.connect(w.camera_tools.background_changed)
flow_camera.addWidget(w.flowhmr_background)
flow_help = QLabel('Native SMPL-H body and hands')
flow_help.setToolTip(tooltip_text('FlowHMR: body and finger tracking. Slow, with the best overall motion quality in our subjective tests.'))
flow_camera.addWidget(flow_help)
flow_help.hide()
w.model_choice.setItemData(w.model_choice.findData('flowhmr'),tooltip_text(flow_help.toolTip()),Qt.ToolTipRole)
w.model_pages.addWidget(w.flow_page)
w.exmr_page=QWidget()
w.exmr_page.setProperty('motion_tool','exmr')
exmr_settings=QVBoxLayout(w.exmr_page)
exmr_settings.setContentsMargins(0,0,0,0)
exmr_settings.setSpacing(10)
exmr_settings.setAlignment(Qt.AlignTop)
exmr=group('ExMR Settings',exmr_settings)
exmr.addWidget(QLabel('Camera'))
w.exmr_camera=QComboBox()
w.exmr_camera.addItem('Static Camera',True)
w.exmr_camera.addItem('Moving Camera / SimpleVO',False)
w.exmr_camera.setToolTip(tooltip_text('Choose Static Camera if the camera stays still without zooming. Choose Moving Camera if it moves. Applies next time you run Reconstruct 3D.'))
exmr.addWidget(w.exmr_camera)
from .camera_ui import BACKGROUND_HELP
w.exmr_background=QCheckBox('Refine Camera Rotation')
w.exmr_background.setChecked(False);w.exmr_background.setToolTip(tooltip_text(BACKGROUND_HELP))
w.exmr_background.toggled.connect(w.camera_tools.background_changed)
exmr.addWidget(w.exmr_background)
w.exmr_smoothing=QCheckBox('Smooth Motion')
w.exmr_smoothing.setChecked(True)
w.exmr_smoothing.setToolTip(tooltip_text('Reduce small changes between frames for smoother motion. Turn off to keep the unsmoothed result. Applies next time you run Reconstruct 3D.'))
exmr.addWidget(w.exmr_smoothing)
w.model_choice.setItemData(w.model_choice.findData('exmr'),tooltip_text('ExMR: body and finger tracking. Generally fast, with good motion quality in our subjective tests.'),Qt.ToolTipRole)
w.model_pages.addWidget(w.exmr_page)
w.build_mamma_settings()
w.build_prompthmr_settings()
w.build_pear_settings()
shared_settings=QWidget()
settings = QVBoxLayout(shared_settings)
settings.setContentsMargins(0, 0, 0, 0)
settings.setSpacing(10)
settings.setAlignment(Qt.AlignTop)
correction=group('Motion Correction',settings)
w.correction_group=correction.parentWidget()
w.motion_correction=QCheckBox('Enable Correction')
w.motion_correction.setChecked(True)
w.motion_correction.setToolTip(tooltip_text('Use contact correction to reduce sliding. Off shows the uncorrected result. Click Apply Correction after changing settings or contact timings.'))
correction.addWidget(w.motion_correction)
w.correction_description=TooltipHelp('Only checked contact types are corrected.',w.motion_correction)
w.correction_description.setObjectName('muted');w.correction_description.setWordWrap(True)
correction.addWidget(w.correction_description)
w.correction_controls=QWidget()
w.correction_controls.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Maximum)
correction.addWidget(w.correction_controls)
contact=QVBoxLayout(w.correction_controls);contact.setContentsMargins(0,0,0,0);contact.setSpacing(7)
from .correction_settings import MODES
contact.addWidget(QLabel('Correction Mode'))
w.correction_mode=QComboBox()
for key,label in MODES.items():w.correction_mode.addItem(label,key)
w.correction_mode.setToolTip(tooltip_text('Flat Ground uses one floor height. Multi Level keeps each contact at its inferred height for stairs or slopes. It does not reconstruct the surfaces. Apply Correction to update.'))
contact.addWidget(w.correction_mode)
locks=QHBoxLayout();contact.addLayout(locks)
w.foot_lock=QCheckBox('Foot');w.foot_lock.setChecked(True)
w.hand_lock=QCheckBox('Hand');w.hand_lock.setChecked(False)
for checkbox in (w.foot_lock,w.hand_lock):
locks.addWidget(checkbox);checkbox.toggled.connect(w.correction_settings_changed)
w.foot_lock.setToolTip(tooltip_text('Reduce foot sliding during ground contact. Click Apply Correction to update. Turning this off keeps your saved contact timings.'))
w.hand_lock.setToolTip(tooltip_text('Reduce hand sliding when resting on a floor or table by adjusting the arm. Review contact timings in the timeline, then click Apply Correction. Does not reposition the whole body for hanging poses.'))
w.correction_preset_label=QLabel('Lock Preset');contact.addWidget(w.correction_preset_label)
w.correction_preset=QComboBox()
for key in PRESETS:w.correction_preset.addItem(key.title(),key)
w.correction_preset.setCurrentIndex(w.correction_preset.findData('normal'))
w.correction_preset.setToolTip(tooltip_text('Choose contact strength. Normal is the starting point. Apply Correction to update; manually edited timings stay unchanged.'))
contact.addWidget(w.correction_preset)
w.preset_description=TooltipHelp('',w.correction_preset,w.correction_preset_label);w.preset_description.setObjectName('muted');w.preset_description.setWordWrap(True)
contact.addWidget(w.preset_description)
contact.addWidget(QLabel('Ground Contact / Correction Floor'))
w.auto_floor=QCheckBox('Auto Floor Height');w.auto_floor.setChecked(True)
w.auto_floor.setToolTip(tooltip_text('Estimate floor height from the motion. Turn off to enter the height yourself.'))
contact.addWidget(w.auto_floor)
w.floor_height_label=QLabel('Floor Height (World Y)')
contact.addWidget(w.floor_height_label)
w.floor_height=QDoubleSpinBox();w.floor_height.setRange(-10000,10000);w.floor_height.setDecimals(3)
w.floor_height.setSingleStep(.01);w.floor_height.setSuffix(' m');w.floor_height.setEnabled(False)
w.floor_height.setToolTip(tooltip_text('Floor height in meters along the vertical Y axis. Turn off Auto Floor Height to edit. The gray reference grid stays at zero.'))
contact.addWidget(w.floor_height)
w.floor_description=TooltipHelp('Higher values raise the correction floor. Use the Correction Floor checkbox to preview it; Apply Correction updates the motion.',w.floor_height,w.floor_height_label,w.auto_floor)
w.floor_description.setObjectName('muted');w.floor_description.setWordWrap(True);contact.addWidget(w.floor_description)
w.pelvis_offset_label=QLabel('Pelvis Height Offset (from Auto)');contact.addWidget(w.pelvis_offset_label)
w.pelvis_offset=QDoubleSpinBox();w.pelvis_offset.setRange(-.25,.25);w.pelvis_offset.setDecimals(3)
w.pelvis_offset.setSingleStep(.005);w.pelvis_offset.setSuffix(' m');w.pelvis_offset.setSpecialValueText('')
contact.addWidget(w.pelvis_offset)
pelvis_description=TooltipHelp('0 keeps automatic hip height. Positive values undo some automatic lowering; negative values lower the hips further during contact. Raising can weaken foot locks. Apply Correction to update.',w.pelvis_offset,w.pelvis_offset_label)
pelvis_description.setObjectName('muted');pelvis_description.setWordWrap(True);contact.addWidget(pelvis_description)
w.pelvis_auto_note=TooltipHelp('Automatic lowering varies by frame.',w.pelvis_offset,w.pelvis_offset_label)
w.pelvis_auto_note.setObjectName('muted');contact.addWidget(w.pelvis_auto_note)
w.correction_button=button('Apply Correction',w.apply_correction,contact)
w.correction_button.setToolTip(tooltip_text('Update contact correction using these settings and timeline timings. Rebuilds the preview and export without running the AI model again.'))
w.preview_help=TooltipHelp('',w.motion_correction,w.correction_button)
correction.addWidget(w.preview_help)
w.correction_note=WrappedLabel();w.correction_note.setObjectName('muted');w.correction_note.setWordWrap(True)
w.correction_note.hide();correction.addWidget(w.correction_note)
w.motion_correction.toggled.connect(w.refinement_changed)
w.correction_mode.currentIndexChanged.connect(w.correction_settings_changed)
w.correction_preset.currentIndexChanged.connect(w.correction_settings_changed)
w.auto_floor.toggled.connect(w.correction_settings_changed)
w.floor_height.valueChanged.connect(w.correction_settings_changed)
w.pelvis_offset.valueChanged.connect(w.correction_settings_changed)
w.update_correction_description()
processing = group("Processing Resources", settings)
processing.addWidget(QLabel('Resource Mode'))
w.compute_mode = QComboBox()
w.compute_mode.addItem("Automatic", "auto")
w.compute_mode.addItem("Low Memory", "low_memory")
w.compute_mode.setToolTip(tooltip_text("Automatic uses the fast path when memory is available and switches supported stages to Low Memory when needed. Low Memory uses CPU loading and offloading; it can be slower and use more RAM. Model precision and video frames are unchanged."))
processing.addWidget(w.compute_mode)
from .resource_safety import ENV,HELP,load
import os
w.resource_safety=QCheckBox('Resource Safety')
w.resource_safety.setChecked(load())
os.environ[ENV]='1' if w.resource_safety.isChecked() else '0'
w.resource_safety.setToolTip(tooltip_text(HELP))
w.resource_safety.toggled.connect(w.resource_safety_changed)
processing.addWidget(w.resource_safety)
resource_description=TooltipHelp('',w.compute_mode)
resource_description.setObjectName('muted');resource_description.setWordWrap(True);processing.addWidget(resource_description)
setup = group("GVHMR Models", settings)
w.models_group=setup.parentWidget()
w.readiness = WrappedLabel()
w.readiness.setWordWrap(True)
w.readiness.setObjectName("muted")
setup.addWidget(w.readiness)
w.models_button = button("Model Manager", w.open_model_manager, setup)
w.models_button.setToolTip('Download or import the files needed by the selected AI model.')
shared_settings.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Maximum)
content_layout.addWidget(w.model_pages)
content_layout.addWidget(shared_settings)
scroll.setWidget(content)
side_layout.addWidget(scroll, 1)
w.model_actions = QFrame()
w.model_actions.setObjectName("modelActions")
action_buttons = QVBoxLayout(w.model_actions)
action_buttons.setContentsMargins(0, 0, 0, 0)
action_buttons.setSpacing(7)
w.analyze_button = button("Analyze 2D", w.run_analysis, action_buttons)
w.analyze_button.setToolTip(tooltip_text("Find body points in the video for GVHMR refinement. Reconstruct 3D normally includes this step when needed."))
w.run_button = button("Reconstruct 3D", w.run_full, action_buttons)
w.run_button.setToolTip(tooltip_text('Create 3D motion for checked people in the trimmed video range using the selected model and settings. Reuses valid completed steps.'))
w.run_button.setObjectName("primary")
w.mesh_button = button("Prepare Preview", w.prepare_mesh, action_buttons)
w.mesh_button.setToolTip(tooltip_text('Prepare the 3D mesh and skeleton from the selected motion result. Available after reconstruction; does not run AI inference again.'))
w.cancel_button = button("Cancel Job", w.cancel_job, action_buttons)
w.cancel_button.setToolTip('Stop the current processing queue. Completed results are kept.')
w.cancel_button.setEnabled(False)
w.model_actions.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Maximum)
content_layout.addWidget(w.model_actions)
content_layout.addStretch()
w.settings_scroll=scroll
w.model_choice.currentIndexChanged.connect(w.select_model)
main.addWidget(sidebar)
main.setSizes([1120, 260])
main.setStretchFactor(0, 1)
main.setStretchFactor(1, 0)
root.addWidget(main, 1)
w.progress = QProgressBar()
w.progress.setFixedHeight(6)
w.progress.setValue(0)
w.progress.setTextVisible(False)
root.addWidget(w.progress)
footer = QHBoxLayout()
w.status = QLabel("Ready. Open a video or a project.")
w.status.setObjectName("status")
w.status.setMinimumWidth(0)
w.status.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred)
footer.addWidget(w.status, 1)
w.task_info=QLabel('')
w.task_info.setObjectName('taskInfo')
w.task_info.setToolTip(tooltip_text('Step left estimates time for the current step; Total left estimates the remaining queue. Estimates appear once enough timing data is available and may change.'))
footer.addWidget(w.task_info)
w.log = ConsoleLog()
from .resource_safety import message
w.log.append(message(w.resource_safety.isChecked()))
w.log.setReadOnly(True)
w.log.setUndoRedoEnabled(False)
w.log.document().setMaximumBlockCount(500)
w.log.setMaximumHeight(110)
w.log.setVisible(False)
w.details = button("Console", lambda: w.log.setVisible(not w.log.isVisible()), footer)
w.details.setToolTip('Show or hide processing details and error messages.')
root.addLayout(footer)
root.addWidget(w.log)
file_menu = w.menuBar().addMenu("File")
w.open_actions = [file_menu.addAction("Open Video...", w.choose_video), file_menu.addAction("Open Project...", w.choose_project)]
w.import_character_action=file_menu.addAction('Import Character...',w.choose_character)
w.import_character_action.setToolTip('Import a Mixamo FBX, VRM or PMX humanoid. Right-click its People row to retarget a source person.')
w.save_project_action = file_menu.addAction('Save Project As...', w.save_project_as)
w.save_project_action.setShortcut('Ctrl+Shift+S')
w.save_project_action.setToolTip(tooltip_text('Save a separate project folder with a new name and location, including its video, motion and settings. Continue working in the saved copy.'))
file_menu.addSeparator()
w.export_action = file_menu.addAction("Export...", w.save_fbx)
w.export_action.setToolTip(tooltip_text('Export the displayed motion as FBX, BVH or a portable Blender project. Multiple people export separately; MAMMA also offers a whole-scene Blender bundle.'))
w.export_preview_action = file_menu.addAction('Export Preview...', w.save_preview)
w.export_preview_action.setToolTip(tooltip_text('Save the selected input video beside the current 3D viewport as MP4 over the timeline trim. Keeps the current view, visible people/characters and viewport overlays. Includes source audio when available. Not available in PEAR live mode.'))
w.export_preview_action.setEnabled(False)
file_menu.addAction("Open Project Folder", w.open_folder)
file_menu.addSeparator()
file_menu.addAction("Exit", w.close)
help_menu = w.menuBar().addMenu("Help")
w.check_system_action = help_menu.addAction("Check System", lambda: w.start_jobs([("diagnose", [])]))
help_menu.addAction("Controls", lambda: QMessageBox.information(w, "Workspace Controls",
"Space: Play / Pause\nLeft / Right: Step one frame\nShift + Left / Right: Step one second\nHome / End: First / last frame\n\nViewport: LMB orbit, MMB / RMB pan, wheel zoom\nGizmo: click an axis to align the view\nTimeline: drag video clip edges to trim\nClick the frame ruler or drag the blue frame box to seek\nWheel to zoom; MMB to pan; Reset Trim restores the full clip\nClick ? in the timeline header for editing help.\nPlayback and reconstruction use the selected video clip range.\n\nThe mesh shows the selected motion result.\nFlowHMR and ExMR track fingers directly. GVHMR uses optional HandFlow for finger tracking.\nUse File > Export to choose FBX, BVH or a portable Blender project and save the displayed animation."))
menu_help = {
'Open Video...': 'Choose a video to create motion from.',
'Open Project...': 'Open saved motion and settings without reconstructing the video.',
'Open Project Folder': 'Open the current project folder in File Explorer.',
'Exit': 'Close RGB MoCap.',
'Check System': 'Check hardware and required software. Results appear in the Console.',
'Controls': 'Show keyboard shortcuts and workspace controls.',
}
for menu in (file_menu, help_menu):
menu.setToolTipsVisible(True)
for action in menu.actions():
if action.text() in menu_help:
action.setToolTip(tooltip_text(menu_help[action.text()]))