Skip to content

Commit 673e618

Browse files
mgthclaude
andcommitted
feat(studio): trail teleport threshold + bump 0.2.6
- New Trails control: `Teleport threshold` (slider, normalised XYZ units, default 0.5, range 0.05–2.0). Persisted alongside the existing trail prefs in localStorage; loaded back into the UI on startup. - 3D view: when the displacement between two consecutive trail points exceeds the threshold, the connecting segment is dropped. Buffer is kept so the trail resumes from the new position. Implemented at rebuild time off the raw consecutive XYZ — moving the slider takes effect on already-buffered points without invalidating history. - Line mode now uses `THREE.LineSegments` rather than `THREE.Line`, so breaks can be honoured cleanly (one vertex pair per visible edge) without hacks like NaN positions or two-Line objects. - Diffuse mode skips the interpolated dots across a broken segment but keeps the endpoint dots themselves, so the trail visibly gaps without swallowing the new position. - mpv overlay relay: extend `pushMpvOverlayTrailPrefs` / `mpv_overlay_set_trail_prefs` Tauri command / `TrailPrefs` Rust struct / `trail-config` IPC wire format with a 4th field carrying the threshold. Lua side honours it identically; the older 3-field shape is still accepted for back-compat. - i18n: add `trail.teleport` label in en / fr / es / pt-BR. - Bump Studio to 0.2.6 (package.json, tauri.conf.json, Cargo.toml, Cargo.lock). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 00d64bf commit 673e618

16 files changed

Lines changed: 140 additions & 32 deletions

File tree

