Skip to content

Replace drag-point editing with Unity splines#567

Draft
freezy wants to merge 7 commits into
masterfrom
refactor/splines
Draft

Replace drag-point editing with Unity splines#567
freezy wants to merge 7 commits into
masterfrom
refactor/splines

Conversation

@freezy

@freezy freezy commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • convert VPX drag points losslessly to Unity Splines while preserving per-point metadata
  • migrate supported table components and editor tooling to native spline knot workflows
  • exclude generated spline helpers from table packages and reconcile missing or duplicate helpers deterministically

This PR fixes #541.

Tests

  • Unity EditMode: DragPointSplineComponentTests (11 passed)
  • Unity EditMode: RubberTests.ShouldKeepGeneratedSplinesOutOfPackageRoundTrips (passed)

freezy added 6 commits July 10, 2026 21:45
Record byte-exact goldens for every drag-point geometry consumer, including
surface, ramp, rubber, wire guide, trigger-outline, and light-insert output.
The fixtures include vertex positions, normals, UVs, indices, and control-point
metadata so later storage and editor changes cannot alter generated geometry.

Exercise open and closed curves across smooth flags and accuracy levels in both
two and three dimensions. A VPX export/reload matrix also compares every BIFF
field for all six Unity-backed item types, separating serialized semantics from
the runtime-only IDs and calculated ramp heights.
Depend on Unity Splines 2.8.2 and expose it to the runtime, editor, and test
assemblies. Convert raw VPX knot positions to broken Bezier knots with tangents
ported from VPE's centripetal Catmull-Rom coefficients, preserving the exact
curve while keeping the source floats out of coordinate-space round trips.

Store every semantic and runtime drag-point field in serializable per-knot
metadata, and rebuild derived tangents after knot edits. Edit-mode tests cover
bit-identical data round trips, sampled Catmull-Rom/Bezier equivalence for open
and closed curves, and rejection of authored tangent changes.
Move Rubber, Trigger, Surface, MetalWireGuide, LightInsertMesh, and Ramp onto a
shared child SplineContainer with index-aligned VPE metadata. Legacy arrays now
upgrade lazily, while mesh, collider, packable, and VPX export consumers keep
reading computed DragPointData arrays and therefore retain their existing APIs.

Place spline children under the exact VPX-to-Unity basis so knot floats remain
verbatim in serialized data. Centralize insert/remove metadata alignment,
derived-tangent restoration, planar constraints, Undo/prefab recording, and
mesh invalidation; retain Ramp's endpoint Z-to-height behavior and cover the
migration with edit-mode component tests.
Route all six drag-point inspectors through Unity's spline tool context and
expose VPE metadata for the selected knots. Smoothness remains VPE-authored,
while slingshot and texture fields stay aligned with native knot selection.

Keep the established flip, reverse, and center-origin operations, including
closed-loop orientation and slingshot rotation. Draw segment ownership and
knot indices over the native gizmo, and cover the subtle transforms with
editor tests.
Delete the custom control-point selection, curve traveller, context menus, and
scene-view renderer now that Unity Splines owns knot editing. Remove the old
inspector contract and its drag-point-only handle utility as well.

Keep the remaining flip-axis detail local to the spline inspector so the new
editor path no longer references any part of the retired handle stack.
@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown

Greptile Summary

This PR replaces drag-point editing with Unity spline workflows. The main changes are:

  • Conversion between VPX drag points and Unity splines.
  • Runtime components for generated drag-point spline helpers.
  • Editor tooling for spline editing and per-knot metadata.
  • Package handling for generated spline helper objects.
  • Golden and Unity tests for geometry and round trips.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
VisualPinball.Unity/VisualPinball.Unity/DragPoint/DragPointSplineConverter.cs Adds conversion and tangent recalculation for Unity spline-backed drag points.
VisualPinball.Unity/VisualPinball.Unity/DragPoint/DragPointSplineComponent.cs Adds the runtime bridge between spline edits, metadata, and owning table components.
VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointSplineInspector.cs Adds editor controls for spline editing, transforms, and selected-knot metadata.

Reviews (2): Last reviewed commit: "splines: suppress derived tangent notifi..." | Re-trigger Greptile

Comment thread VisualPinball.Unity/VisualPinball.Unity/DragPoint/DragPointSplineConverter.cs Outdated
@freezy

freezy commented Jul 13, 2026

Copy link
Copy Markdown
Owner Author

Follow-up: tangent notifications are fixed in be7e501. Inserted points remain unlocked to preserve legacy insertion behavior; ramp calculated heights are derived again during the required mesh rebuild.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewrite Drag Point Tooling Using Splines

1 participant