Add Shift brush controls to paint mode

Hold Shift to momentarily enable the pipette (restores prior state on
release) and Shift+Scroll to resize the brush. The orbit zoom ignores the
wheel while Shift is held so it does not zoom and resize at once. The HUD
brush-size slider follows live via a BrushSizeChanged event, and the brush
preview now stays visible while Shift is held (drawn before the pipette
early-return) so the new size is visible while scrubbing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 4.8 committed 2026-06-28 16:20:25 +02:00
1 parent 4e27b1e729
commit b6aaf69235
3 files changed
+120 -9

No files matched your search

+23 -2
View File
@@ -148,13 +148,19 @@ public partial class PaintHud : MonoBehaviour
{
if (!newPainter || newPainter == painter || !_panel) return;
if (painter) painter.Picked -= SyncFromPainter;
if (painter)
{
painter.Picked -= SyncFromPainter;
painter.BrushSizeChanged -= SyncBrushSize;
}
painter = newPainter;
WirePanel(_panel.transform);
// Re-sync every widget when the pipette adopts a sampled material (painter -> HUD).
painter.Picked += SyncFromPainter;
// Re-sync the brush-size slider when Shift+wheel resizes the brush in-world (painter -> HUD).
painter.BrushSizeChanged += SyncBrushSize;
// First bind this session: restore panel positions + brush values from disk (cross-session).
// A later bind is an avatar respawn (scene switch) -> carry the in-session brush values onto the
@@ -169,7 +175,11 @@ public partial class PaintHud : MonoBehaviour
private void OnDestroy()
{
if (painter) painter.Picked -= SyncFromPainter;
if (painter)
{
painter.Picked -= SyncFromPainter;
painter.BrushSizeChanged -= SyncBrushSize;
}
}
private void OnModeChanged(GameMode mode)
@@ -309,6 +319,17 @@ public partial class PaintHud : MonoBehaviour
RefreshMaskHighlights();
}
/// <summary>
/// Pushes only the brush size back into its slider (painter -> HUD), e.g. after Shift+wheel
/// resized the brush in-world. The slider clamps to its own range and its listener writes the
/// clamped value back to the painter, so the wheel and the slider stay in agreement.
/// </summary>
private void SyncBrushSize()
{
if (!_panel || !painter) return;
SetSlider(_panel.transform, SliderBrushSize, painter.brushSize);
}
private static void SetToggle(Transform panel, string name, bool value)
{
var toggle = Find<Toggle>(panel, name);