omniphony-studio/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "omniphony-studio",
3-
"version": "0.2.5",
3+
"version": "0.2.6",
44
"description": "Visualisation 3D d'objets audio spatialisés via OSC",
55
"scripts": {
66
"dev": "vite",

omniphony-studio/src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

omniphony-studio/src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "omniphony-studio"
3-
version = "0.2.5"
3+
version = "0.2.6"
44
edition = "2021"
55

66
[[bin]]

omniphony-studio/src-tauri/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,11 +2363,13 @@ fn mpv_overlay_set_trail_prefs(
23632363
enabled: bool,
23642364
ttl_ms: u32,
23652365
mode: String,
2366+
teleport_threshold: f32,
23662367
) -> Result<(), String> {
23672368
state.mpv_overlay.set_trail_prefs(TrailPrefs {
23682369
enabled,
23692370
ttl_ms,
23702371
mode,
2372+
teleport_threshold,
23712373
})
23722374
}
23732375

omniphony-studio/src-tauri/src/mpv_overlay.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ pub struct TrailPrefs {
7979
pub ttl_ms: u32,
8080
/// "diffuse" or "line"; anything else falls back to "line" lua-side.
8181
pub mode: String,
82+
/// Max XYZ displacement (normalised units) between two consecutive
83+
/// trail points before the connecting segment is treated as a
84+
/// teleport and skipped lua-side.
85+
pub teleport_threshold: f32,
8286
}
8387

8488
impl MpvOverlayState {
@@ -109,11 +113,16 @@ impl MpvOverlayState {
109113
"diffuse" => "diffuse",
110114
_ => "line",
111115
};
116+
// Clamp the threshold to the same range Studio uses, then format
117+
// with a few decimals — the lua parser is strict about the wire
118+
// format and won't accept scientific notation.
119+
let threshold = prefs.teleport_threshold.clamp(0.0, 4.0);
112120
let line = format!(
113-
r#"{{"command":["set_property","user-data/omniphony/overlay/trail-config","{}|{}|{}"]}}"#,
121+
r#"{{"command":["set_property","user-data/omniphony/overlay/trail-config","{}|{}|{}|{:.3}"]}}"#,
114122
if prefs.enabled { 1 } else { 0 },
115123
prefs.ttl_ms,
116-
mode
124+
mode,
125+
threshold
117126
);
118127
self.send_line(line)
119128
}

omniphony-studio/src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"identifier": "fr.omniphony.studio",
33
"productName": "Omniphony Studio",
4-
"version": "0.2.5",
4+
"version": "0.2.6",
55
"build": {
66
"frontendDist": "../dist",
77
"devUrl": "http://localhost:5173",

omniphony-studio/src/controls/room-geometry.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ function getTrailToggleEl() { return inDisplayPanel('trailToggle'); }
5656
function getTrailModeSelectEl() { return inDisplayPanel('trailModeSelect'); }
5757
function getTrailTtlSliderEl() { return inDisplayPanel('trailTtlSlider'); }
5858
function getTrailTtlValEl() { return inDisplayPanel('trailTtlVal'); }
59+
function getTrailTeleportSliderEl() { return inDisplayPanel('trailTeleportSlider'); }
60+
function getTrailTeleportValEl() { return inDisplayPanel('trailTeleportVal'); }
5961
function getEffectiveRenderToggleEl() { return inDisplayPanel('effectiveRenderToggle'); }
6062
function getObjectColorsToggleEl() { return inDisplayPanel('objectColorsToggle'); }
6163
function getObjectDisplayModeSelectEl() { return inDisplayPanel('objectDisplayModeSelect'); }
@@ -122,7 +124,8 @@ export function persistTrailPrefs() {
122124
const payload = {
123125
enabled: app.trailsEnabled,
124126
mode: app.trailRenderMode === 'line' ? 'line' : 'diffuse',
125-
duration_ms: app.trailPointTtlMs
127+
duration_ms: app.trailPointTtlMs,
128+
teleport_threshold: app.trailTeleportThreshold
126129
};
127130
localStorage.setItem(TRAIL_PREFS_STORAGE_KEY, JSON.stringify(payload));
128131
} catch (_e) {
@@ -157,6 +160,8 @@ export function applyTrailPrefsToUi() {
157160
const trailModeSelectEl = getTrailModeSelectEl();
158161
const trailTtlSliderEl = getTrailTtlSliderEl();
159162
const trailTtlValEl = getTrailTtlValEl();
163+
const trailTeleportSliderEl = getTrailTeleportSliderEl();
164+
const trailTeleportValEl = getTrailTeleportValEl();
160165
if (trailToggleEl) {
161166
trailToggleEl.checked = app.trailsEnabled;
162167
}
@@ -169,6 +174,12 @@ export function applyTrailPrefsToUi() {
169174
if (trailTtlValEl) {
170175
trailTtlValEl.textContent = `${(app.trailPointTtlMs / 1000).toFixed(1)}s`;
171176
}
177+
if (trailTeleportSliderEl) {
178+
trailTeleportSliderEl.value = app.trailTeleportThreshold.toFixed(2);
179+
}
180+
if (trailTeleportValEl) {
181+
trailTeleportValEl.textContent = app.trailTeleportThreshold.toFixed(2);
182+
}
172183
}
173184

174185
export function applyEffectiveRenderPrefsToUi() {
@@ -254,6 +265,10 @@ export function loadTrailPrefs() {
254265
if (Number.isFinite(durationMs)) {
255266
app.trailPointTtlMs = Math.max(500, durationMs);
256267
}
268+
const teleport = Number(parsed?.teleport_threshold);
269+
if (Number.isFinite(teleport)) {
270+
app.trailTeleportThreshold = Math.max(0.05, Math.min(2.0, teleport));
271+
}
257272
} catch (_e) {
258273
// Ignore malformed payloads.
259274
}

omniphony-studio/src/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
"trail.show": "Show",
212212
"trail.mode": "Mode",
213213
"trail.duration": "Duration",
214+
"trail.teleport": "Teleport threshold",
214215
"trail.mode.diffuse": "Diffuse",
215216
"trail.mode.line": "Line",
216217
"effectiveRender.title": "Effective render",

omniphony-studio/src/i18n/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
"trail.show": "Mostrar",
187187
"trail.mode": "Modo",
188188
"trail.duration": "Duración",
189+
"trail.teleport": "Umbral de teletransporte",
189190
"trail.mode.diffuse": "Difuso",
190191
"trail.mode.line": "Línea",
191192
"effectiveRender.title": "Render efectivo",

omniphony-studio/src/i18n/fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
"trail.show": "Afficher",
212212
"trail.mode": "Mode",
213213
"trail.duration": "Durée",
214+
"trail.teleport": "Seuil de téléportation",
214215
"trail.mode.diffuse": "Diffuse",
215216
"trail.mode.line": "Ligne",
216217
"effectiveRender.title": "Rendu effectif",

0 commit comments

Comments
 (0)