@mochiya/avatar-composition 0.1.0 → 0.1.2
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.
- package/LICENSE +21 -21
- package/README.md +262 -237
- package/dist/index.d.ts +3 -0
- package/dist/index.js +110 -32
- package/dist/specification/README.md +1 -1
- package/package.json +74 -67
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Mochiya
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mochiya
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,237 +1,262 @@
|
|
|
1
|
-
# Mochiya Avatar Composition
|
|
2
|
-
|
|
3
|
-
Compose a base avatar with clothing, hair and other **attachments** in Three.js, with reversible rig binding, fit settings and controls. This package is the maintenance home of the **`MOCHIYA_avatar_composition` glTF extension**, its schema and runtime behavior.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| `
|
|
22
|
-
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Install
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
The
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
1
|
+
# Mochiya Avatar Composition
|
|
2
|
+
|
|
3
|
+
Compose a base avatar with clothing, hair and other **attachments** in Three.js, with reversible rig binding, fit settings and controls. This package is the maintenance home of the **`MOCHIYA_avatar_composition` glTF extension**, its schema and runtime behavior.
|
|
4
|
+
|
|
5
|
+
Source: [mochiya-labs/avatar-composition](https://github.com/mochiya-labs/avatar-composition). Export avatars and attachments from Unity with [Mochiya Avatar Tools](https://github.com/mochiya-labs/unity-avatar-tools).
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
flowchart LR
|
|
9
|
+
Unity["Mochiya Unity exporter"] --> File["Avatar or attachment<br/>VRM / GLB + Mochiya data"]
|
|
10
|
+
File --> Loader["GLTFLoader + Mochiya plugin"]
|
|
11
|
+
Loader --> Session["AvatarCompositionSession<br/>one base + attachments"]
|
|
12
|
+
VRM["three-vrm<br/>standard VRM behavior"] --> Session
|
|
13
|
+
Session --> View["Host scene and animation loop"]
|
|
14
|
+
LilToon["Any material library<br/>host-owned rendering"] --> View
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Avatar or attachment
|
|
18
|
+
|
|
19
|
+
The runtime follows the Unity exporter's declared kind, including when an attachment contains a humanoid rig.
|
|
20
|
+
|
|
21
|
+
| `assetKind` | Unity export rule | Runtime role |
|
|
22
|
+
| ------------ | --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
23
|
+
| `avatar` | Own VRM-compatible humanoid and no external Modular Avatar (MA) dependency. May include clothing and child armatures. | Session base; included content stays together. |
|
|
24
|
+
| `attachment` | Needs its direct parent's humanoid or has external MA dependencies/effects. That parent must be a valid avatar. | Added with `session.attach()`. |
|
|
25
|
+
|
|
26
|
+
Both converted kinds carry the extension when exported through Mochiya. Conversion preserves separate armatures; MA owns Unity-side merging. Files without the extension can use host-selected roles and bone-name attachment, without recovered MA actions.
|
|
27
|
+
|
|
28
|
+
## Extension capabilities
|
|
29
|
+
|
|
30
|
+
`MOCHIYA_avatar_composition` **0.1** stores MA-style component instructions at the glTF document root. The runtime resolves them against a selected base when an attachment is added. Standard skinning, VRM expressions/physics and material rendering keep their own formats and owners.
|
|
31
|
+
|
|
32
|
+
| Component | Converted Unity source | Runtime capability and limit |
|
|
33
|
+
| ---------------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| `mergeArmature` | **MA Merge Armature**; generated parent reference rig | Store roots, prefix/suffix and settings; discover matching bones at attachment time. Unidirectional following with retained skins/rest offsets. Other lock modes warn and use that direction. |
|
|
35
|
+
| `boneProxy` | **MA Bone Proxy**; generated external VRC collider anchors | Follow a base target with Keep World Pose or At Root. Partial-pose/scale modes warn and keep world pose. |
|
|
36
|
+
| `shapeChanger` | **MA Shape Changer** | Set blendshape weights or reversibly remove triangles affected by a blendshape. Preserves MA's distance threshold (default `0.01`). |
|
|
37
|
+
| `blendshapeSync` | **MA Blendshape Sync** | Grouped driver/driven references and linear remap points. No sync chains/cycles. |
|
|
38
|
+
| `objectToggle` | **MA Object Toggle** | Grouped Boolean visibility changes with logical ancestor conditions. No visibility cycles. |
|
|
39
|
+
| `materialSetter` | **MA Material Setter** | Grouped slot replacements using file-local materials; shader-independent. |
|
|
40
|
+
| `menuItem` | **MA Menu Item** | Toggle or momentary Button; parameter/value/default metadata. Automatic source-object activation; named parameters remain local, without arbitrary Animator effects. |
|
|
41
|
+
|
|
42
|
+
Unity conversion preserves component boundaries and separate armatures. Generated reference rigs/collider anchors are labeled by `origin`. The runtime follows external base targets without collapsing skeletons; local merge requests remain unapplied with warnings. Each VRM owns its springs and colliders; cross-asset collider linking is outside the extension.
|
|
43
|
+
|
|
44
|
+
### Data and matching
|
|
45
|
+
|
|
46
|
+
Delete uses the loaded base mesh's position deltas and restores polygons when disabled or detached. It keeps vertex buffers and morph weights intact. Missing geometry uses weight `0` with a warning; multi-frame Unity shapes and scale baking can affect parity. See the [deletion rules](https://github.com/mochiya-labs/avatar-composition/blob/main/specification/README.md#shape-changer-deletion) for thresholds and precedence.
|
|
47
|
+
|
|
48
|
+
| Data | Purpose |
|
|
49
|
+
| ------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
50
|
+
| `specVersion`, `assetKind` | Required `0.1` and `avatar`/`attachment`. |
|
|
51
|
+
| `components` | Ordered records with unique ID, type, source node, supported settings and grouped entries. |
|
|
52
|
+
| `asset: "self"` | Final file-local node/morph indices; material indices also stay local. |
|
|
53
|
+
| `asset: "base"` | Hierarchy paths and bone/mesh/blendshape keywords; optional humanoid fallback. |
|
|
54
|
+
| `matching`, `nodes`, `rig.role` | Name hints/aliases, initial visibility and avatar/reference-rig role. |
|
|
55
|
+
| `requiredCapabilities` | Component types required by the file. |
|
|
56
|
+
|
|
57
|
+
**Matching is best effort:** unresolved or ambiguous names warn and skip only affected entries. There is no base identity/checksum gate or automatic adaptation to another body shape. Malformed records, invalid local indices and unsupported required capabilities are errors.
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"id": "coat-rig",
|
|
62
|
+
"type": "mergeArmature",
|
|
63
|
+
"sourceNode": 12,
|
|
64
|
+
"target": {
|
|
65
|
+
"asset": "base",
|
|
66
|
+
"path": ["Armature"],
|
|
67
|
+
"boneKeywords": ["Armature"]
|
|
68
|
+
},
|
|
69
|
+
"prefix": "Coat_",
|
|
70
|
+
"lockMode": "unidirectional"
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
This record belongs in `components` and assumes node 12 exists in the file. Bone pairs are computed at runtime. See the [behavior specification](https://github.com/mochiya-labs/avatar-composition/blob/main/specification/README.md) for defaults, conditions, matching and evaluation order, and the [JSON Schema](https://github.com/mochiya-labs/avatar-composition/blob/main/schema/MOCHIYA_avatar_composition.schema.json) for structure. The schema is also exported as `@mochiya/avatar-composition/schema`. The current draft replaces the old action/joint-mapping format: **re-export older assets**.
|
|
75
|
+
|
|
76
|
+
## Install
|
|
77
|
+
|
|
78
|
+
Install the built tarball in your application with compatible peers; these versions are a reproducible example:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
npm install /path/to/mochiya-avatar-composition-0.1.0.tgz three@0.185.1 @pixiv/three-vrm@3.5.5
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
After publication, the tarball path can be replaced with `@mochiya/avatar-composition@0.1.0`. Commit the application's package manifest and lockfile so deployment installs the same release. No source checkout or package build is needed on the deployment server. Keep one shared copy of Three.js and three-vrm in the host application.
|
|
85
|
+
|
|
86
|
+
The package includes compiled ESM JavaScript, TypeScript declarations and the extension contract in `dist/`, plus npm's README, LICENSE and package metadata. Implementation source, source maps, development tools, tests, viewer files and model assets are excluded. Compiled JavaScript remains inspectable by consumers.
|
|
87
|
+
|
|
88
|
+
## Try the example viewer (source checkout)
|
|
89
|
+
|
|
90
|
+
Use Node.js 20.19+ for the viewer. A normal install uses the published `@mochiya/three-liltoon` package:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
git clone https://github.com/mochiya-labs/avatar-composition.git
|
|
94
|
+
cd avatar-composition/examples/viewer
|
|
95
|
+
npm install
|
|
96
|
+
npm run dev
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Run `npm run build` from `examples/viewer` to create the production site in that directory's `dist/`, then `npm run preview` to serve it locally. npm uses the repository's workspace and root lockfile when installing from the viewer directory. The viewer compiles Avatar Composition's source directly; it does not need the library's ignored `dist/` or a separate library build. The repository-root `viewer:dev` and `viewer:build` scripts remain convenient alternatives.
|
|
100
|
+
|
|
101
|
+
To test unpublished changes from a sibling `three-liltoon/` checkout, run these commands from the Avatar Composition repository root. They build that package and apply a local install without changing the committed manifest or lockfile:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
npm --prefix ../three-liltoon run build:package
|
|
105
|
+
npm run viewer:use-local-liltoon
|
|
106
|
+
npm run viewer:dev
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Run `npm install` again to restore the published dependency recorded in the lockfile. Clean npm and Vercel installs always use the registry package.
|
|
110
|
+
|
|
111
|
+
Open Vite's URL (normally `http://127.0.0.1:5175`). **Load avatar**, then **Add attachment** using your VRM/GLB files. Select an asset to inspect its controls and matching results; hide or remove attachments to undo their effects. For any selected VRM, **Show debug visualizers** displays its available humanoid, look-at, constraint, spring-joint and collider helpers. This setting is independent for each asset and starts off. Optional base animations use VRMA files. All files stay in the browser.
|
|
112
|
+
|
|
113
|
+
The viewer starts empty, with Assets, Preview and Inspector always available. The Inspector groups lilToon and composition warnings into collapsed accordions, provides per-mesh visibility and blendshape inspection, and shows a collapsed bone hierarchy for the selected asset. When the selected file contains `MOCHIYA_avatar_composition`, its extension debugger shows authored component instructions separately from resolved links, modified targets and skipped entries, with the complete manifest available. Panels stack below the preview on small screens. Lighting and the ground grid use fixed defaults; no demo models or stage settings are included.
|
|
114
|
+
|
|
115
|
+
The navigation matches the lilToon viewer and Mochiya website, with the Mochiya mascot and wordmark, a [GitHub source link](https://github.com/mochiya-labs/avatar-composition), an English/日本語 menu, and Light/Dark/System appearance choices. Language and appearance preferences are saved in the browser. Changing them preserves the current avatar composition.
|
|
116
|
+
|
|
117
|
+
### Deploy the viewer to Vercel
|
|
118
|
+
|
|
119
|
+
Import `mochiya-labs/avatar-composition` and use these project settings:
|
|
120
|
+
|
|
121
|
+
| Setting | Value |
|
|
122
|
+
| -------------------------------------------------------------------- | -------------------------------------------------- |
|
|
123
|
+
| Root Directory | `examples/viewer` |
|
|
124
|
+
| Framework Preset | Vite |
|
|
125
|
+
| Install Command | Default (automatic npm installation) |
|
|
126
|
+
| Build Command | Default (`npm run build`) |
|
|
127
|
+
| Output Directory | Default (`dist`, relative to the viewer directory) |
|
|
128
|
+
| Include source files outside of the Root Directory in the Build Step | Enabled |
|
|
129
|
+
|
|
130
|
+
Leave the install, build and output override switches off. The repository root must be included because it contains the workspace lockfile and the Avatar Composition source. This uses the same viewer-directory/default-command deployment flow as the three-liltoon example, with Vite providing this viewer's framework defaults. No custom Vercel configuration file or library build step is required.
|
|
131
|
+
|
|
132
|
+
## Use in Three.js
|
|
133
|
+
|
|
134
|
+
The host supplies `scene`, retargeted animation clips and the render loop. The session can own the base animation mixer and frame ordering. Await loading before preparing assets. The core has no material-library dependency.
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
|
|
138
|
+
import { VRMLoaderPlugin, VRMUtils } from "@pixiv/three-vrm";
|
|
139
|
+
import {
|
|
140
|
+
MochiyaAvatarCompositionLoaderPlugin,
|
|
141
|
+
prepareAvatarAsset,
|
|
142
|
+
AvatarCompositionSession,
|
|
143
|
+
disposeAvatarAsset,
|
|
144
|
+
} from "@mochiya/avatar-composition";
|
|
145
|
+
|
|
146
|
+
const loader = new GLTFLoader()
|
|
147
|
+
.register((p) => new VRMLoaderPlugin(p))
|
|
148
|
+
.register((p) => new MochiyaAvatarCompositionLoaderPlugin(p));
|
|
149
|
+
|
|
150
|
+
async function load(url: string) {
|
|
151
|
+
const gltf = await loader.loadAsync(url);
|
|
152
|
+
if (gltf.userData.vrm) VRMUtils.rotateVRM0(gltf.userData.vrm);
|
|
153
|
+
return prepareAvatarAsset(gltf);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const base = await load("/avatar.vrm");
|
|
157
|
+
const attachment = await load("/attachment.vrm");
|
|
158
|
+
scene.add(base.scene, attachment.scene);
|
|
159
|
+
const session = new AvatarCompositionSession({ base });
|
|
160
|
+
const result = session.attach(attachment, { id: "coat", layerOrder: 0 });
|
|
161
|
+
console.log(result.status, result.warnings, result.resolved); // attached | partial | unbound
|
|
162
|
+
|
|
163
|
+
function update(delta: number) {
|
|
164
|
+
// Call once per rendered frame.
|
|
165
|
+
session.update(delta);
|
|
166
|
+
const updated = new Set(base.vrm?.materials ?? []);
|
|
167
|
+
for (const material of attachment.vrm?.materials ?? []) {
|
|
168
|
+
if (!attachment.scene.visible || updated.has(material)) continue;
|
|
169
|
+
updated.add(material);
|
|
170
|
+
(
|
|
171
|
+
material as typeof material & { update?: (delta: number) => void }
|
|
172
|
+
).update?.(delta);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function hideAttachment() {
|
|
177
|
+
session.setItemState("coat", { visible: false });
|
|
178
|
+
}
|
|
179
|
+
function cleanup() {
|
|
180
|
+
session.detach("coat");
|
|
181
|
+
disposeAvatarAsset(attachment);
|
|
182
|
+
session.dispose();
|
|
183
|
+
disposeAvatarAsset(base);
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Controls use the menu parameter or component ID: `setItemState(id, { controls: { controlId: value } })`, `setBaseControl()` and `setBaseMorph()`. Use `menuItems(asset.manifest)` to build a control UI; buttons send their value while held and 0 on release/cancel. The session advances attachment expressions/constraints/springs; update the whole VRM only on the base. Plain GLB has no VRM physics.
|
|
188
|
+
|
|
189
|
+
For editable mesh morphs, call `session.isMorphControlled(mesh, index)` before enabling a slider and `session.setMorph(mesh, index, value)` to apply a user weight. The latter returns false for a currently composition-controlled target and throws for non-finite values or targets outside the session. Accepted weights survive VRM expression updates; active composition writes still take precedence. Recheck controls after attachment visibility, menu or membership changes.
|
|
190
|
+
|
|
191
|
+
Hosts that already call `session.update()` each frame can use `session.setMorph(mesh, index, value, { deferEvaluation: true })`. It records the weight immediately without restoring unrelated composition layers or evaluating the entire composition; the next `update()` applies the normal composition lifecycle. Coalesce pointer events to the latest value per mesh/weight before that update, and persist the final edit when the gesture finishes. Ownership and morph-writer lookups are indexed when session membership changes; control conditions remain live.
|
|
192
|
+
|
|
193
|
+
Pass a clip retargeted to `base.vrm` to `session.setAnimation(clip, time)`. The session creates one mixer on the base scene; use `session.update(delta, paused)` for playback and `animationTime` for serialization. Passing `null` stops playback and resets the normalized humanoid pose. `session.update(delta)` restores overlays, advances the mixer and base VRM, updates world matrices, then evaluates attachment behavior. Hosts that already own animation may instead retain `beforeVrmUpdate()` / `afterVrmUpdate(delta)` around their own base update; use only one frame-update approach.
|
|
194
|
+
|
|
195
|
+
Use independent loaded instances per attachment. Detach before disposal; session disposal restores overlays without freeing assets. Changing bases requires a new session and renewed matching.
|
|
196
|
+
|
|
197
|
+
### Materials and ownership
|
|
198
|
+
|
|
199
|
+
| Concern | Responsibility |
|
|
200
|
+
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
201
|
+
| Material swaps | Core assigns file-local materials and restores the original binding. No shader-specific bridge. |
|
|
202
|
+
| glTF primitive | Replaces its entire material binding, including loader-expanded arrays; undo restores the original array and geometry groups. |
|
|
203
|
+
| Procedural meshes | Swaps only the selected material slot. Pass `authoredObjects` when the scene includes generated helpers. |
|
|
204
|
+
| Rendering and material animation | Host and chosen material library. `base.vrm.update()` advances base materials; advance visible attachment materials once in the host loop. |
|
|
205
|
+
| Disposal | `prepareAvatarAsset()` captures owned parser resources. Detach before disposal. Procedural assets accept explicit `resources`; omit shared resources managed by another owner. |
|
|
206
|
+
|
|
207
|
+
The core never inspects shader uniforms or custom texture caches. `disposeAvatarAsset()` releases its resource snapshot once, so later material swaps cannot make it dispose a borrowed material. Procedural default ownership includes geometry, skeletons and materials; declare textures explicitly with `resources` when the asset owns them.
|
|
208
|
+
|
|
209
|
+
Preparation inventories resolved parser textures without forcing otherwise unused images to load. It retains the original material index table, including materials referenced only by composition actions. Decoded `ImageBitmap` images from those textures are owned until asset disposal; shared images close after the final owning asset. Procedural hosts can explicitly transfer bitmap ownership with `resources.imageBitmaps`; omit borrowed images. Do not close active images after their first upload, because context restoration can need them again.
|
|
210
|
+
|
|
211
|
+
Triangle deletion uses independently disposable attribute wrappers sharing the source vertex and morph typed arrays. Filtering allocates indices without copying every blendshape. Three.js may still allocate separate GPU buffers and morph textures for the geometry view. As with ordinary Three attributes, mark source attributes as needing an update after changing their data so the deletion view is rebuilt.
|
|
212
|
+
|
|
213
|
+
### Optional lilToon rendering
|
|
214
|
+
|
|
215
|
+
Install [`@mochiya/three-liltoon`](https://github.com/mochiya-labs/three-liltoon) in the **application** and configure it independently. The sample viewer demonstrates this setup; the core works without the material package.
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
import { enableLilToon } from "@mochiya/three-liltoon";
|
|
219
|
+
import { VRMLoaderPlugin } from "@pixiv/three-vrm";
|
|
220
|
+
import { enableLilToonVRM } from "@mochiya/three-liltoon/vrm";
|
|
221
|
+
|
|
222
|
+
const releaseRendering = enableLilToon(renderer); // Once per renderer owner.
|
|
223
|
+
const loader = new GLTFLoader()
|
|
224
|
+
.register((p) => enableLilToonVRM(new VRMLoaderPlugin(p)))
|
|
225
|
+
.register((p) => new MochiyaAvatarCompositionLoaderPlugin(p));
|
|
226
|
+
// Use this loader with the load(), session and frame loop above.
|
|
227
|
+
// On teardown: dispose the session and assets, then releaseRendering().
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The material plugin reads only `MOCHIYA_materials_liltoon`; the Mochiya plugin reads only `MOCHIYA_avatar_composition`. The helper enhances the standard VRM plugin with material loading and expression bindings; it also loads ordinary glTF/GLB without requiring VRM data. Outlines and casters follow ordinary material assignments automatically. Omitting lilToon leaves ordinary glTF fallback materials and attachment behavior available. The source checkout's `examples/viewer/src/engine.ts` demonstrates the complete lifecycle.
|
|
231
|
+
|
|
232
|
+
## Contributing
|
|
233
|
+
|
|
234
|
+
Run `npm run format` after code changes and `npm run format:check` before submitting them. VS Code uses the same Prettier settings on save; generated files and local Unity assets are excluded.
|
|
235
|
+
|
|
236
|
+
Browser tests generate minimal VRM/GLB inputs in memory. The optional Unity integration test reads the companion exporter's Editor-test outputs from `MOCHIYA_UNITY_FIXTURES` (or `test/unity-project/MochiyaTests`); run Unity first, then the browser suite. Model binaries remain outside Git and the package.
|
|
237
|
+
|
|
238
|
+
Update `specification/README.md` and `src/schema.ts`, regenerate the JSON Schema with `build`, and align exporter mappings. General mesh cutters, arbitrary MA/VRC controllers and automatic body-shape adaptation are outside this package's scope.
|
|
239
|
+
|
|
240
|
+
```sh
|
|
241
|
+
npm run build
|
|
242
|
+
npm run typecheck
|
|
243
|
+
npm test
|
|
244
|
+
npm run viewer:build
|
|
245
|
+
npm run test:browser
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### npm distribution (maintainers)
|
|
249
|
+
|
|
250
|
+
`npm run build` uses tsup and the existing schema generator to produce the runtime, schema and behavior guide under `dist`. The entire `dist/` directory is ignored by Git; do not commit generated distribution files. Source maps are disabled. There are no separate staging or package-check scripts.
|
|
251
|
+
|
|
252
|
+
Before distributing a tarball:
|
|
253
|
+
|
|
254
|
+
```sh
|
|
255
|
+
npm run build
|
|
256
|
+
npm pack --dry-run
|
|
257
|
+
npm pack
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Inspect the standard `npm pack --dry-run` output before release: it should contain only `dist/`, README, LICENSE and package metadata. Build before packing; there is no `prepare` or `prepack` hook. Consumers install the compiled package without running build or install lifecycle scripts.
|
|
261
|
+
|
|
262
|
+
Publishing with `npm publish` runs formatting, TypeScript, build and runtime tests through npm's standard `prepublishOnly` hook and uses the public npm registry. Choose a new package version for later releases. The local viewer workspace is never included in the runtime archive.
|
package/dist/index.d.ts
CHANGED
|
@@ -3110,12 +3110,15 @@ interface AvatarAssetResources {
|
|
|
3110
3110
|
skeletons?: Iterable<Skeleton>;
|
|
3111
3111
|
materials?: Iterable<Material>;
|
|
3112
3112
|
textures?: Iterable<Texture>;
|
|
3113
|
+
/** Decoded images owned by the asset; shared images close after their last asset. */
|
|
3114
|
+
imageBitmaps?: Iterable<ImageBitmap>;
|
|
3113
3115
|
}
|
|
3114
3116
|
declare class AvatarAsset {
|
|
3115
3117
|
readonly scene: Object3D;
|
|
3116
3118
|
readonly resources: Set<{
|
|
3117
3119
|
dispose(): void;
|
|
3118
3120
|
}>;
|
|
3121
|
+
readonly imageBitmaps: Set<ImageBitmap>;
|
|
3119
3122
|
disposed: boolean;
|
|
3120
3123
|
readonly meshes: Mesh[];
|
|
3121
3124
|
readonly bones: Bone[];
|
package/dist/index.js
CHANGED
|
@@ -214,6 +214,7 @@ var MochiyaAvatarCompositionLoaderPlugin = class {
|
|
|
214
214
|
if (value) gltf.userData.mochiyaAvatarComposition = parseManifest(value);
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
|
+
var imageOwners = /* @__PURE__ */ new WeakMap();
|
|
217
218
|
var AvatarAsset = class {
|
|
218
219
|
constructor(scene, options = {}) {
|
|
219
220
|
this.scene = scene;
|
|
@@ -255,6 +256,7 @@ var AvatarAsset = class {
|
|
|
255
256
|
...resources.materials ?? [],
|
|
256
257
|
...resources.textures ?? []
|
|
257
258
|
]);
|
|
259
|
+
this.imageBitmaps = new Set(resources.imageBitmaps ?? []);
|
|
258
260
|
if (options.nodes)
|
|
259
261
|
for (const [index2, node] of options.nodes) this.nodes.set(index2, node);
|
|
260
262
|
for (const [index2, node] of this.nodes) this.indices.set(node, index2);
|
|
@@ -267,9 +269,12 @@ var AvatarAsset = class {
|
|
|
267
269
|
this.authoredActive.set(node, entry.active);
|
|
268
270
|
node.visible = entry.active;
|
|
269
271
|
}
|
|
272
|
+
for (const image of this.imageBitmaps)
|
|
273
|
+
imageOwners.set(image, (imageOwners.get(image) ?? 0) + 1);
|
|
270
274
|
}
|
|
271
275
|
scene;
|
|
272
276
|
resources;
|
|
277
|
+
imageBitmaps;
|
|
273
278
|
disposed = false;
|
|
274
279
|
meshes = [];
|
|
275
280
|
bones = [];
|
|
@@ -309,7 +314,9 @@ async function prepareAvatarAsset(gltf) {
|
|
|
309
314
|
aliases.set(node, [parser.json.nodes?.[index2]?.name ?? ""]);
|
|
310
315
|
});
|
|
311
316
|
const materials = await parser.getDependencies("material");
|
|
312
|
-
const textures = new Set(
|
|
317
|
+
const textures = /* @__PURE__ */ new Set();
|
|
318
|
+
for (const resource of parser.associations.keys())
|
|
319
|
+
if (resource.isTexture) textures.add(resource);
|
|
313
320
|
const authoredObjects = /* @__PURE__ */ new Set([gltf.scene, ...nodes.values()]);
|
|
314
321
|
const meshes = [];
|
|
315
322
|
gltf.scene.traverse((node) => {
|
|
@@ -341,7 +348,10 @@ async function prepareAvatarAsset(gltf) {
|
|
|
341
348
|
geometries: meshes.map((m) => m.geometry),
|
|
342
349
|
skeletons: meshes.filter((m) => !!m.isSkinnedMesh).map((m) => m.skeleton),
|
|
343
350
|
materials: ownedMaterials,
|
|
344
|
-
textures
|
|
351
|
+
textures,
|
|
352
|
+
imageBitmaps: typeof ImageBitmap === "undefined" ? [] : [...textures].map((texture) => texture.image).filter(
|
|
353
|
+
(image) => image instanceof ImageBitmap
|
|
354
|
+
)
|
|
345
355
|
}
|
|
346
356
|
});
|
|
347
357
|
for (const mesh of asset.meshes) {
|
|
@@ -355,9 +365,35 @@ function disposeAvatarAsset(asset) {
|
|
|
355
365
|
if (asset.disposed) return;
|
|
356
366
|
asset.disposed = true;
|
|
357
367
|
asset.scene.removeFromParent();
|
|
358
|
-
|
|
359
|
-
|
|
368
|
+
const errors = [];
|
|
369
|
+
try {
|
|
370
|
+
asset.vrm?.springBoneManager?.reset();
|
|
371
|
+
} catch (error) {
|
|
372
|
+
errors.push(error);
|
|
373
|
+
}
|
|
374
|
+
asset.resources.forEach((resource) => {
|
|
375
|
+
try {
|
|
376
|
+
resource.dispose();
|
|
377
|
+
} catch (error) {
|
|
378
|
+
errors.push(error);
|
|
379
|
+
}
|
|
380
|
+
});
|
|
360
381
|
asset.resources.clear();
|
|
382
|
+
for (const image of asset.imageBitmaps) {
|
|
383
|
+
const remaining = (imageOwners.get(image) ?? 1) - 1;
|
|
384
|
+
if (remaining > 0) imageOwners.set(image, remaining);
|
|
385
|
+
else {
|
|
386
|
+
imageOwners.delete(image);
|
|
387
|
+
try {
|
|
388
|
+
image.close();
|
|
389
|
+
} catch (error) {
|
|
390
|
+
errors.push(error);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
asset.imageBitmaps.clear();
|
|
395
|
+
if (errors.length)
|
|
396
|
+
throw new AggregateError(errors, "Asset resource cleanup failed");
|
|
361
397
|
}
|
|
362
398
|
|
|
363
399
|
// src/matching.ts
|
|
@@ -617,7 +653,12 @@ function operations(component, sourceOrder) {
|
|
|
617
653
|
}
|
|
618
654
|
|
|
619
655
|
// src/deletion.ts
|
|
620
|
-
import {
|
|
656
|
+
import {
|
|
657
|
+
BufferAttribute,
|
|
658
|
+
BufferGeometry,
|
|
659
|
+
InterleavedBuffer,
|
|
660
|
+
InterleavedBufferAttribute
|
|
661
|
+
} from "three";
|
|
621
662
|
var ShapeDeletion = class {
|
|
622
663
|
states = /* @__PURE__ */ new Map();
|
|
623
664
|
apply(requests, registered) {
|
|
@@ -703,7 +744,7 @@ var ShapeDeletion = class {
|
|
|
703
744
|
continue;
|
|
704
745
|
}
|
|
705
746
|
const selection = [...new Set(keys)].sort().join(";");
|
|
706
|
-
if (!state.copy) state.copy = source
|
|
747
|
+
if (!state.copy) state.copy = createIndexView(source);
|
|
707
748
|
if (selection !== state.selection) {
|
|
708
749
|
filterIndices(source, state.copy, masks);
|
|
709
750
|
state.selection = selection;
|
|
@@ -730,6 +771,54 @@ var ShapeDeletion = class {
|
|
|
730
771
|
this.states.clear();
|
|
731
772
|
}
|
|
732
773
|
};
|
|
774
|
+
function createIndexView(source) {
|
|
775
|
+
const view = new BufferGeometry();
|
|
776
|
+
const attributes = /* @__PURE__ */ new Map();
|
|
777
|
+
const interleaved = /* @__PURE__ */ new Map();
|
|
778
|
+
const share = (attribute) => {
|
|
779
|
+
const previous = attributes.get(attribute);
|
|
780
|
+
if (previous) return previous;
|
|
781
|
+
let result;
|
|
782
|
+
if ("data" in attribute) {
|
|
783
|
+
let data = interleaved.get(attribute.data);
|
|
784
|
+
if (!data) {
|
|
785
|
+
data = new InterleavedBuffer(
|
|
786
|
+
attribute.data.array,
|
|
787
|
+
attribute.data.stride
|
|
788
|
+
);
|
|
789
|
+
data.setUsage(attribute.data.usage);
|
|
790
|
+
interleaved.set(attribute.data, data);
|
|
791
|
+
}
|
|
792
|
+
result = new InterleavedBufferAttribute(
|
|
793
|
+
data,
|
|
794
|
+
attribute.itemSize,
|
|
795
|
+
attribute.offset,
|
|
796
|
+
attribute.normalized
|
|
797
|
+
);
|
|
798
|
+
} else {
|
|
799
|
+
result = new BufferAttribute(
|
|
800
|
+
attribute.array,
|
|
801
|
+
attribute.itemSize,
|
|
802
|
+
attribute.normalized
|
|
803
|
+
);
|
|
804
|
+
result.setUsage(attribute.usage);
|
|
805
|
+
result.gpuType = attribute.gpuType;
|
|
806
|
+
}
|
|
807
|
+
result.name = attribute.name;
|
|
808
|
+
attributes.set(attribute, result);
|
|
809
|
+
return result;
|
|
810
|
+
};
|
|
811
|
+
for (const [name, attribute] of Object.entries(source.attributes))
|
|
812
|
+
view.setAttribute(name, share(attribute));
|
|
813
|
+
for (const name of Object.keys(
|
|
814
|
+
source.morphAttributes
|
|
815
|
+
))
|
|
816
|
+
view.morphAttributes[name] = source.morphAttributes[name]?.map(share);
|
|
817
|
+
view.morphTargetsRelative = source.morphTargetsRelative;
|
|
818
|
+
view.boundingBox = source.boundingBox?.clone() ?? null;
|
|
819
|
+
view.boundingSphere = source.boundingSphere?.clone() ?? null;
|
|
820
|
+
return view;
|
|
821
|
+
}
|
|
733
822
|
function geometryStamp(g) {
|
|
734
823
|
const attributes = [
|
|
735
824
|
g.index,
|
|
@@ -870,36 +959,26 @@ function bindArmatures(base, asset, warnings, results, undo) {
|
|
|
870
959
|
const index2 = asset.indices.get(child);
|
|
871
960
|
if (index2 !== void 0 && roots.has(index2)) continue;
|
|
872
961
|
if (asset.nodeMeshes(child).length) continue;
|
|
873
|
-
const names = (asset
|
|
874
|
-
(name) => name.startsWith(prefix) && name.endsWith(suffix) && name.length > prefix.length + suffix.length
|
|
962
|
+
const names = exactNames(asset, child).filter(
|
|
963
|
+
(name) => name.startsWith(prefix) && name.endsWith(suffix) && name.length > prefix.length + suffix.length
|
|
964
|
+
).map(
|
|
965
|
+
(name) => name.slice(prefix.length, suffix ? -suffix.length : void 0)
|
|
875
966
|
);
|
|
876
967
|
const query = { asset: "base", boneKeywords: names };
|
|
877
|
-
const
|
|
878
|
-
node,
|
|
879
|
-
score: Math.max(
|
|
880
|
-
0,
|
|
881
|
-
...names.flatMap(
|
|
882
|
-
(q) => (base.names.get(node) ?? [node.name]).map(
|
|
883
|
-
(n) => keywordScore(n, q)
|
|
884
|
-
)
|
|
885
|
-
)
|
|
886
|
-
)
|
|
887
|
-
})).filter((x) => x.score > 0).sort((a, b) => b.score - a.score);
|
|
888
|
-
let ranked = rank(
|
|
889
|
-
pool.filter((n) => base.authoredParents.get(n) === matchedParent)
|
|
968
|
+
const matches = candidates.filter(
|
|
969
|
+
(node) => base.authoredParents.get(node) === matchedParent && exactNames(base, node).some((name) => names.includes(name))
|
|
890
970
|
);
|
|
891
|
-
|
|
892
|
-
const target = ranked.length && (ranked.length === 1 || ranked[0].score > ranked[1].score) ? ranked[0].node : void 0;
|
|
971
|
+
const target = matches.length === 1 ? matches[0] : void 0;
|
|
893
972
|
if (!target)
|
|
894
973
|
warnings.push({
|
|
895
974
|
...resolver.warning(
|
|
896
975
|
query,
|
|
897
|
-
|
|
976
|
+
matches.map((node) => node.name)
|
|
898
977
|
),
|
|
899
978
|
operation: component.id
|
|
900
979
|
});
|
|
901
980
|
if (index2 !== void 0) record(child, target, component.id, query);
|
|
902
|
-
walk2(child, target);
|
|
981
|
+
if (target) walk2(child, target);
|
|
903
982
|
}
|
|
904
983
|
};
|
|
905
984
|
var walk = walk2;
|
|
@@ -948,11 +1027,10 @@ function bindArmatures(base, asset, warnings, results, undo) {
|
|
|
948
1027
|
);
|
|
949
1028
|
if (component.type !== "mergeArmature") continue;
|
|
950
1029
|
const { prefix, suffix } = component;
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
(n) => !base.nodeMeshes(n).length && (!targetRoot || isDescendant(n, targetRoot))
|
|
1030
|
+
const candidates = [...base.nodes.values()].filter(
|
|
1031
|
+
(node) => !base.nodeMeshes(node).length
|
|
954
1032
|
);
|
|
955
|
-
walk2(source,
|
|
1033
|
+
if (rootMatch.value) walk2(source, rootMatch.value);
|
|
956
1034
|
}
|
|
957
1035
|
if (!asset.manifest)
|
|
958
1036
|
for (const source of asset.bones) {
|
|
@@ -1028,9 +1106,9 @@ function bindArmatures(base, asset, warnings, results, undo) {
|
|
|
1028
1106
|
asset.scene.updateWorldMatrix(true, true);
|
|
1029
1107
|
return { matched, requested };
|
|
1030
1108
|
}
|
|
1031
|
-
function
|
|
1032
|
-
|
|
1033
|
-
return
|
|
1109
|
+
function exactNames(asset, node) {
|
|
1110
|
+
const names = asset.names.get(node) ?? [node.name];
|
|
1111
|
+
return names.length > 1 ? names.filter((name) => name !== node.name) : names;
|
|
1034
1112
|
}
|
|
1035
1113
|
|
|
1036
1114
|
// src/session.ts
|
|
@@ -94,7 +94,7 @@ Every record has `id`, `type`, and file-local `sourceNode` identifying the GameO
|
|
|
94
94
|
|
|
95
95
|
### Armatures and physics
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
Automatic descendant matching uses exact, case-sensitive names and exported aliases. A name must contain the configured case-sensitive prefix and suffix; strip them before comparison. Search only authored direct children of the matched target parent. Never broaden the search to other branches, deeper descendants or the global base. An unmatched bone preserves its entire branch and ends that traversal. A missing root target does not trigger descendant recovery. Another component's source root is handled independently; mesh subtrees are not bone chains. Explicit root selectors and Bone Proxy selectors retain their existing resolution rules.
|
|
98
98
|
|
|
99
99
|
The runtime implements **unidirectional base-to-attachment following**. `bidirectional` and `notLocked` retain the MA setting but MUST warn and fall back to unidirectional behavior. These values describe MA's authoring position-lock setting; this runtime does not reproduce MA's build-time skeleton collapse. It retains the source bones, skin weights, inverse-bind matrices and rest offsets. `mangleNames` is retained as intent; independent instance ownership avoids name mutation. Local-to-local merges are preserved as records but warn and remain unapplied.
|
|
100
100
|
|
package/package.json
CHANGED
|
@@ -1,67 +1,74 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@mochiya/avatar-composition",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Avatar and attachment composition for Three.js and the MOCHIYA_avatar_composition glTF extension",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"author": {
|
|
8
|
-
"name": "Mochiya",
|
|
9
|
-
"url": "https://mochiya.org"
|
|
10
|
-
},
|
|
11
|
-
"homepage": "https://mochiya.org",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
},
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"@
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@mochiya/avatar-composition",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Avatar and attachment composition for Three.js and the MOCHIYA_avatar_composition glTF extension",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Mochiya",
|
|
9
|
+
"url": "https://mochiya.org"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://mochiya.org",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/mochiya-labs/avatar-composition.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/mochiya-labs/avatar-composition/issues"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public",
|
|
21
|
+
"registry": "https://registry.npmjs.org/"
|
|
22
|
+
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./schema": "./dist/schema/MOCHIYA_avatar_composition.schema.json"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
36
|
+
"workspaces": [
|
|
37
|
+
"examples/viewer"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"format": "prettier --write .",
|
|
41
|
+
"format:check": "prettier --check .",
|
|
42
|
+
"build": "tsup && node scripts/generate-schema.mjs",
|
|
43
|
+
"prepublishOnly": "npm run format:check && npm run typecheck && npm run build && npm test",
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"viewer:dev": "npm run dev --workspace @mochiya/avatar-composition-viewer",
|
|
47
|
+
"viewer:build": "npm run build --workspace @mochiya/avatar-composition-viewer",
|
|
48
|
+
"viewer:use-local-liltoon": "npm install --no-save --package-lock=false ../three-liltoon",
|
|
49
|
+
"test:browser": "playwright test"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=20.19"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"zod": "^3.25.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"@pixiv/three-vrm": ">=3.4.0 <4",
|
|
59
|
+
"three": ">=0.180.0 <0.190.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@pixiv/three-vrm": "^3.5.5",
|
|
63
|
+
"@playwright/test": "^1.62.1",
|
|
64
|
+
"@types/node": "^24.3.0",
|
|
65
|
+
"@types/three": "^0.185.4",
|
|
66
|
+
"agent-browser": "^0.36.0",
|
|
67
|
+
"prettier": "3.9.6",
|
|
68
|
+
"three": "^0.185.1",
|
|
69
|
+
"tsup": "^8.5.0",
|
|
70
|
+
"typescript": "^5.9.2",
|
|
71
|
+
"vitest": "^3.2.4",
|
|
72
|
+
"zod-to-json-schema": "^3.25.2"
|
|
73
|
+
}
|
|
74
|
+
}
|