fix(viewer): preserve follow camera across layer toggles

This commit is contained in:
DCCONSTRUCTIONS
2026-07-23 17:14:32 +03:00
parent a7babf60db
commit ae2ce055c8
7 changed files with 292 additions and 56 deletions
+53 -1
View File
@@ -465,6 +465,12 @@ def test_recorded_follow_mode_tracks_sensor_pose_with_the_same_orbital_eye() ->
include_initial_playback_state=False,
follow_trajectory=True,
)
layer_only_update = viewer_recorded_blueprint(
RerunSceneSettings(show_grid=False),
include_initial_playback_state=False,
follow_trajectory=True,
update_eye_controls=False,
)
normal_view = normal.root_container.contents[0]
followed_view = followed.root_container.contents[0]
@@ -482,6 +488,8 @@ def test_recorded_follow_mode_tracks_sensor_pose_with_the_same_orbital_eye() ->
assert followed_view.id == RECORDED_SPATIAL_VIEW_ID
assert followed_again.root_container.contents[0].id == RECORDED_SPATIAL_VIEW_ID
assert followed_view.id == normal_view.id
assert "EyeControls3D" not in layer_only_update.root_container.contents[0].properties
assert "EyeControls3D" not in layer_only_update.root_container.contents[2].properties
assert normal_components == {
"EyeControls3D:tracking_entity": [""],
}
@@ -495,7 +503,9 @@ def test_recorded_blueprint_layer_updates_preserve_store_until_explicit_reset(
monkeypatch: pytest.MonkeyPatch,
) -> None:
activations: list[tuple[object, bool, bool]] = []
eye_control_updates: list[bool] = []
send_blueprint = viewer_recorded_module.bindings.send_blueprint
make_blueprint = viewer_recorded_module.recorded_blueprint
def capture_activation(
storage: object,
@@ -511,6 +521,16 @@ def test_recorded_blueprint_layer_updates_preserve_store_until_explicit_reset(
"send_blueprint",
capture_activation,
)
def capture_eye_control_update(*args: object, **kwargs: object) -> object:
eye_control_updates.append(bool(kwargs["update_eye_controls"]))
return make_blueprint(*args, **kwargs)
monkeypatch.setattr(
viewer_recorded_module,
"recorded_blueprint",
capture_eye_control_update,
)
session_id = "b" * 32
initial = viewer_recorded_blueprint_rrd(
RerunSceneSettings(accumulation_seconds=12.0),
@@ -527,6 +547,26 @@ def test_recorded_blueprint_layer_updates_preserve_store_until_explicit_reset(
show_segmentation=True,
show_cuboids_3d=True,
)
follow_enabled = viewer_recorded_blueprint_rrd(
RerunSceneSettings(accumulation_seconds=12.0),
recording_id="stable-camera",
blueprint_session_id=session_id,
unified_perception=True,
show_detections_2d=True,
show_segmentation=True,
show_cuboids_3d=True,
follow_trajectory=True,
)
layer_disabled_while_following = viewer_recorded_blueprint_rrd(
RerunSceneSettings(accumulation_seconds=12.0),
recording_id="stable-camera",
blueprint_session_id=session_id,
unified_perception=True,
show_detections_2d=False,
show_segmentation=True,
show_cuboids_3d=True,
follow_trajectory=True,
)
reset = viewer_recorded_blueprint_rrd(
RerunSceneSettings(accumulation_seconds=12.0),
recording_id="stable-camera",
@@ -536,25 +576,37 @@ def test_recorded_blueprint_layer_updates_preserve_store_until_explicit_reset(
show_detections_2d=True,
show_segmentation=True,
show_cuboids_3d=True,
follow_trajectory=True,
)
store_pattern = rb"rec_[0-9a-f]{32}"
initial_store_ids = set(re.findall(store_pattern, initial))
layer_store_ids = set(re.findall(store_pattern, layers_enabled))
follow_store_ids = set(re.findall(store_pattern, follow_enabled))
followed_layer_store_ids = set(re.findall(store_pattern, layer_disabled_while_following))
reset_store_ids = set(re.findall(store_pattern, reset))
assert len(initial_store_ids) == 1
assert layer_store_ids == initial_store_ids
assert follow_store_ids == initial_store_ids
assert followed_layer_store_ids == initial_store_ids
assert len(reset_store_ids) == 1
assert reset_store_ids.isdisjoint(initial_store_ids)
assert eye_control_updates == [True, False, True, False, True]
assert [activation[1:] for activation in activations] == [
(True, False),
(True, False),
(True, False),
(True, False),
(True, False),
]
assert activations[0][0] is activations[1][0]
assert activations[2][0] is not activations[0][0]
assert activations[2][0] is activations[0][0]
assert activations[3][0] is activations[0][0]
assert activations[4][0] is not activations[0][0]
assert len(initial) < 350_000
assert len(layers_enabled) < 350_000
assert len(follow_enabled) < 350_000
assert len(layer_disabled_while_following) < 350_000
assert len(reset) < 350_000