Present replay 3D with the cursor and open Analyze on a remembered video

Replay left the 3D pane on the rest mesh or a sparse overlay, and Analyze skipped the setup dialog unless the file was re-picked. Live Run no longer starts a chain on a video path. Verified with Studio tests for flush, overlay mask, Analyze open, live-video refusal, and locales.
This commit is contained in:
ykcheungab
2026-10-05 16:52:27 +08:00
parent 3433eb0fec
commit c0a10e6adb
26 changed files with 2226 additions and 158 deletions
@@ -2,6 +2,8 @@
from __future__ import annotations
from dataclasses import replace
import numpy as np
from orisys_app_shared.scene3d.composer import SceneComposer
from orisys_app_shared.scene3d.contracts import (
@@ -152,3 +154,36 @@ def test_both_views_build_their_policy_from_the_same_settings() -> None:
# Normalised, so a hand-edited preference cannot invert the hysteresis band.
inverted = policy_for_settings(DisplaySettings(flow_on_px=0.1, flow_off_px=0.9))
assert inverted.flow_on_px >= inverted.flow_off_px
def test_a_sparse_recovered_field_still_draws_3d_arrows() -> None:
"""A recovered analysis field is ``NaN`` off the stored grid; tips land there.
Handing ``isfinite(flow)`` as the overlay mask required the tip to sit on another
stored cell, so replay 3D kept a few rim dots while 2D drew the island grid.
"""
assets = poc_scene()
h, w = assets.shape_hw
flow = np.full((h, w, 2), np.nan, dtype=np.float32)
flow[1, 1] = (0.9, 0.0)
settings = DisplaySettings(
flow_arrows_enabled=True,
contact_arrow_enabled=False,
flow_grid_spacing=1,
flow_on_px=0.4,
flow_off_px=0.3,
max_arrows=50,
)
dropped = SceneComposer().compose(
assets,
replace(
_depth_frame(assets, flow=flow),
flow_valid_mask=freeze(np.isfinite(flow[..., 0]), dtype=np.bool_),
),
settings,
)
n_dropped = 0 if dropped.flow_arrows is None else int(dropped.flow_arrows.origins.shape[0])
drawn = SceneComposer().compose(assets, _depth_frame(assets, flow=flow), settings)
n_drawn = 0 if drawn.flow_arrows is None else int(drawn.flow_arrows.origins.shape[0])
assert n_drawn >= 1, "the island mask still produced no 3D arrows"
assert n_drawn > n_dropped, (n_drawn, n_dropped)