Add SB Worn Display Editor plugin#914
Open
hrmcngs wants to merge 10 commits into
Open
Conversation
Adds a Custom Slot row to the Display panel so users can edit custom item display keys (currently sophisticatedbackpacks:worn, the_four_primitives_and_weapons:back/belt) visually in the 3D viewport, using the same sliders as the vanilla slots. Source: https://github.com/hrmcngs/sb-worn-display-blockbench
7f6b19b to
4182532
Compare
When a custom slot was active and the user switched between project tabs, DisplayMode.slot kept pointing at the previous project's slot object. updateDisplayBase then read stale data and the model rendered floating off-center with the reference model gone. Fix: on select_project, silently rebind DisplayMode.slot to the new project's display_settings[key] without resetting the camera or forcing display mode.
v4.2.2 fixed the value-loss bug by skipping DisplayMode.loadHead() on project switch, but loadHead is also what re-populates the reference-model bar (player/zombie/armor_stand). Skipping it caused the reference figure to vanish after every tab switch. Now: call loadHead (so the reference bar is correctly re-populated), but save+restore the camera position/target around it so the user's viewpoint stays put.
New Tools action "Import display values from another model…" opens a JSON/bbmodel file, parses its display section, and shows a dialog where the user picks source slot, target slot, and which fields to overwrite via 3 independent checkboxes (Rotation / Translation / Scale). Supports partial replace — e.g. copy only sizing from a sibling model without touching rotation.
Two new actions, available from both Tools menu and the outliner right-click context menu (Cube / Group / Mesh): - Center Model at Origin (Undo-able, modifies geometry): shifts every element + group origin so model bbox center is (0,0,0). Display rotation then orbits around the model center. - Center View on Selection (non-destructive): sets active preview's camera target to selection bbox center. Works in Edit and Display modes.
- fix: Center Model at Origin's Undo entry was incomplete because
Undo.initEdit was called with {group: [...]} which Blockbench
doesn't recognize as an array. Switched to {outliner: true} which
snapshots all group origins. Ctrl/Cmd+Z now reverts in one step.
- add: Center Pivot of Groups — sets each group's origin to its
children's bbox center, non-destructive. Tools menu + outliner
right-click menu. Undo-able.
- chg: Center View in outliner ctx menu now references Blockbench's
built-in focus_on_selection action ('センタービュー' in JP) — 1:1
with View menu / preview ctx menu behavior. Custom impl removed.
ccfaf71 to
497dc2a
Compare
- Import dialog redesigned: one checkbox per TARGETS slot (auto-checked when source file contains the key) + shared Rotation / Translation / Scale checkboxes. One Confirm now overwrites every checked slot × every checked field. v4.3.0 only did one slot per Confirm. - fix: after import, if the active display_slot is among the replaced keys, rebind DisplayMode.slot + vue._data.slot + $forceUpdate so sliders show the new values immediately.
Bulk-import was Tools-menu only. Add a download-icon button to the right of the "Custom Slot" label in the Display panel, styled like Blockbench's native .tool.head_right buttons (e.g. Reset arrow next to Rotation). Click opens the same dialog as the Tools menu action.
3 channel checkboxes (Rotation/Translation/Scale) split into 9 per-axis checkboxes. Each axis can be toggled independently — copy just Scale Y from another model without touching anything else, etc. Combined with the v4.6.0 per-slot checkboxes, the bulk-import dialog now exposes (3 slots × 9 axes) = 27 independent decisions per Confirm. Result message reports exactly which axes were written: 'sophisticatedbackpacks:worn ← rotation.XZ + scale.Y'.
Previously the bulk-import dialog only listed the 3 plugin-registered custom slots. Extended to ALL keys present in source.display: vanilla (head/gui/ground/firstperson_*/thirdperson_*/fixed/on_shelf/ embedded) + custom + any other namespaced keys. Keys ordered vanilla → custom → other; each tagged in the dialog. All default checked = still works as one-click "import everything". Per-axis 9-checkbox partial replace (v4.7.0) applies uniformly.
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.
What
Adds a new plugin SB Worn Display Editor (id:
sb_worn_display) that adds a Custom Slot row to the Display panel, letting users visually edit custom item display contexts defined by Forge mods — using the same sliders as the vanillahead/gui/groundslots.Currently ships with three keys:
sophisticatedbackpacks:worn— Sophisticated Backpacks worn on Curios back slotthe_four_primitives_and_weapons:back— MAW saya on Curios back slotthe_four_primitives_and_weapons:belt— MAW saya on Curios belt slotDesigned to be trivially extensible to any other custom display key by editing the
TARGETSarray.Why
Blockbench's built-in Display panel only supports the 8 vanilla Java display contexts. Custom contexts defined by mods via
ItemDisplayContext.create(...)are silently dropped on save because the exporter iteratesDisplayMode.slots. This plugin registers the custom keys inDisplayMode.slots(round-trip safe) and injects a new section into the Display panel DOM using Blockbench's own native markup (panel_toolbar_label+bar tabs_small icon_bar+label.tool) so the new row blends visually with the vanilla UI.Validation
Files added
plugins/sb_worn_display/sb_worn_display.js— the pluginplugins/sb_worn_display/about.mdplugins/sb_worn_display/members.ymlplugins/sb_worn_display/LICENSE.MD(MIT)plugins.json— added entry at the endSource / changelog
Notes
variant: both— works on desktop and webmin_version: 4.8.0— uses new-structure format withabout.mdDisplayModePanel.vue); aMutationObserverre-attaches after Vue re-renders. A numeric Edit dialog under Tools serves as a stable fallback if the injection ever breaks. This trade-off is documented inabout.md.