Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
032fdfb
Add the design for warp handles, feathering and grid contrast
nimerix Nov 18, 2026
a442cdc
Add a logarithmic slider and a part size helper for Warp
nimerix Nov 18, 2026
5cf0769
Give Warp its own brush radius, fitted to the part
nimerix Nov 18, 2026
ac62dfc
Draw the warp grid with a dark core and light casing
nimerix Nov 18, 2026
0271454
Add a feathered edge to painted warp regions
nimerix Nov 18, 2026
8484ea9
Add warp handles with radius and falloff, and automatic points
nimerix Nov 18, 2026
379682e
Trace the warp grid over the surface and keep a brush radius per part
nimerix Nov 18, 2026
78cffec
Fix feathered region growth and smooth warp skinning
nimerix Nov 18, 2026
7bb11c2
Anchor feathered regions by a fixed edge and show one feather warning
nimerix Nov 18, 2026
108b5e6
Rework warp handle guides around baseline snapshots
nimerix Nov 18, 2026
6df8767
Hide the warp grid behind nearer surfaces and lighten its lines
nimerix Nov 18, 2026
ce745ae
Land dragged warp points on target and bake what Apply shows
nimerix Nov 18, 2026
6abfeee
Carry scan vertices with stretching maps on an even warp grid
nimerix Nov 18, 2026
38df085
Fade a handle's bend into a fixed edge and weight the warp solve by c…
nimerix Nov 18, 2026
7bcd968
Re-choose warp grid points on the bent surface and draw reach dots ab…
nimerix Nov 18, 2026
3626139
Keep every warp grid crossing and leave the camera's depth range fixed
nimerix Nov 18, 2026
752d5f3
Stop warp grabs short at fixed edges and make density changes undoable
nimerix Nov 19, 2026
1c0ab6a
Add line and area warp handles drawn by a stroke
nimerix Nov 19, 2026
77e93d4
Make region re-lays undoable and fix warp stroke edge cases
nimerix Nov 19, 2026
ec22247
Lighten the warp grid as it gets denser and drop fans into fixed edges
nimerix Nov 19, 2026
486773b
Restore feather, paint and selection with warp undo
nimerix Nov 19, 2026
f642c65
Bind warp line footprints to the drawn path and show mixed handle set…
nimerix Nov 19, 2026
9196506
Narrow zero-radius warp lines and let mixed sliders reach zero
nimerix Nov 19, 2026
5997b6c
Set a mixed warp slider to zero only on a primary click
nimerix Nov 19, 2026
70de03f
Add the release note for warp handles, lines and the grid
nimerix Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
572 changes: 572 additions & 0 deletions docs/superpowers/specs/2026-11-17-warp-handles-design.md

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,8 @@ function StatusBar() {
navigationMode = useEditor((s) => (s.temporaryOrbit ? 'orbit' : s.navigationMode)),
indexing = useEditor((s) => s.indexingMeshes > 0),
live = useEditor((s) => s.liveStatus),
warpStage = useEditor((s) => (s.tool === 'warp' ? s.warp?.stage : undefined));
warpStage = useEditor((s) => (s.tool === 'warp' ? s.warp?.stage : undefined)),
warpAdd = useEditor((s) => s.warpAdd);
const hold = useShortcut('holdOrbit'),
cancel = useShortcut('cancel'),
pivot = useShortcut('pivot'),
Expand Down Expand Up @@ -652,7 +653,11 @@ function StatusBar() {
: surfacePainting
? `Drag to paint · Alt erases${smaller || larger ? ` · ${[smaller, larger].filter(Boolean).join(' / ')} brush size` : ''} · ${orbitHint} orbits`
: warpStage === 'warp'
? 'Click the surface to add a control point · Drag a handle to warp · Shift for fine adjustment'
? warpAdd === 'line'
? `Drag on the surface to draw a line · Esc discards it · ${orbitHint} orbits`
: warpAdd === 'area'
? `Drag to paint an area${smaller || larger ? ` · ${[smaller, larger].filter(Boolean).join(' / ')} brush size` : ''} · Esc discards it · ${orbitHint} orbits`
: 'Click the surface to add a control point · Drag a handle to warp · Shift for fine adjustment'
: warpStage
? `Paint the area to warp, or choose Whole part · Alt erases · ${orbitHint} orbits`
: tool === 'align'
Expand Down
53 changes: 38 additions & 15 deletions src/components/SurfaceBrushControls.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import { Eraser, Paintbrush, Undo2 } from 'lucide-react';
import { useEditor } from '../core/store';
import { NumericInput } from './ui';
import { LogRangeInput, NumericInput } from './ui';

export function SurfaceBrushControls() {
const radius = useEditor((state) => state.brushRadius),
type EditorState = ReturnType<typeof useEditor.getState>;

/** With `fitted`, the radius is the caller's and the slider is logarithmic over its range. */
export function SurfaceBrushControls({
fitted,
}: {
fitted?: {
radius: (state: EditorState) => number;
range: { min: number; max: number };
set: (radius: number) => void;
};
} = {}) {
const radius = useEditor((state) => (fitted ? fitted.radius(state) : state.brushRadius)),
setRadius = fitted?.set ?? ((radius: number) => useEditor.getState().setBrush({ radius })),
erase = useEditor((state) => state.brushErase),
history = useEditor((state) => state.paintHistory),
plane = useEditor((state) => state.brushPlane);
Expand Down Expand Up @@ -40,21 +52,32 @@ export function SurfaceBrushControls() {
value={radius}
min={0.05}
max={100}
step={0.5}
onCommit={(value) => useEditor.getState().setBrush({ radius: value })}
step={fitted ? 0.1 : 0.5}
onCommit={setRadius}
/>
<small>mm</small>
</label>
<input
className="brush-radius-slider"
aria-label="Brush radius slider"
type="range"
min={0.1}
max={20}
step={0.1}
value={Math.min(radius, 20)}
onChange={(event) => useEditor.getState().setBrush({ radius: Number(event.target.value) })}
/>
{fitted ? (
<LogRangeInput
className="brush-radius-slider"
label="Brush radius slider"
value={radius}
min={fitted.range.min}
max={fitted.range.max}
onChange={setRadius}
/>
) : (
<input
className="brush-radius-slider"
aria-label="Brush radius slider"
type="range"
min={0.1}
max={20}
step={0.1}
value={Math.min(radius, 20)}
onChange={(event) => setRadius(Number(event.target.value))}
/>
)}
<div className="plane-brush-settings">
<div className="appearance-row">
<span>Stay on seed plane</span>
Expand Down
22 changes: 14 additions & 8 deletions src/components/SurfacePainter.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { useEffect, useMemo } from 'react';
import { DoubleSide, MeshBasicMaterial, Quaternion, Vector3 } from 'three';
import { paintingWarpRegion, useEditor } from '../core/store';
import { paintingWarpArea, paintingWarpRegion, useEditor, warpBrushRadius } from '../core/store';
import { contactColors, patchGeometry } from '../core/surfaces';
import { worldNormal, worldPoint } from '../core/geometry';
import { solveAlignment } from '../core/alignment';
import { partDisplay } from '../core/alignment-visibility';
import type { Part, SurfacePatch, SurfacePoint } from '../core/types';
import { pointAccent } from './WarpStroke';

export const warpRegionColor = '#80cbc4';

Expand Down Expand Up @@ -123,15 +124,18 @@ function FlushPreview() {
}

export function PaintCursor({ part, hit }: { part: Part; hit: SurfacePoint | null }) {
const radius = useEditor((s) => s.brushRadius),
const radius = useEditor((s) =>
paintingWarpRegion(s) || paintingWarpArea(s) ? warpBrushRadius(s) : s.brushRadius,
),
erase = useEditor((s) => s.brushErase),
op = useEditor((s) => s.operation),
tool = useEditor((s) => s.tool),
navigationMode = useEditor((s) => (s.temporaryOrbit ? 'orbit' : s.navigationMode)),
pivotPicking = useEditor((s) => s.pivotPicking);
const warpRegion = useEditor((s) => paintingWarpRegion(s) && s.warp!.partId === part.id);
const warpArea = useEditor((s) => paintingWarpArea(s) && s.warp!.partId === part.id);
const contact = tool === 'align' && op.mode === 'surface' && !!op.activeSurface;
if (!hit || (!contact && !warpRegion) || navigationMode || pivotPicking) return null;
if (!hit || (!contact && !warpRegion && !warpArea) || navigationMode || pivotPicking) return null;
const index = op.surfacePairs.findIndex((pair) => pair.id === op.activeSurface?.pairId);
const normal = worldNormal(part, hit),
position = worldPoint(part, hit).addScaledVector(normal, 0.03);
Expand All @@ -142,11 +146,13 @@ export function PaintCursor({ part, hit }: { part: Part; hit: SurfacePoint | nul
<ringGeometry args={[radius, radius + Math.max(radius * 0.025, 0.035), 64]} />
<meshBasicMaterial
color={
erase
? '#f18c8c'
: warpRegion
? warpRegionColor
: contactColors[index % contactColors.length]
warpArea
? pointAccent
: erase
? '#f18c8c'
: warpRegion
? warpRegionColor
: contactColors[index % contactColors.length]
}
side={DoubleSide}
depthTest={false}
Expand Down
13 changes: 10 additions & 3 deletions src/components/Viewport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
import {
isWarpDragging,
measureDistance,
paintingWarpArea,
paintingWarpRegion,
sceneLighting,
refitWarpTree,
Expand All @@ -66,6 +67,7 @@ import { FreeTransformController, FreeTransformPrompt } from './FreeTransform';
import { CombinedTransform } from './CombinedTransform';
import { ManagedTransformControls } from './ManagedTransformControls';
import { WarpOverlay, shownWarpPreview } from './WarpOverlay';
import { beginWarpStroke, endingWarpStroke, WarpStrokeController } from './WarpStroke';
import { transformSelection } from '../core/transform-selection';
import { referencePlanes, resolvePart } from '../core/references';
import type { Part, SurfacePoint, FitAnchor, SceneDocument, SceneLight } from '../core/types';
Expand Down Expand Up @@ -118,6 +120,7 @@ class ViewportBoundary extends Component<{ children: ReactNode }, { error: strin
const noRaycast = () => {};
// A press on a gizmo handle also reaches whatever lies under it, but it is not a selection click.
let gizmoPressed = false;
const gizmoWasPressed = () => gizmoPressed;

const PartMesh = memo(function PartMesh({
part,
Expand Down Expand Up @@ -244,6 +247,8 @@ const PartMesh = memo(function PartMesh({
state.notify('Reset the exploded view before adding control points.', 'info');
return;
}
// Lines and areas are made by their strokes.
if (state.warpAdd !== 'point') return;
state.addWarpPoint(toSurface(event), event.faceIndex);
return;
}
Expand Down Expand Up @@ -308,13 +313,13 @@ const PartMesh = memo(function PartMesh({
} else if (paintingWarpRegion(state)) {
event.stopPropagation();
state.paintWarpRegion(toSurface(event), event.faceIndex, event.altKey, true);
}
} else if (beginWarpStroke(event, part.id)) event.stopPropagation();
}}
onPointerMove={(event) => {
const state = useEditor.getState();
const contact = state.tool === 'align' && state.operation.mode === 'surface';
if (
(!contact && !paintingWarpRegion(state)) ||
(!contact && !paintingWarpRegion(state) && !paintingWarpArea(state)) ||
state.navigationMode ||
state.temporaryOrbit ||
state.pivotPicking ||
Expand Down Expand Up @@ -357,8 +362,8 @@ const PartMesh = memo(function PartMesh({
wireframe={!inspecting && !ghost && wireframe}
emissive={selected && !inspecting && !ghost ? '#c77c39' : '#000000'}
emissiveIntensity={selected && !ghost ? 0.12 : 0}
// A constant, not slope-scaled, offset: a steep surface must still hide what it covers.
polygonOffset={warping}
polygonOffsetFactor={warping ? 1 : 0}
polygonOffsetUnits={warping ? 1 : 0}
/>
{selected &&
Expand Down Expand Up @@ -1143,6 +1148,7 @@ function Scene({
}}
pressed={() => gizmoPressed}
/>
<WarpStrokeController pressed={gizmoWasPressed} />
<PinOverlay />
<LightHandles />
<AssemblyAnnotations />
Expand Down Expand Up @@ -1259,6 +1265,7 @@ export function Viewport() {
event.type !== 'click' ||
event.button !== 0 ||
gizmoPressed ||
endingWarpStroke() ||
state.temporaryOrbit ||
state.navigationMode ||
state.pivotPicking ||
Expand Down
Loading
Loading