add base plugin with coordinate system tool - #1053
Open
Devin T. Currie (DTCurrie) wants to merge 5 commits into
Open
add base plugin with coordinate system tool#1053Devin T. Currie (DTCurrie) wants to merge 5 commits into
Devin T. Currie (DTCurrie) wants to merge 5 commits into
Conversation
🦋 Changeset detectedLatest commit: b1c4238 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Devin T. Currie (DTCurrie)
force-pushed
the
gizmos/0-add-base-plugin
branch
from
September 8, 2026 14:44
55481cd to
217a6b2
Compare
This was referenced Sep 8, 2026
…use mono readouts
Devin T. Currie (DTCurrie)
force-pushed
the
gizmos/0-add-base-plugin
branch
from
September 10, 2026 21:36
7c8b70c to
b1c4238
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
Gizmosplugin: a dashboard tool picker for placing editable scene aids by clicking in the 3D view, with the coordinate-system tool as the first one. This is the base of a five-PR stack that revives #738 and #739 against the current plugin architecture.Stack
Visualization
Core, because these are contribution points rather than plugin-local behavior:
traits.Gizmomarks a user-placed scene aid. It lives in core rather than the plugin becauseWorldTree's folder taxonomy is a static array there, and a folder keyed on a plugin-owned trait would invert the dependency.treeFoldersgains aGizmosfolder betweendrawnandimported-files, so placed gizmos group together instead of landing inOther.HotkeyBindinggains an opt-inpreventDefault, andKeyboardBindingsapplies it before dispatch for bindings whosewhencurrently holds. ASpacebinding needs it so the page does not scroll,Backspaceso the browser does not navigate back.MeasurePointmoves fromplugins/MeasureTool/tocomponents/, unchanged, so more than one plugin can use it as the placement cursor. Its x/y/z readout andMeasureTool's distance label now render infont-roboto-mono, the repo's convention for numeric text.The plugin itself, under
plugins/Gizmos/:Gizmos.sveltemounts a dashboardDropdownPaneholding the tool picker, claimsinteractionMode: 'gizmo'while a tool is armed, and disarms when another tool takes the mode away. The picker's shapes button opens the tool menu directly rather than arming the first tool, and a separate exit button appears beside it only while a tool is armed, so each control keeps one job. The interaction-mode claim is released on unmount too, not only on disarm, and only when this effect still owns it, so unmounting mid-tool never clobbers a mode another plugin has since taken.DropdownPanegains aniconprop, which the picker uses for its shapes glyph, and aclassprop for the trigger, both defaulting to today's chevron and rounding soMeasureToolandTransformDashboardare untouched.useGizmospublishes the armedmode, the per-tool options, andexit().spawn.tsowns the trait set every gizmo carries, so a placed gizmo and a restored one cannot drift.cursor.tsandmatrix.tsare pure helpers for resolving a usable raycast hit and composing placement transforms.arrowMatrixcarries the arrow's direction on the local +Z axis, which is the axisBatchedArrowsreads back through the orientation vector, and its spec decomposes each matrix the way the renderer does.GizmoDetailscontributes an editable pose section throughuseDetailsSection, gated ontraits.Gizmo, so it appears in whichever mode's details card is showing.Why?
Why does the plugin register no environment mode?
EnvironmentModeis a closed union ofmonitor,build, andmove, and a plugin can only declare an existing mode reachable. Gizmos are viewing aids as much as authoring aids, so the plugin contributes no mode and works in all three. Editing works everywhere because every mode's details panel renders contributed sections for any selected entity.Why does
GizmoMenutakegizmosas a prop instead of callinguseGizmos()?The menu is rendered through
DashboardPortal, which uses threlte'sPortalto re-parent the component tree into the dashboard. A child there cannot read context the plugin provided, souseGizmos()returns undefined at runtime. Anything teleported into a portal has to take what it needs as props.This is worth stating precisely because the first diagnosis was wrong. The tweakpane
Panealso sat in the stack trace and took the blame, and removing it changed nothing. The tell is that a component reading the context during render throws and the popover opens empty, while one that only reads it in a click handler renders fine and fails on click.Why is the tool picker the dashboard button rather than a chevron beside one?
MeasureToolputs a mode toggle next to a settings pane, which suits one tool with options. With six tools, choosing one is the primary action, so the picker owns the button and exiting is a separate control shown only while a tool is armed. Each control keeps one job, which also avoids layering popover semantics onto a button that already announcesrole="radio".Testing
Ran
pnpm exec svelte-check --tsconfig ./tsconfig.jsonandpnpm exec vitest --run. Added specs for the ported pure helpers (cursor,matrix,spawn), thepreventDefaultdispatch path inKeyboardBindings, the details-section trait gate in both directions, the plugin shell's interaction-mode handling including an external takeover and release on unmount, andDropdownPane'sicon/classprops. Opened the app and armed a tool end to end. That last step matters: every unit test passes with the context broken, because specs mount the menu directly rather than through the portal, and checking only that the menu renders is not enough either.