Repository navigation
feat!: load shared object products - #40
Merged
Merged
Conversation
…bles AssetStore reads the `objects` of a manifest, the object table of an nnnotes.product/1 manifest, and gives objects by id: their class, their files by role (json, image, index, program:<platform>/<name>, blob:<field>), the objects their `$ref` values name, and typed readers for prefabs, materials, clips, MonoBehaviours and textures. The model viewer and the story player load a model from a product manifest of live2d.model. Its model.json (format 3) names the prefab, the CubismMoc (the moc3 is its blob:_bytes), the shaders and the Cubism mask materials by object id, and lists the clip bindings resolved against the model's hierarchy. Atlas pages are Texture2D objects with their sampler settings and mip count; shader programs come from the GLES3 programs of the shader objects. A story store adds the object tables of the story's model manifests to one table, and refuses manifests that list an object differently. `validate-data` checks a model manifest object by object: the classes model.json names, the moc3 header, the prefab, fades, clips and bindings, expressions, materials, textures and the shader programs the viewer and the story renderer draw with. schema/product.schema.json and schema/model-json.schema.json describe the formats, and docs/data-format.md the model objects. BREAKING CHANGE: a model manifest is a product manifest of live2d.model with a model.json of format 3, and a story manifest has the format ournotes.story-manifest/2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The model viewer reads a model manifest of format 2: one model whose clips, fade motions, expressions, materials, main textures and moc are inline in its prefab, with a shader directory and a model.json of format 1. legacy.js turns such a store into a product of live2d.model when the session loads it: every inline object becomes an object of an object table that the prefab's fields name by reference, equal materials one object, an atlas page a Texture2D with the descriptor's size, mip count, colour space and sampler settings, a shader of the directory a Shader with its GLES3 programs, and a shader the directory lacks (the mask shader of a model without masked drawables) a Shader without programs. The model.json of format 3 carries the clips' bindings and motionSync from the root's components, and `info` takes the product form with the model's key as its subject. The tests build one synthetic model in both forms (live2d-fixture.mjs) and check that the converted model plays as the product form does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A live loads from nnnotes' product layout: `loadLiveStore(url, {variants})`
fetches the live manifest (`lives/<musicId>_<difficulty>.json`), the
manifests its `live.json` `parts` names and the variant products a page
offers, and puts each product's files under its manifest path without
`.json`, with one object table.
- `LiveData` reads a live's documents from its store: `live.json`, the score
and its mirrored form, and the sounds of the `live.sounds` product that
offers the most note sound sets together with the music of `live.music`.
- `ChartSession` reads its score and sounds through `LiveData`; a chart
manifest of the site layout is read as a live (`src/live/legacy.js`), so
the existing chart sites keep playing.
- `ChartPlayer` takes a live manifest or a chart manifest as `src`, and the
new `variants` option; `loadLiveStore` is exported.
- The headless helper opens live manifests too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A live's scene, note views, note skin and note effect set are read from the live.scene, live.notes, live.noteskin and live.noteeffect products: - LiveObjects resolves prefab.json roots, materials, sprites, textures, meshes, clips, controllers and MonoBehaviour assets by object id. - One shader library serves the whole live: Shader objects by id, with the products' name tables answering lookups by name. - Clips are named by the products' bindings tables (AnimBindings, AnimClip.fromObject) for the Animator that plays them. - The engine stays independent of the data layout: FxMaterials reads materials from a directory (stories) or from objects (lives), and Prefab.fromObjects joins the roots of a scene into one hierarchy. Charts of the site layout (a chart manifest with a live directory) are converted when loaded into the same documents and objects (src/live/legacy.js): inline objects become objects of two serialized files, packed shader directories become Shader objects, references between scene roots become component references, and the clips' bindings become bindings tables. Such a chart draws exactly as before. Live options offer a note design or effect set when its product is loaded, and bar lines when the scene has the bar line view prefab. BREAKING CHANGE: the live renderers, note views and effects take LiveObjects and the product documents; the scene.json/notes.json inline formats and the livescene/livenotes directory lookups are no longer read directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…logy A sprite packed by a SpriteAtlas of another serialized file has no render data of its own: AssetStore.sprite reads it from the atlas' m_RenderDataMap entry under the sprite's m_RenderDataKey, as the engine does at run time. A Mesh's arrays document lists each submesh with its topology and indices; AssetStore.mesh gives the triangle indices of each submesh and reports a submesh of another topology as an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
validate-data checks a directory of live products: each lives/<id>.json manifest, the parts its live.json names (each part once, with its errors reported at the first live that uses it), and the live read as the player reads it: the documents against the new live-scene, live-notes, live-noteskin, live-noteeffect, live-sounds and live-music schemas, the objects (Texture2D sizes and mip counts, the GLES3 programs of the shaders that materials draw with, mesh arrays), the score's lane count and the sound files. A chart of the site layout is read as a live through src/live/legacy.js and checked the same way. read-set records the object files a session reads as "<object id>#<role>". The plan reads the prefabs of the None view and of each line view kind, as the spawns do, so plan and full mode read the same files. The data tests take a product layout as well as a chart site: a chart id names lives/<id>.json, else charts/<id>.json. docs/data-format.md describes products, lives and their parts, objects, shader objects and textures; the chart site format is described in its own section. schema/live.schema.json is the live.json of a live product, and the product name pattern accepts "live". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Combine compatible file roles from shared objects and reject conflicting metadata or file entries. Support region directories in product paths. Keep language-indexed UI resources separate from shared live part paths.
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.
Shared object products supply live charts, Live2D models, stories and UI packs through one resource loading layer. Story products include localized UI and fonts, shared media and hosts; chart entries offer live variants. Format 2 chart and Live2D model sites remain supported.
The 0.2.0 package documents product contracts and provides validation and read-set tools. Chart listings are checked against manifest metadata and unique asset byte counts. Standalone live products expose localized chart metadata, and model listings select distinct regional aliases. Story cues support silent completion and CRI volume routing; shared schemas describe prefab, media and chat status text documents.
Validation: 735 unit tests passed, 2 skipped locally; TypeScript, ESLint, seven package contracts and deterministic bundle builds passed. CI covers Node 22, 24 and 26. Product graph and regional alias regressions use synthetic inputs.
English and Chinese README guides cover installation, components and product compatibility. The getting-started and hosting guides document complete package setup, required browser runtimes, immutable product caching and compression headers.