tosijs-3d 0.12.3 → 0.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/changelog/v0.12.4.md +48 -0
  3. package/changelog/v0.12.5.md +35 -0
  4. package/dist/asset-url.d.ts +1 -1
  5. package/dist/asset-url.js +1 -1
  6. package/dist/b3d-biped.d.ts +19 -22
  7. package/dist/b3d-biped.d.ts.map +1 -1
  8. package/dist/b3d-biped.js +79 -5
  9. package/dist/b3d-biped.js.map +1 -1
  10. package/dist/b3d-car.js +1 -1
  11. package/dist/b3d-launcher.d.ts +1 -9
  12. package/dist/b3d-launcher.d.ts.map +1 -1
  13. package/dist/b3d-launcher.js +47 -62
  14. package/dist/b3d-launcher.js.map +1 -1
  15. package/dist/b3d-manipulator.d.ts +4 -0
  16. package/dist/b3d-manipulator.d.ts.map +1 -1
  17. package/dist/b3d-manipulator.js +73 -11
  18. package/dist/b3d-manipulator.js.map +1 -1
  19. package/dist/bar-menu.d.ts +22 -4
  20. package/dist/bar-menu.d.ts.map +1 -1
  21. package/dist/bar-menu.js +248 -108
  22. package/dist/bar-menu.js.map +1 -1
  23. package/dist/body-export.d.ts +57 -0
  24. package/dist/body-export.d.ts.map +1 -0
  25. package/dist/body-export.js +173 -0
  26. package/dist/body-export.js.map +1 -0
  27. package/dist/character-builder.d.ts.map +1 -1
  28. package/dist/character-builder.js +537 -362
  29. package/dist/character-builder.js.map +1 -1
  30. package/dist/character-core.d.ts.map +1 -1
  31. package/dist/character-core.js +5 -0
  32. package/dist/character-core.js.map +1 -1
  33. package/dist/character-file.d.ts +4 -0
  34. package/dist/character-file.d.ts.map +1 -1
  35. package/dist/character-file.js +15 -0
  36. package/dist/character-file.js.map +1 -1
  37. package/dist/character-settings.d.ts.map +1 -1
  38. package/dist/character-settings.js +2 -0
  39. package/dist/character-settings.js.map +1 -1
  40. package/dist/character-sources.d.ts +27 -0
  41. package/dist/character-sources.d.ts.map +1 -0
  42. package/dist/character-sources.js +158 -0
  43. package/dist/character-sources.js.map +1 -0
  44. package/dist/character-store.d.ts.map +1 -1
  45. package/dist/character-store.js +25 -2
  46. package/dist/character-store.js.map +1 -1
  47. package/dist/character.d.ts +24 -13
  48. package/dist/character.d.ts.map +1 -1
  49. package/dist/character.js +71 -71
  50. package/dist/character.js.map +1 -1
  51. package/dist/cloth-drape.d.ts +49 -3
  52. package/dist/cloth-drape.d.ts.map +1 -1
  53. package/dist/cloth-drape.js +170 -16
  54. package/dist/cloth-drape.js.map +1 -1
  55. package/dist/cloth-shading.d.ts +1 -9
  56. package/dist/cloth-shading.d.ts.map +1 -1
  57. package/dist/cloth-shading.js +48 -25
  58. package/dist/cloth-shading.js.map +1 -1
  59. package/dist/color-field.d.ts +5 -0
  60. package/dist/color-field.d.ts.map +1 -1
  61. package/dist/color-field.js +27 -11
  62. package/dist/color-field.js.map +1 -1
  63. package/dist/color-picker.d.ts +6 -0
  64. package/dist/color-picker.d.ts.map +1 -1
  65. package/dist/color-picker.js +41 -2
  66. package/dist/color-picker.js.map +1 -1
  67. package/dist/fabric-textures.d.ts +19 -0
  68. package/dist/fabric-textures.d.ts.map +1 -0
  69. package/dist/fabric-textures.js +133 -0
  70. package/dist/fabric-textures.js.map +1 -0
  71. package/dist/frame-panel.d.ts.map +1 -1
  72. package/dist/frame-panel.js +11 -0
  73. package/dist/frame-panel.js.map +1 -1
  74. package/dist/game-controller.d.ts +3 -0
  75. package/dist/game-controller.d.ts.map +1 -1
  76. package/dist/game-controller.js +19 -0
  77. package/dist/game-controller.js.map +1 -1
  78. package/dist/garment-cut.d.ts +2 -0
  79. package/dist/garment-cut.d.ts.map +1 -1
  80. package/dist/garment-cut.js +184 -0
  81. package/dist/garment-cut.js.map +1 -1
  82. package/dist/garment-proxy.d.ts +52 -0
  83. package/dist/garment-proxy.d.ts.map +1 -0
  84. package/dist/garment-proxy.js +127 -0
  85. package/dist/garment-proxy.js.map +1 -0
  86. package/dist/glb-clips.d.ts +65 -0
  87. package/dist/glb-clips.d.ts.map +1 -0
  88. package/dist/glb-clips.js +355 -0
  89. package/dist/glb-clips.js.map +1 -0
  90. package/dist/glb-rig.d.ts +12 -0
  91. package/dist/glb-rig.d.ts.map +1 -1
  92. package/dist/glb-rig.js +26 -0
  93. package/dist/glb-rig.js.map +1 -1
  94. package/dist/hand-socket.d.ts +58 -0
  95. package/dist/hand-socket.d.ts.map +1 -0
  96. package/dist/hand-socket.js +270 -0
  97. package/dist/hand-socket.js.map +1 -0
  98. package/dist/hold-grip.d.ts +24 -0
  99. package/dist/hold-grip.d.ts.map +1 -0
  100. package/dist/hold-grip.js +101 -0
  101. package/dist/hold-grip.js.map +1 -0
  102. package/dist/human-morph.d.ts.map +1 -1
  103. package/dist/human-morph.js +4 -1
  104. package/dist/human-morph.js.map +1 -1
  105. package/dist/icon-data.d.ts +13 -0
  106. package/dist/icon-data.d.ts.map +1 -1
  107. package/dist/icon-data.js +14 -1
  108. package/dist/icon-data.js.map +1 -1
  109. package/dist/index.d.ts +20 -6
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +11 -3
  112. package/dist/index.js.map +1 -1
  113. package/dist/manipulator-view.d.ts +1 -1
  114. package/dist/manipulator-view.d.ts.map +1 -1
  115. package/dist/manipulator-view.js +29 -10
  116. package/dist/manipulator-view.js.map +1 -1
  117. package/dist/manipulator.d.ts +11 -1
  118. package/dist/manipulator.d.ts.map +1 -1
  119. package/dist/manipulator.js +46 -11
  120. package/dist/manipulator.js.map +1 -1
  121. package/dist/material-apply.d.ts +18 -0
  122. package/dist/material-apply.d.ts.map +1 -1
  123. package/dist/material-apply.js +53 -10
  124. package/dist/material-apply.js.map +1 -1
  125. package/dist/material-picker.d.ts +6 -0
  126. package/dist/material-picker.d.ts.map +1 -1
  127. package/dist/material-picker.js +254 -21
  128. package/dist/material-picker.js.map +1 -1
  129. package/dist/material-pictures.d.ts +13 -0
  130. package/dist/material-pictures.d.ts.map +1 -0
  131. package/dist/material-pictures.js +93 -0
  132. package/dist/material-pictures.js.map +1 -0
  133. package/dist/material-preview.d.ts +2 -2
  134. package/dist/material-preview.d.ts.map +1 -1
  135. package/dist/material-preview.js +72 -28
  136. package/dist/material-preview.js.map +1 -1
  137. package/dist/material-recipe.d.ts +19 -0
  138. package/dist/material-recipe.d.ts.map +1 -1
  139. package/dist/material-recipe.js +88 -7
  140. package/dist/material-recipe.js.map +1 -1
  141. package/dist/outline-field.d.ts +21 -0
  142. package/dist/outline-field.d.ts.map +1 -1
  143. package/dist/outline-field.js +74 -5
  144. package/dist/outline-field.js.map +1 -1
  145. package/dist/playback-field.d.ts +40 -0
  146. package/dist/playback-field.d.ts.map +1 -0
  147. package/dist/playback-field.js +315 -0
  148. package/dist/playback-field.js.map +1 -0
  149. package/dist/playground.d.ts.map +1 -1
  150. package/dist/playground.js +87 -54
  151. package/dist/playground.js.map +1 -1
  152. package/dist/remesh.d.ts +9 -0
  153. package/dist/remesh.d.ts.map +1 -1
  154. package/dist/remesh.js +17 -3
  155. package/dist/remesh.js.map +1 -1
  156. package/dist/retarget.js +1 -1
  157. package/dist/rig-fit.d.ts +10 -0
  158. package/dist/rig-fit.d.ts.map +1 -1
  159. package/dist/rig-fit.js +125 -0
  160. package/dist/rig-fit.js.map +1 -1
  161. package/dist/rig-recipe.d.ts +7 -1
  162. package/dist/rig-recipe.d.ts.map +1 -1
  163. package/dist/rig-recipe.js +7 -1
  164. package/dist/rig-recipe.js.map +1 -1
  165. package/dist/rig-tool.d.ts +7 -0
  166. package/dist/rig-tool.d.ts.map +1 -1
  167. package/dist/rig-tool.js +333 -49
  168. package/dist/rig-tool.js.map +1 -1
  169. package/dist/rigged-body-glb.d.ts +42 -2
  170. package/dist/rigged-body-glb.d.ts.map +1 -1
  171. package/dist/rigged-body-glb.js +300 -14
  172. package/dist/rigged-body-glb.js.map +1 -1
  173. package/dist/rigged-body.d.ts +5 -1
  174. package/dist/rigged-body.d.ts.map +1 -1
  175. package/dist/rigged-body.js +5 -2
  176. package/dist/rigged-body.js.map +1 -1
  177. package/dist/scene-schemas.d.ts.map +1 -1
  178. package/dist/scene-schemas.js +2 -1
  179. package/dist/scene-schemas.js.map +1 -1
  180. package/dist/skinned-glb.d.ts +20 -0
  181. package/dist/skinned-glb.d.ts.map +1 -1
  182. package/dist/skinned-glb.js +55 -3
  183. package/dist/skinned-glb.js.map +1 -1
  184. package/dist/spring-chain-babylon.js +1 -1
  185. package/dist/svg-icons.d.ts +2 -3
  186. package/dist/svg-icons.d.ts.map +1 -1
  187. package/dist/svg-icons.js +8 -6
  188. package/dist/svg-icons.js.map +1 -1
  189. package/dist/tailor-panel.d.ts +101 -0
  190. package/dist/tailor-panel.d.ts.map +1 -0
  191. package/dist/tailor-panel.js +462 -0
  192. package/dist/tailor-panel.js.map +1 -0
  193. package/dist/tailor-tool.d.ts +27 -0
  194. package/dist/tailor-tool.d.ts.map +1 -1
  195. package/dist/tailor-tool.js +284 -80
  196. package/dist/tailor-tool.js.map +1 -1
  197. package/dist/tosi-b3d.d.ts +24 -1
  198. package/dist/tosi-b3d.d.ts.map +1 -1
  199. package/dist/tosi-b3d.js +107 -17
  200. package/dist/tosi-b3d.js.map +1 -1
  201. package/dist/undo-history.d.ts +19 -0
  202. package/dist/undo-history.d.ts.map +1 -0
  203. package/dist/undo-history.js +77 -0
  204. package/dist/undo-history.js.map +1 -0
  205. package/dist/w3d-theme.d.ts +2 -0
  206. package/dist/w3d-theme.d.ts.map +1 -1
  207. package/dist/w3d-theme.js +11 -0
  208. package/dist/w3d-theme.js.map +1 -1
  209. package/dist/weapon-fit.js +1 -1
  210. package/dist/widget-semantics.d.ts +2 -0
  211. package/dist/widget-semantics.d.ts.map +1 -1
  212. package/dist/widget-semantics.js +12 -2
  213. package/dist/widget-semantics.js.map +1 -1
  214. package/dist/widgets3d.d.ts +57 -16
  215. package/dist/widgets3d.d.ts.map +1 -1
  216. package/dist/widgets3d.js +197 -83
  217. package/dist/widgets3d.js.map +1 -1
  218. package/package.json +14 -2
  219. package/static/attributes.json +77 -6
  220. package/static/attributes.txt +23 -3
