Custom mouse cursor: normal/paint/pipette with recorder-aware software mode
- CursorController: polls painter state in LateUpdate; paint cursor only while the brush preview decal actually draws (MeshPainter.BrushPreviewVisible), pipette while held/toggled, fallback to normal over UI (InputUtil.PointerOverUi) - Auto ForceSoftware while Unity Recorder is recording (reflection into editor-only assembly, 0.5s poll, editor-only) so the cursor is captured; back to hardware cursor when recording stops - 3 placeholder cursor PNGs (32x32, cursor import type) with per-cursor hotspots Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9decea3501
commit
ae5fa63141
10 files changed
+465
No files matched your search
@@ -422,6 +422,8 @@ public partial class MeshPainter : MonoBehaviour
|
||||
private bool _rayHitsSaturated; // log-once: a saturated buffer can silently drop our own collider
|
||||
|
||||
// --- preview overlay ---
|
||||
/// <summary>True while the brush preview decal is actually drawn this frame (hover hits the paintable surface).</summary>
|
||||
public bool BrushPreviewVisible { get; private set; }
|
||||
public Shader previewShader; // optional; else Shader.Find("Hidden/MeshPaintPreview")
|
||||
private Material _previewMat;
|
||||
private Mesh _previewQuad; // unit quad in the tangent plane (flat decal mode)
|
||||
@@ -785,6 +787,7 @@ public partial class MeshPainter : MonoBehaviour
|
||||
// the same local space as the raycast hit and valid for skinned (baked) and static meshes.
|
||||
Mesh previewMesh = _collider ? _collider.sharedMesh : null;
|
||||
if (!previewMesh) return;
|
||||
BrushPreviewVisible = true;
|
||||
Matrix4x4 m = transform.localToWorldMatrix;
|
||||
int sub = previewMesh.subMeshCount;
|
||||
for (int i = 0; i < sub; i++)
|
||||
@@ -804,6 +807,7 @@ public partial class MeshPainter : MonoBehaviour
|
||||
frame.SetColumn(3, new Vector4(pos.x, pos.y, pos.z, 1f));
|
||||
|
||||
Graphics.DrawMesh(_previewQuad, transform.localToWorldMatrix * frame, _previewMat, layer, paintCamera, 0);
|
||||
BrushPreviewVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -811,6 +815,8 @@ public partial class MeshPainter : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
BrushPreviewVisible = false; // set again below only when the decal really draws this frame
|
||||
|
||||
if (!_setupValid) return;
|
||||
|
||||
if (useGpu != _gpuActive) SwitchBackend(useGpu);
|
||||
|
||||
Reference in new issue
Block a user