package/CHANGELOG.md CHANGED
@@ -12,9 +12,9 @@ Upgrading across a minor? Start with [Migration](/Migration/).
12
12
 
13
13
  ## Unreleased
14
14
 
15
- ## 0.12.3
15
+ ## 0.12.5
16
16
 
17
- The latest release. Characters out to other engines (a GLB read with no engine, any rigged body as a skinned GLB that plays UAL's clips by name, springs as `VRMC_springBone`), the rig tool's fixes for AI-made meshes, draped cloth, and scenes as agent tools and for a screen reader. See [0.12.3](/v0.12.3/).
17
+ The latest release. Exported bodies carry clips, garments and held items; the cast's rigs are engine-free; the Babylon peers are optional (install them yourself); the character builder gets a Character menu, a hair manipulator and sub-sections. See [0.12.5](/v0.12.5/).
18
18
 
19
19
  ## Every version
20
20
 
@@ -0,0 +1,48 @@
1
+ # 0.12.4
2
+
3
+ <!--{ "parent": "CHANGELOG", "order": 9987996 }-->
4
+
5
+ Tabbed settings panels and undo across the character builder, rig tool and tailor; pictures in materials (Poly Haven's fabric scans as cloth presets, a picture or a flat colour or grey for any input); the tailor always on the bar; grips per class of held item; Tonio's textured weapons and melee in the biped.
6
+
7
+ Size: barrel (min, packages external) 1643.8 KB raw / 569.0 KB gz, up 47.8 KB / 14.0 KB gz (+3.0%) on 0.12.3: the material pictures and fabric presets, the drape's sliced runner, undo history, playback and hold grips are in the barrel.
8
+
9
+ ## Added
10
+
11
+ - **Tabbed settings panels with icons**: `panelSections: 'tabs'` with an `icon` on each collapsible `label3d`. The character builder and the rig tool use it.
12
+ - **`panelActions(el)`** on `<tosi-b3d>`: a page's own buttons on the settings panel's icon bar, at its right end. Icon bars take `{ spacer: true }` (an elastic gap); `tabs3d` takes `tools`, and in a tabbed panel `iconBar3d({ inTabs: true })` goes on the tab strip.
13
+ - **Undo and redo** in the character builder and the rig tool (⌘Z / ⇧⌘Z). `undoHistory` is the pure history behind them.
14
+ - **Panels rebuild once a resize settles.** The scene dispatches `resizeend`; `panelRoom(panelEl)` gives a system panel its room.
15
+ - **Pictures in materials**: a material picker's colour, opacity, glow and bumps (and a cloth's colour, roughness and normal) can take a picture, kept by `material-pictures` and saved in a character file (`pictures`). Cloth and PBR take `tile` (metres per repeat).
16
+ - **Photographed fabrics**: eleven of Poly Haven's CC0 fabric scans as cloth presets (`textiles`, `textiles-full`; `fabricTexturePresets`).
17
+ - **Material previews** are drawn on Tonio's material test ball, on grey (a cube until it loads).
18
+ - **Export a rigged body as a GLB** from the rig tool and the character builder (joint names, rest pose, height; the model's materials and springs).
19
+ - **Character builder**: Hold uses Tonio's textured weapons with a manipulator on the grip; clips come from a smaller builder pack (`UAL_builder.glb`); `playback3d` (play, scrub, speed) in Motion; all four AI characters open on hand-placed rigs.
20
+ - **Rig tool**: spread fingers, and hand modes (full, mitten, none); opened from the builder it shows the body it already wears.
21
+ - **Biped melee**: `holdingWeapon` stands on guard in Sword_Idle and the right trigger swings (Sword_Attack). The biped playground carries Tonio's weapons.
22
+ - **Material inputs that take a picture** are a heading and a row: choose a picture, clear it, a flat colour or grey instead (`colorPicker` icon), and a swatch of what it is now. `colorPicker3d` and `color3d` take `grey: true` (a black-to-white ramp and a ladder of greys).
23
+ - **`slider3d` `notches`**: a press beside the handle steps to the next notch that way; dragging stays continuous. A material's `tile` is now **scale textures**, 1/32 to 4 on a log scale, notched at 1/n and whole numbers (`textureScaleNotches`), where pictures repeat whole.
24
+ - **The tailor has undo and redo** on a bar pinned to the top of its panel (⌘Z / ⇧⌘Z in the builder while it is open), with cancel and done unless it is `persistent`.
25
+ - **Grips per class of item** (`hold-grip`: `holdGrip`, `holdClassOf`, `HOLD_CLASSES`): pistols, rifles, heavy weapons, one- and two-handed blades, bows, shields. The character builder keeps an adjusted grip per class (placing one sword places every one-handed blade; per-item grips saved before are read as their class's), and the biped playground holds by class.
26
+ - **The character builder's tailor is always on the bar** (scissors): pick a slot and a garment, and one you cut opens on its outline to edit, or start a new one; no done or cancel, it keeps the garment when you switch or close, and undo covers the edits. Export, import and forget moved into it; the Tailor tab is gone. `mountTailorTool` takes `panel`, `persistent` and `rows`; characters take `hideSlot` (one slot's garment off for a moment).
27
+ - **Character builder clothes**: each slot is one row, the garment and its material swatch beside it; the "edit" picker is gone. `materialPicker3d` takes `name` (a title with no caption).
28
+ - **Tailor drape**: edits no longer lock the page (debounced, sliced, interruptible: `drapeGarmentAsync`, `runSliced`, `drapeSteps`, `remeshSteps`); cloth goes over arms, shoulders and hips; anchored points are drawn in the new `--w3d-anchored` colour.
29
+
30
+ ## Changed
31
+
32
+ - **Stroked-and-filled icons fill with `--w3d-icon-fill`** (a mid blue) instead of the button colour behind them. Pass `knockout` to `iconGlyph`, or set `--tosi-icon-knockout`, for the old look.
33
+ - The rig tool's hosted "start over" is an icon beside undo and redo.
34
+ - Material inputs are labelled **diffuse** (albedo), **normal map** (was bumps) and **colorize** (a cloth's recolour); the recipe keys are unchanged.
35
+ - A material's `tile` input's range is now 1/32 to 4 (was 0.02 to 4), so a smaller saved value is clamped.
36
+ - Cloth material previews show a colour the recipe names wholly (the preview has no texture for a recolour to keep).
37
+ - The tailor's "export glTF" button reads "export GLB".
38
+
39
+ ## Fixed
40
+
41
+ - Arrow keys and Space no longer scroll the page while you play a demo.
42
+ - Tailor, cut from the skin: tidy, smoothed cut edges (no spikes or notches along a neckline).
43
+ - Drape: edges well clear of the body are no longer pinned to it (rigid hems).
44
+ - A held item's grip is measured on fresh world matrices (the pistol no longer circles the hand metres away); the launcher reads its `_grip` the same way.
45
+ - Auto-rig: glove bumps are not read as fingers, and a knotted thumb is placed by proportion.
46
+ - The rig tool casts shadows when hosted, and done on a body from a file no longer leaves it invisible.
47
+ - Undoing a placed grip in the character builder moves the held item back (the numbers were restored, the item was not).
48
+ - A stroked-and-filled icon's part drawn with `stroke:none` stays unstroked (tosijs-ui#251 worked round by `bin/icon-no-stroke.ts`).
@@ -0,0 +1,35 @@
1
+ # 0.12.5
2
+
3
+ <!--{ "parent": "CHANGELOG", "order": 9987995 }-->
4
+
5
+ For Dramatis and the character builder: an exported body now carries clips, garments and what the hand holds, the cast's rigs are engine-free data, and the Babylon peers are optional, so a three.js app can take the character core without installing Babylon. The builder gets a Character menu on the system bar, a manipulator for placing hair, and sub-sections in its panels.
6
+
7
+ Size: barrel (min, packages external) 1655.1 KB raw / 573.5 KB gz, up 11.3 KB / 4.5 KB gz (+0.7%) on 0.12.4.
8
+
9
+ > **⚠️ Breaking (install only):** `@babylonjs/core`, `@babylonjs/gui`, `@babylonjs/loaders` and `@babylonjs/materials` are now *optional* peers, so npm no longer installs them for you. A Babylon app that was relying on that installs them itself: `npm i @babylonjs/core @babylonjs/gui @babylonjs/loaders @babylonjs/materials`. The version ranges are unchanged.
10
+
11
+ ### Added
12
+
13
+ - **`lockMove`** on `<tosi-b3d-manipulator>` (`'x'`, `'xz'`…): the object's axes a move may not go along. The widget shows only what is left (an arrow per free axis, a pad where both its axes are free) and a drag never moves along a locked axis. The character builder's hair handle locks x: up and forward, one pad.
14
+ - **Menus of actions on the system bar**: `barMenu` options can be actions (`handleSelect`, `checked`), submenus (`items`), rules (`separator`) and `disabled`, `options` may be a function read on each opening, and `layout: 'list'` shows each option's icon beside its caption. `viewMenu` is a list now (each view named).
15
+ - **`panelIcon`** on `<tosi-b3d>`: the settings button's icon in place of the owl, named by `panelTitle`, for a page whose panel is its main tool.
16
+ - **Character builder**: the character (select, delete, save, save as, rename, export and load JSON, go to the playground) is a **Character** menu on the system bar instead of a tab; the panel's button is the body. A library hairstyle is placed with a move-only manipulator on the head (up and forward) and a **scale** slider, in place of the up, forward and size sliders (the settings are unchanged, so saved characters keep their hair). The Body tab carries the mesh icon, and a mesh body's surfaces are a sub-section under its source. `makeCharacter(...).hairAnchor()` is the Head node and the skull's middle the adjustment is measured from.
17
+ - **Sub-sections**: `label3d({ collapsible: true, level: 2 })` folds inside the section or tab it is in (one open at a time, except with `panelSections: 'folds'`), drawn indented, and is a level under its section in the control tree (`Body/shape/gender`). The character builder's Body tab folds into shape, figure and ancestry.
18
+ - **`tailorPanel(el, options)`**: the character builder's always-on tailor as a piece any page with a character mounts (slot and garment pickers, keep on switch or close, forget, export, import), with the host's draft, slots and garment store passed in; `garmentStore()` is the browser's IndexedDB store the builder uses. The builder now runs on it.
19
+ - **Clips in an exported body**: `tosijs-3d/glb-clips` (engine-free) reads any skinned GLB's animations and the skeleton they were made on (`readGlbClips`) and bakes one onto another skeleton through the retargeter (`bakeClip`); `riggedBodyGlb(body, { clips: [{ from, clip, extras }] })` writes them as glTF animations, each with its licence in its `extras`. `writeSkinnedGlb` takes `animations`.
20
+ - **Garments in an exported body**: `riggedBodyGlb(body, { garments })` writes garments bound to that body (`garmentProxy`: the tailor's cuts and draped cloth on a file body, or Blender's) as meshes skinned on the same skeleton with weights from the body's own, their materials as glTF, and tucks the skin they cover (`cover: false` leaves it). A character's `wornGarments()` hands over what it wears; the character builder's export GLB includes them.
21
+ - **`tosijs-3d/garment-proxy`** (engine-free): `garmentProxy(content, body)` binds a garment file to the body it was made on as a `HumanProxy`, its material as data (pictures as bytes, `twoSided`, the saved `look`, and `gltf`, that look as glTF factors where it has a plain reading), so an exporter writes own garments through the same path as MakeHuman's clothes; `garmentMadeOn`, `garmentLook`, `lookGltf`. The character wears own garments through it. `clothRecipe` moved to `material-recipe` (still exported from `cloth-shading`).
22
+ - **Held items in an exported body**: `riggedBodyGlb(body, { held: { grip, item, gripPoint, extras } })` writes a `weapon_r` joint (or `weapon_l`, or `held.name`) under the hand where the character builder holds the grip, and with `item` (a mesh read by `glbRigTriangles(bytes, { pick })`) the item itself, skinned to that joint with its materials and its licence in the mesh's `extras`. `glbNodePosition` reads an item's `_grip` node with no engine. The socket arithmetic is the engine-free `tosijs-3d/hand-socket`, which the launcher's `handSocket` now runs too. `writeSkinnedGlb` meshes take `extras`. The character builder's export GLB carries what the right hand holds (`BodyExportTarget.held`).
23
+ - **`tosijs-3d/character-sources`** (engine-free): `CHARACTER_SOURCES` and `AI_CHARACTER_SOURCES` with Tonio's hand-placed rigs for the AI cast, and `rigFromMarkers`, so an exporter rigs the cast as the builder does (`glbRigTriangles`, `bodyFromMarkers` with the source's `recipe.binding`, `riggedBodyGlb`). Still exported from `character` and the barrel. `riggedBodyGlb`'s `recipe` may be partial.
24
+
25
+ ### Changed
26
+
27
+ - **The `@babylonjs/*` peers are optional**, so a consumer of the engine-free subpaths (a three.js app taking the character core) installs no Babylon. A Babylon app that relied on npm installing the peers for it installs them itself: `npm i @babylonjs/core @babylonjs/gui @babylonjs/loaders @babylonjs/materials`.
28
+
29
+ ### Fixed
30
+
31
+ - **Manipulator plane pads** can be grabbed again: the hairline arrow shafts, drawn in front of them from most angles, took the press first.
32
+ - Character builder: loading a saved character (or the autosaved one on opening the page) stopped before restoring its name and its tailor outline (a call left behind when the clothes "edit" picker went, in 0.12.4).
33
+ - A system panel with no title bar (a bar menu) keeps its size in step with its content when the content is swapped (a submenu was drawn at the full menu's height).
34
+ - A select's list is one at a time: tapping the select again closes it, and a panel rebuilt while the list was open (an in-place refresh) closes it with the old content. Before, the list stayed in the scene at its old offset (off screen once the panel's height changed) and the next tap opened a second.
35
+ - The character builder keeps a held item's grip point on the grip when the grip's scale is not 1 (the item slid off it).
@@ -29,7 +29,7 @@ export declare function getAssetBase(): string;
29
29
  * he had. Three wrong diagnoses before someone looked at the actual bytes.
30
30
  *
31
31
  * So pass a version whenever you depend on content that has been republished:
32
- * `assetUrl('quaternius/UAL1_core.glb', 2)`. It changes the URL, which is the
32
+ * `assetUrl('quaternius/UAL1_core.glb', 3)`. It changes the URL, which is the
33
33
  * only thing an immutable cache respects.
34
34
  */
35
35
  export declare function assetUrl(path: string, version?: string | number): string;
package/dist/asset-url.js CHANGED
@@ -52,7 +52,7 @@ export function getAssetBase() {
52
52
  * he had. Three wrong diagnoses before someone looked at the actual bytes.
53
53
  *
54
54
  * So pass a version whenever you depend on content that has been republished:
55
- * `assetUrl('quaternius/UAL1_core.glb', 2)`. It changes the URL, which is the
55
+ * `assetUrl('quaternius/UAL1_core.glb', 3)`. It changes the URL, which is the
56
56
  * only thing an immutable cache respects.
57
57
  */
58
58
  export function assetUrl(path, version) {
@@ -22,28 +22,6 @@ export declare class AnimState {
22
22
  constructor(spec: AnimStateSpec);
23
23
  static buildList(...specs: AnimStateSpec[]): AnimState[];
24
24
  }
25
- /**
26
- * **Animation states for a Quaternius UAL rig** (the Universal Animation
27
- * Library, on `cdn.tosijs.net/quaternius/`).
28
- *
29
- * The biped drives states by NAME — `walk`, `run`, `sneak` — and a rig supplies
30
- * whatever its animator called them. This is the translation for UAL, so
31
- * adopting that library is one line:
32
- *
33
- * ```js
34
- * b3dBiped({
35
- * url: assetUrl('quaternius/UAL1_core.glb', 2),
36
- * animationStates: ualAnimationStates(),
37
- * })
38
- * ```
39
- *
40
- * Two things it buys beyond names. `walkBackwards` becomes a real
41
- * `Jog_Bwd_Loop` rather than the walk cycle played in reverse, and `sneak` gets
42
- * a crouch that holds at rest — both were fakes against the stock rig.
43
- *
44
- * Pass `extra` to add or override entries; a later entry with the same `name`
45
- * wins, so a project can retarget one state without restating the rest.
46
- */
47
25
  export declare function ualAnimationStates(extra?: AnimStateSpec[]): AnimState[];
48
26
  export declare class B3dBiped extends B3dControllable {
49
27
  static preferredTagName: string;
@@ -321,6 +299,16 @@ export declare class B3dBiped extends B3dControllable {
321
299
  * Unset, the button toggles `gunplay` as before.
322
300
  */
323
301
  whenWeapon: ((up: boolean) => void) | null;
302
+ /**
303
+ * A MELEE weapon is in hand (a sword): it stays visible with gunplay off
304
+ * (lowered weapons are otherwise hidden, see `_showWeapons`), standing still
305
+ * is `meleeIdle` (UAL's `Sword_Idle`), and the right trigger swings
306
+ * (`meleeAttack`, `Sword_Attack`, played through) instead of sprinting.
307
+ * JS only; the game sets it when what is in hand changes.
308
+ */
309
+ get holdingWeapon(): boolean;
310
+ set holdingWeapon(on: boolean);
311
+ private _holdingWeapon;
324
312
  /**
325
313
  * Put the weapon up or down.
326
314
  *
@@ -673,6 +661,15 @@ export declare class B3dBiped extends B3dControllable {
673
661
  private _blendStep;
674
662
  private _ease;
675
663
  private _paceBlends;
664
+ /**
665
+ * The melee version of a state: a swing in progress takes the whole body
666
+ * while on the ground (not mid-jump, swimming or climbing), and standing
667
+ * still is on guard. A rig without the clips keeps its own states.
668
+ */
669
+ private _meleeState;
670
+ /** Seconds left of the swing playing now. */
671
+ private _attackFor;
672
+ private _swing;
676
673
  setAnimationState(name: string, speed?: number): void;
677
674
  getCameraTarget(): BABYLON.Node | null;
678
675
  applyInput(input: ControlInput, dt: number): void;
@@ -1 +1 @@
1
- {"version":3,"file":"b3d-biped.d.ts","sourceRoot":"","sources":["../src/b3d-biped.ts"],"names":[],"mappings":"AAoTA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EACL,OAAO,EAKR,MAAM,gBAAgB,CAAA;AAyBvB,OAAO,EAQL,KAAK,GAAG,EAET,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAA;AAa7B,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,qBAAa,SAAS;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAA;IACb,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,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IAmB5B,OAAO,CAAC,SAAS,CAAiD;IAElE;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAoB1C,6CAA6C;IAC7C,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQ/B,8EAA8E;IAC9E,YAAY,EAAE,OAAO,CAAO;IAC5B,4FAA4F;IAC5F,MAAM,EAAE,GAAG,CAAO;IAElB,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK;YAmC7B,cAAc;YAYd,cAAc;IAkI5B,OAAO,CAAC,WAAW;IAkFnB,YAAY;IAyCZ,MAAM;CA6BP;AAED,eAAO,MAAM,QAAQ,2CAA4B,CAAA"}
package/dist/b3d-biped.js CHANGED
@@ -82,7 +82,7 @@ const gun = b3dLauncher({
82
82
  // on a figure half the intended size.
83
83
  const hero = b3dBiped(
84
84
  {
85
- url: assetUrl('quaternius/UAL1_core.glb', 2),
85
+ url: assetUrl('quaternius/UAL1_core.glb', 3),
86
86
  animationStates: ualAnimationStates(),
87
87
  player: true, cameraType: 'follow', aiming: 'on', aimFreeYaw: 45,
88
88
  },
@@ -353,7 +353,7 @@ export class AnimState {
353
353
  *
354
354
  * ```js
355
355
  * b3dBiped({
356
- * url: assetUrl('quaternius/UAL1_core.glb', 2),
356
+ * url: assetUrl('quaternius/UAL1_core.glb', 3),
357
357
  * animationStates: ualAnimationStates(),
358
358
  * })
359
359
  * ```
@@ -365,6 +365,20 @@ export class AnimState {
365
365
  * Pass `extra` to add or override entries; a later entry with the same `name`
366
366
  * wins, so a project can retarget one state without restating the rest.
367
367
  */
368
+ /** The states a melee swing may take over: on the ground, not in the air or water. */
369
+ const MELEE_GROUND = new Set([
370
+ 'idle',
371
+ 'walk',
372
+ 'run',
373
+ 'sprint',
374
+ 'walkBackwards',
375
+ 'strafeLeft',
376
+ 'strafeRight',
377
+ 'sneak',
378
+ 'sneakIdle',
379
+ 'sneakLeft',
380
+ 'sneakRight',
381
+ ]);
368
382
  export function ualAnimationStates(extra = []) {
369
383
  const base = [
370
384
  { name: 'idle', animation: 'Idle_Loop', loop: true },
@@ -433,6 +447,10 @@ export function ualAnimationStates(extra = []) {
433
447
  { name: 'aimDown', animation: 'Pistol_Aim_Down', loop: true },
434
448
  { name: 'shoot', animation: 'Pistol_Shoot', loop: false },
435
449
  { name: 'reload', animation: 'Pistol_Reload', loop: false },
450
+ // MELEE, with a weapon held but not raised (see `holdingWeapon`): standing
451
+ // still on guard, and one swing per pull of the trigger.
452
+ { name: 'meleeIdle', animation: 'Sword_Idle', loop: true },
453
+ { name: 'meleeAttack', animation: 'Sword_Attack', loop: false },
436
454
  ];
437
455
  const byName = new Map();
438
456
  for (const spec of [...base, ...extra]) {
@@ -833,6 +851,21 @@ export class B3dBiped extends B3dControllable {
833
851
  * Unset, the button toggles `gunplay` as before.
834
852
  */
835
853
  whenWeapon = null;
854
+ /**
855
+ * A MELEE weapon is in hand (a sword): it stays visible with gunplay off
856
+ * (lowered weapons are otherwise hidden, see `_showWeapons`), standing still
857
+ * is `meleeIdle` (UAL's `Sword_Idle`), and the right trigger swings
858
+ * (`meleeAttack`, `Sword_Attack`, played through) instead of sprinting.
859
+ * JS only; the game sets it when what is in hand changes.
860
+ */
861
+ get holdingWeapon() {
862
+ return this._holdingWeapon;
863
+ }
864
+ set holdingWeapon(on) {
865
+ this._holdingWeapon = on;
866
+ this._showWeapons(this.gunplay);
867
+ }
868
+ _holdingWeapon = false;
836
869
  /**
837
870
  * Put the weapon up or down.
838
871
  *
@@ -868,8 +901,9 @@ export class B3dBiped extends B3dControllable {
868
901
  * walk — and that is already on the list.
869
902
  */
870
903
  _showWeapons(visible) {
904
+ const shown = visible || this._holdingWeapon;
871
905
  for (const w of this._weapons())
872
- w.mesh?.setEnabled(visible);
906
+ w.mesh?.setEnabled(shown);
873
907
  }
874
908
  /**
875
909
  * POINT THE WEAPON WHERE THE SHOT GOES.
@@ -938,7 +972,9 @@ export class B3dBiped extends B3dControllable {
938
972
  * (TS2611). An arrow field binds `this` and reads the mode live, which is all
939
973
  * the getter was for.
940
974
  */
941
- inputMapping = (pad, dt) => bipedMapping(pad, dt, this.gunplay);
975
+ inputMapping = (pad, dt) =>
976
+ // A melee weapon takes the trigger too: it swings rather than sprints.
977
+ bipedMapping(pad, dt, this.gunplay || this._holdingWeapon);
942
978
  inputLabels = bipedMappingDescriptor.labels;
943
979
  /**
944
980
  * Aiming right now.
@@ -1630,6 +1666,8 @@ export class B3dBiped extends B3dControllable {
1630
1666
  * layer instead, because a walk cycle is still a walk cycle.
1631
1667
  */
1632
1668
  _gunplayState(name) {
1669
+ if (!this.gunplay && this._holdingWeapon)
1670
+ return this._meleeState(name);
1633
1671
  if (!this.gunplay)
1634
1672
  return name;
1635
1673
  if (name !== 'idle')
@@ -1765,8 +1803,33 @@ export class B3dBiped extends B3dControllable {
1765
1803
  for (const group of this._eased)
1766
1804
  group.blendingSpeed = step;
1767
1805
  }
1806
+ /**
1807
+ * The melee version of a state: a swing in progress takes the whole body
1808
+ * while on the ground (not mid-jump, swimming or climbing), and standing
1809
+ * still is on guard. A rig without the clips keeps its own states.
1810
+ */
1811
+ _meleeState(name) {
1812
+ if (this._attackFor > 0 && MELEE_GROUND.has(name))
1813
+ return 'meleeAttack';
1814
+ if (name === 'idle' && this._hasClip('Sword_Idle'))
1815
+ return 'meleeIdle';
1816
+ return name;
1817
+ }
1818
+ /** Seconds left of the swing playing now. */
1819
+ _attackFor = 0;
1820
+ _swing() {
1821
+ if (!this._hasClip('Sword_Attack')) {
1822
+ this._warnOnce(`b3d-biped: melee attack, but ${this.url || 'this rig'} has no ` +
1823
+ `Sword_Attack clip. If it should, the asset is probably cached.`);
1824
+ return;
1825
+ }
1826
+ this._attackFor = this._clipSeconds('Sword_Attack') || 1;
1827
+ }
1768
1828
  setAnimationState(name, speed = 1) {
1769
1829
  name = this._gunplayState(name);
1830
+ // A swing and the guard play at their own speed, not the gait's.
1831
+ if (name === 'meleeAttack' || name === 'meleeIdle')
1832
+ speed = 1;
1770
1833
  if (name == null) {
1771
1834
  throw new Error('setAnimationState failed, no animation name specified.');
1772
1835
  }
@@ -2340,6 +2403,13 @@ export class B3dBiped extends B3dControllable {
2340
2403
  // holstered character who fires anyway is worse than one who cannot.
2341
2404
  if (this.gunplay && (input.shoot ?? 0) > 0.5)
2342
2405
  this._fireWeapons();
2406
+ // A melee weapon swings, once per swing: held, it swings again after.
2407
+ this._attackFor = Math.max(0, this._attackFor - dt);
2408
+ if (!this.gunplay &&
2409
+ this._holdingWeapon &&
2410
+ this._attackFor === 0 &&
2411
+ (input.shoot ?? 0) > 0.5)
2412
+ this._swing();
2343
2413
  // After the shot, so the ring sits where THIS frame's aim points rather
2344
2414
  // than lagging it by one.
2345
2415
  if (this.owner != null)
@@ -3373,6 +3443,10 @@ export class B3dBiped extends B3dControllable {
3373
3443
  if (changes.length)
3374
3444
  console.warn('<tosi-b3d-biped>: the character file, read with changes', changes);
3375
3445
  const settings = c.settings;
3446
+ // The pictures its materials use (a print chosen from disk), by key.
3447
+ const { registerPicture } = await import('./material-pictures.js');
3448
+ for (const [key, b64] of Object.entries(c.pictures ?? {}))
3449
+ registerPicture(key, b64);
3376
3450
  // A mesh body comes from the page's sources, or from where the file says
3377
3451
  // (a URL, or the mesh itself inside the file).
3378
3452
  const sources = { ...CHARACTER_SOURCES };
@@ -3410,7 +3484,7 @@ export class B3dBiped extends B3dControllable {
3410
3484
  return;
3411
3485
  }
3412
3486
  // The clips the states name, from the library, retargeted and named as they were.
3413
- const library = await BABYLON.LoadAssetContainerAsync(attrs.animations || assetUrl('quaternius/UAL1_core.glb', 2), scene);
3487
+ const library = await BABYLON.LoadAssetContainerAsync(attrs.animations || assetUrl('quaternius/UAL1_core.glb', 3), scene);
3414
3488
  library.addAllToScene();
3415
3489
  for (const g of library.animationGroups)
3416
3490
  g.stop();