@clockgrove/assetgrove 0.0.0-stage → 0.3.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 -0
- package/README.md +277 -2
- package/dist/animation/commands.d.ts +180 -0
- package/dist/animation/commands.js +515 -0
- package/dist/animation/facing.d.ts +44 -0
- package/dist/animation/facing.js +100 -0
- package/dist/animation/fix.d.ts +136 -0
- package/dist/animation/fix.js +529 -0
- package/dist/animation/flicker.d.ts +44 -0
- package/dist/animation/flicker.js +117 -0
- package/dist/animation/halo.d.ts +72 -0
- package/dist/animation/halo.js +253 -0
- package/dist/animation/holes.d.ts +122 -0
- package/dist/animation/holes.js +262 -0
- package/dist/animation/preview.d.ts +38 -0
- package/dist/animation/preview.js +161 -0
- package/dist/animation/qa.d.ts +57 -0
- package/dist/animation/qa.js +418 -0
- package/dist/animation/run.d.ts +109 -0
- package/dist/animation/run.js +182 -0
- package/dist/animation/strip.d.ts +13 -0
- package/dist/animation/strip.js +41 -0
- package/dist/animation/template-choice.d.ts +75 -0
- package/dist/animation/template-choice.js +153 -0
- package/dist/animation/templates.d.ts +39 -0
- package/dist/animation/templates.js +333 -0
- package/dist/animation/types.d.ts +257 -0
- package/dist/animation/types.js +1 -0
- package/dist/approvals.d.ts +156 -0
- package/dist/approvals.js +369 -0
- package/dist/audio/aac.d.ts +61 -0
- package/dist/audio/aac.js +152 -0
- package/dist/audio/checks.d.ts +38 -0
- package/dist/audio/checks.js +254 -0
- package/dist/audio/delivery.d.ts +52 -0
- package/dist/audio/delivery.js +105 -0
- package/dist/audio/engine.d.ts +65 -0
- package/dist/audio/engine.js +164 -0
- package/dist/audio/handoff.d.ts +75 -0
- package/dist/audio/handoff.js +185 -0
- package/dist/audio/kinds.d.ts +6 -0
- package/dist/audio/kinds.js +315 -0
- package/dist/audio/loudness.d.ts +22 -0
- package/dist/audio/loudness.js +72 -0
- package/dist/audio/ogg.d.ts +27 -0
- package/dist/audio/ogg.js +65 -0
- package/dist/audio/operations.d.ts +20 -0
- package/dist/audio/operations.js +335 -0
- package/dist/audio/opus.d.ts +40 -0
- package/dist/audio/opus.js +108 -0
- package/dist/audio/profile.d.ts +200 -0
- package/dist/audio/profile.js +126 -0
- package/dist/audio/run.d.ts +83 -0
- package/dist/audio/run.js +192 -0
- package/dist/audio/vorbis-comments.d.ts +25 -0
- package/dist/audio/vorbis-comments.js +243 -0
- package/dist/audio/waveform.d.ts +13 -0
- package/dist/audio/waveform.js +52 -0
- package/dist/audio-parameters.d.ts +17 -0
- package/dist/audio-parameters.js +45 -0
- package/dist/audit/bar.d.ts +65 -0
- package/dist/audit/bar.js +97 -0
- package/dist/audit/members.d.ts +40 -0
- package/dist/audit/members.js +119 -0
- package/dist/bible-view.d.ts +10 -0
- package/dist/bible-view.js +122 -0
- package/dist/bible.d.ts +272 -0
- package/dist/bible.js +641 -0
- package/dist/budget.d.ts +119 -0
- package/dist/budget.js +227 -0
- package/dist/call-parameters.d.ts +71 -0
- package/dist/call-parameters.js +90 -0
- package/dist/calls.d.ts +145 -0
- package/dist/calls.js +788 -0
- package/dist/cli/main.d.ts +22 -0
- package/dist/cli/main.js +137 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +5 -0
- package/dist/commands/animation-qa.d.ts +1 -0
- package/dist/commands/animation-qa.js +240 -0
- package/dist/commands/apply.d.ts +12 -0
- package/dist/commands/apply.js +181 -0
- package/dist/commands/audit.d.ts +92 -0
- package/dist/commands/audit.js +555 -0
- package/dist/commands/bible.d.ts +1 -0
- package/dist/commands/bible.js +39 -0
- package/dist/commands/browse.d.ts +12 -0
- package/dist/commands/browse.js +113 -0
- package/dist/commands/card.d.ts +3 -0
- package/dist/commands/card.js +445 -0
- package/dist/commands/compare.d.ts +1 -0
- package/dist/commands/compare.js +90 -0
- package/dist/commands/confirm.d.ts +1 -0
- package/dist/commands/confirm.js +267 -0
- package/dist/commands/context.d.ts +43 -0
- package/dist/commands/context.js +115 -0
- package/dist/commands/deliver.d.ts +1 -0
- package/dist/commands/deliver.js +99 -0
- package/dist/commands/disclosure.d.ts +1 -0
- package/dist/commands/disclosure.js +80 -0
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/doctor.js +112 -0
- package/dist/commands/estimate.d.ts +2 -0
- package/dist/commands/estimate.js +80 -0
- package/dist/commands/extensions.d.ts +2 -0
- package/dist/commands/extensions.js +70 -0
- package/dist/commands/fix-frame.d.ts +1 -0
- package/dist/commands/fix-frame.js +206 -0
- package/dist/commands/generate-sheet.d.ts +1 -0
- package/dist/commands/generate-sheet.js +245 -0
- package/dist/commands/identity-check.d.ts +1 -0
- package/dist/commands/identity-check.js +110 -0
- package/dist/commands/identity-eval.d.ts +1 -0
- package/dist/commands/identity-eval.js +197 -0
- package/dist/commands/import.d.ts +7 -0
- package/dist/commands/import.js +472 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +117 -0
- package/dist/commands/intake.d.ts +1 -0
- package/dist/commands/intake.js +56 -0
- package/dist/commands/labels.d.ts +1 -0
- package/dist/commands/labels.js +101 -0
- package/dist/commands/library.d.ts +9 -0
- package/dist/commands/library.js +711 -0
- package/dist/commands/lod.d.ts +1 -0
- package/dist/commands/lod.js +93 -0
- package/dist/commands/look-dev.d.ts +1 -0
- package/dist/commands/look-dev.js +148 -0
- package/dist/commands/materials.d.ts +1 -0
- package/dist/commands/materials.js +223 -0
- package/dist/commands/mcp.d.ts +1 -0
- package/dist/commands/mcp.js +53 -0
- package/dist/commands/migrate.d.ts +1 -0
- package/dist/commands/migrate.js +123 -0
- package/dist/commands/op.d.ts +5 -0
- package/dist/commands/op.js +114 -0
- package/dist/commands/ops.d.ts +1 -0
- package/dist/commands/ops.js +17 -0
- package/dist/commands/pick-batch.d.ts +24 -0
- package/dist/commands/pick-batch.js +343 -0
- package/dist/commands/pick.d.ts +48 -0
- package/dist/commands/pick.js +469 -0
- package/dist/commands/plan.d.ts +3 -0
- package/dist/commands/plan.js +156 -0
- package/dist/commands/recipe.d.ts +1 -0
- package/dist/commands/recipe.js +52 -0
- package/dist/commands/registry.d.ts +5 -0
- package/dist/commands/registry.js +121 -0
- package/dist/commands/render-sprite.d.ts +1 -0
- package/dist/commands/render-sprite.js +67 -0
- package/dist/commands/rendition.d.ts +1 -0
- package/dist/commands/rendition.js +56 -0
- package/dist/commands/request-change.d.ts +2 -0
- package/dist/commands/request-change.js +950 -0
- package/dist/commands/result.d.ts +34 -0
- package/dist/commands/result.js +237 -0
- package/dist/commands/review.d.ts +28 -0
- package/dist/commands/review.js +444 -0
- package/dist/commands/rig.d.ts +1 -0
- package/dist/commands/rig.js +74 -0
- package/dist/commands/runner.d.ts +45 -0
- package/dist/commands/runner.js +297 -0
- package/dist/commands/runs.d.ts +22 -0
- package/dist/commands/runs.js +159 -0
- package/dist/commands/search.d.ts +69 -0
- package/dist/commands/search.js +638 -0
- package/dist/commands/settings.d.ts +2 -0
- package/dist/commands/settings.js +284 -0
- package/dist/commands/spend.d.ts +2 -0
- package/dist/commands/spend.js +159 -0
- package/dist/commands/stage-source.d.ts +1 -0
- package/dist/commands/stage-source.js +58 -0
- package/dist/commands/stage.d.ts +9 -0
- package/dist/commands/stage.js +229 -0
- package/dist/commands/storage.d.ts +3 -0
- package/dist/commands/storage.js +200 -0
- package/dist/commands/turnaround.d.ts +1 -0
- package/dist/commands/turnaround.js +171 -0
- package/dist/commands/types.d.ts +195 -0
- package/dist/commands/types.js +7 -0
- package/dist/commands/vary.d.ts +2 -0
- package/dist/commands/vary.js +222 -0
- package/dist/commands/write-families.d.ts +14 -0
- package/dist/commands/write-families.js +158 -0
- package/dist/compare.d.ts +87 -0
- package/dist/compare.js +306 -0
- package/dist/confirm/delegation.d.ts +30 -0
- package/dist/confirm/delegation.js +31 -0
- package/dist/confirm/index.d.ts +84 -0
- package/dist/confirm/index.js +176 -0
- package/dist/confirm/mcp.d.ts +60 -0
- package/dist/confirm/mcp.js +253 -0
- package/dist/confirm/pending.d.ts +11 -0
- package/dist/confirm/pending.js +40 -0
- package/dist/confirm/prompt.d.ts +65 -0
- package/dist/confirm/prompt.js +68 -0
- package/dist/confirm/records.d.ts +17 -0
- package/dist/confirm/records.js +63 -0
- package/dist/contact.d.ts +80 -0
- package/dist/contact.js +224 -0
- package/dist/credentials.d.ts +170 -0
- package/dist/credentials.js +598 -0
- package/dist/dataflows.d.ts +32 -0
- package/dist/dataflows.js +42 -0
- package/dist/delivery.d.ts +89 -0
- package/dist/delivery.js +355 -0
- package/dist/disclosure.d.ts +84 -0
- package/dist/disclosure.js +397 -0
- package/dist/env.d.ts +90 -0
- package/dist/env.js +236 -0
- package/dist/errors.d.ts +90 -0
- package/dist/errors.js +105 -0
- package/dist/extension/api.d.ts +389 -0
- package/dist/extension/api.js +20 -0
- package/dist/extension/context.d.ts +9 -0
- package/dist/extension/context.js +60 -0
- package/dist/extension/helpers.d.ts +75 -0
- package/dist/extension/helpers.js +107 -0
- package/dist/extension/http.d.ts +32 -0
- package/dist/extension/http.js +104 -0
- package/dist/extension/setup.d.ts +53 -0
- package/dist/extension/setup.js +162 -0
- package/dist/extension/tools.d.ts +97 -0
- package/dist/extension/tools.js +235 -0
- package/dist/extensions/core.d.ts +7 -0
- package/dist/extensions/core.js +18 -0
- package/dist/extensions/errors.d.ts +22 -0
- package/dist/extensions/errors.js +34 -0
- package/dist/extensions/registry.d.ts +119 -0
- package/dist/extensions/registry.js +535 -0
- package/dist/extensions/version.d.ts +9 -0
- package/dist/extensions/version.js +57 -0
- package/dist/formats.d.ts +46 -0
- package/dist/formats.js +81 -0
- package/dist/frames.d.ts +58 -0
- package/dist/frames.js +80 -0
- package/dist/gateway/anthropic.d.ts +22 -0
- package/dist/gateway/anthropic.js +65 -0
- package/dist/gateway/elevenlabs.d.ts +36 -0
- package/dist/gateway/elevenlabs.js +192 -0
- package/dist/gateway/failure.d.ts +29 -0
- package/dist/gateway/failure.js +70 -0
- package/dist/gateway/openai-compatible.d.ts +20 -0
- package/dist/gateway/openai-compatible.js +76 -0
- package/dist/gateway/openai.d.ts +28 -0
- package/dist/gateway/openai.js +101 -0
- package/dist/gateway/provider.d.ts +380 -0
- package/dist/gateway/provider.js +5 -0
- package/dist/gateway/scripted.d.ts +252 -0
- package/dist/gateway/scripted.js +244 -0
- package/dist/gateway/stability.d.ts +38 -0
- package/dist/gateway/stability.js +232 -0
- package/dist/gateway/structured.d.ts +31 -0
- package/dist/gateway/structured.js +83 -0
- package/dist/gateway/tripo.d.ts +48 -0
- package/dist/gateway/tripo.js +374 -0
- package/dist/gateway/vercel.d.ts +52 -0
- package/dist/gateway/vercel.js +298 -0
- package/dist/generators/generator.d.ts +236 -0
- package/dist/generators/generator.js +12 -0
- package/dist/generators/image.d.ts +21 -0
- package/dist/generators/image.js +286 -0
- package/dist/generators/spec-schema.d.ts +29 -0
- package/dist/generators/spec-schema.js +21 -0
- package/dist/git-marker.d.ts +3 -0
- package/dist/git-marker.js +13 -0
- package/dist/gitlfs.d.ts +38 -0
- package/dist/gitlfs.js +171 -0
- package/dist/guard.d.ts +55 -0
- package/dist/guard.js +323 -0
- package/dist/handoff/current-profile.d.ts +48 -0
- package/dist/handoff/current-profile.js +127 -0
- package/dist/handoff/doctor.d.ts +26 -0
- package/dist/handoff/doctor.js +249 -0
- package/dist/handoff/mark-check.d.ts +17 -0
- package/dist/handoff/mark-check.js +66 -0
- package/dist/handoff/presets/aseprite-json.d.ts +5 -0
- package/dist/handoff/presets/aseprite-json.js +45 -0
- package/dist/handoff/presets/atlas-json.d.ts +44 -0
- package/dist/handoff/presets/atlas-json.js +195 -0
- package/dist/handoff/presets/atlas-pack.d.ts +14 -0
- package/dist/handoff/presets/atlas-pack.js +431 -0
- package/dist/handoff/presets/index.d.ts +273 -0
- package/dist/handoff/presets/index.js +58 -0
- package/dist/handoff/presets/manifest.d.ts +2 -0
- package/dist/handoff/presets/manifest.js +49 -0
- package/dist/handoff/usage.d.ts +27 -0
- package/dist/handoff/usage.js +159 -0
- package/dist/handoff.d.ts +345 -0
- package/dist/handoff.js +1221 -0
- package/dist/identity-eval.d.ts +156 -0
- package/dist/identity-eval.js +321 -0
- package/dist/identity.d.ts +293 -0
- package/dist/identity.js +675 -0
- package/dist/image/apply-style.d.ts +4 -0
- package/dist/image/apply-style.js +37 -0
- package/dist/image/digits.d.ts +5 -0
- package/dist/image/digits.js +40 -0
- package/dist/image/ktx2.d.ts +83 -0
- package/dist/image/ktx2.js +196 -0
- package/dist/image/raster.d.ts +23 -0
- package/dist/image/raster.js +77 -0
- package/dist/image/resample.d.ts +10 -0
- package/dist/image/resample.js +82 -0
- package/dist/image/webp.d.ts +17 -0
- package/dist/image/webp.js +323 -0
- package/dist/init.d.ts +132 -0
- package/dist/init.js +425 -0
- package/dist/inputs.d.ts +67 -0
- package/dist/inputs.js +151 -0
- package/dist/json.d.ts +7 -0
- package/dist/json.js +27 -0
- package/dist/keys.d.ts +34 -0
- package/dist/keys.js +198 -0
- package/dist/kind-schemas.d.ts +17 -0
- package/dist/kind-schemas.js +205 -0
- package/dist/library/actions.d.ts +76 -0
- package/dist/library/actions.js +212 -0
- package/dist/library/adopt.d.ts +177 -0
- package/dist/library/adopt.js +624 -0
- package/dist/library/canonical.d.ts +7 -0
- package/dist/library/canonical.js +29 -0
- package/dist/library/card.d.ts +138 -0
- package/dist/library/card.js +532 -0
- package/dist/library/credits.d.ts +70 -0
- package/dist/library/credits.js +222 -0
- package/dist/library/describe.d.ts +48 -0
- package/dist/library/describe.js +199 -0
- package/dist/library/diff.d.ts +26 -0
- package/dist/library/diff.js +208 -0
- package/dist/library/exact.d.ts +15 -0
- package/dist/library/exact.js +47 -0
- package/dist/library/extent.d.ts +56 -0
- package/dist/library/extent.js +205 -0
- package/dist/library/folder.d.ts +85 -0
- package/dist/library/folder.js +291 -0
- package/dist/library/labels.d.ts +29 -0
- package/dist/library/labels.js +112 -0
- package/dist/library/lfs.d.ts +42 -0
- package/dist/library/lfs.js +140 -0
- package/dist/library/maintain.d.ts +100 -0
- package/dist/library/maintain.js +750 -0
- package/dist/library/media-metadata.d.ts +19 -0
- package/dist/library/media-metadata.js +92 -0
- package/dist/library/paths.d.ts +7 -0
- package/dist/library/paths.js +65 -0
- package/dist/library/relations.d.ts +59 -0
- package/dist/library/relations.js +176 -0
- package/dist/library/review.d.ts +204 -0
- package/dist/library/review.js +545 -0
- package/dist/library/stale.d.ts +88 -0
- package/dist/library/stale.js +229 -0
- package/dist/library/suggestions.d.ts +37 -0
- package/dist/library/suggestions.js +146 -0
- package/dist/library/summary.d.ts +65 -0
- package/dist/library/summary.js +138 -0
- package/dist/library/undo.d.ts +18 -0
- package/dist/library/undo.js +141 -0
- package/dist/library/worklist.d.ts +42 -0
- package/dist/library/worklist.js +91 -0
- package/dist/library/write.d.ts +282 -0
- package/dist/library/write.js +790 -0
- package/dist/license.d.ts +67 -0
- package/dist/license.js +205 -0
- package/dist/limits.d.ts +51 -0
- package/dist/limits.js +100 -0
- package/dist/loop.d.ts +244 -0
- package/dist/loop.js +377 -0
- package/dist/material/core.d.ts +70 -0
- package/dist/material/core.js +238 -0
- package/dist/material/engine.d.ts +15 -0
- package/dist/material/engine.js +141 -0
- package/dist/material/flicker.d.ts +26 -0
- package/dist/material/flicker.js +71 -0
- package/dist/material/operations.d.ts +2 -0
- package/dist/material/operations.js +48 -0
- package/dist/material/pipeline.d.ts +51 -0
- package/dist/material/pipeline.js +431 -0
- package/dist/material/profile.d.ts +29 -0
- package/dist/material/profile.js +97 -0
- package/dist/material/rendition.d.ts +5 -0
- package/dist/material/rendition.js +76 -0
- package/dist/mcp.d.ts +72 -0
- package/dist/mcp.js +514 -0
- package/dist/media.d.ts +36 -0
- package/dist/media.js +46 -0
- package/dist/metadata.d.ts +61 -0
- package/dist/metadata.js +748 -0
- package/dist/model-declarations.d.ts +28 -0
- package/dist/model-declarations.js +14 -0
- package/dist/model3d/clip-map.d.ts +49 -0
- package/dist/model3d/clip-map.js +129 -0
- package/dist/model3d/core-checks.d.ts +61 -0
- package/dist/model3d/core-checks.js +278 -0
- package/dist/model3d/facing.d.ts +49 -0
- package/dist/model3d/facing.js +125 -0
- package/dist/model3d/generator.d.ts +19 -0
- package/dist/model3d/generator.js +482 -0
- package/dist/model3d/glb.d.ts +120 -0
- package/dist/model3d/glb.js +155 -0
- package/dist/model3d/handoff.d.ts +37 -0
- package/dist/model3d/handoff.js +131 -0
- package/dist/model3d/lod/chain.d.ts +50 -0
- package/dist/model3d/lod/chain.js +447 -0
- package/dist/model3d/lod/command.d.ts +38 -0
- package/dist/model3d/lod/command.js +377 -0
- package/dist/model3d/lod/qa.d.ts +36 -0
- package/dist/model3d/lod/qa.js +189 -0
- package/dist/model3d/lod/settings.d.ts +36 -0
- package/dist/model3d/lod/settings.js +137 -0
- package/dist/model3d/lod/simplify.d.ts +35 -0
- package/dist/model3d/lod/simplify.js +337 -0
- package/dist/model3d/lod/textures.d.ts +46 -0
- package/dist/model3d/lod/textures.js +190 -0
- package/dist/model3d/lookdev/command.d.ts +219 -0
- package/dist/model3d/lookdev/command.js +1795 -0
- package/dist/model3d/lookdev/edit.d.ts +44 -0
- package/dist/model3d/lookdev/edit.js +241 -0
- package/dist/model3d/lookdev/groom.d.ts +86 -0
- package/dist/model3d/lookdev/groom.js +462 -0
- package/dist/model3d/lookdev/markings.d.ts +98 -0
- package/dist/model3d/lookdev/markings.js +319 -0
- package/dist/model3d/lookdev/project.d.ts +100 -0
- package/dist/model3d/lookdev/project.js +721 -0
- package/dist/model3d/lookdev/settings.d.ts +65 -0
- package/dist/model3d/lookdev/settings.js +103 -0
- package/dist/model3d/lookdev/texels.d.ts +32 -0
- package/dist/model3d/lookdev/texels.js +192 -0
- package/dist/model3d/profile.d.ts +101 -0
- package/dist/model3d/profile.js +132 -0
- package/dist/model3d/prop.d.ts +29 -0
- package/dist/model3d/prop.js +317 -0
- package/dist/model3d/qa.d.ts +27 -0
- package/dist/model3d/qa.js +105 -0
- package/dist/model3d/render.d.ts +172 -0
- package/dist/model3d/render.js +791 -0
- package/dist/model3d/rig/build.d.ts +14 -0
- package/dist/model3d/rig/build.js +210 -0
- package/dist/model3d/rig/candidate.d.ts +50 -0
- package/dist/model3d/rig/candidate.js +132 -0
- package/dist/model3d/rig/command.d.ts +50 -0
- package/dist/model3d/rig/command.js +229 -0
- package/dist/model3d/rig/fit.d.ts +88 -0
- package/dist/model3d/rig/fit.js +568 -0
- package/dist/model3d/rig/gait.d.ts +105 -0
- package/dist/model3d/rig/gait.js +334 -0
- package/dist/model3d/rig/math.d.ts +27 -0
- package/dist/model3d/rig/math.js +92 -0
- package/dist/model3d/rig/motion.d.ts +26 -0
- package/dist/model3d/rig/motion.js +223 -0
- package/dist/model3d/rig/qa.d.ts +76 -0
- package/dist/model3d/rig/qa.js +357 -0
- package/dist/model3d/rig/rig.d.ts +55 -0
- package/dist/model3d/rig/rig.js +213 -0
- package/dist/model3d/rig/template.d.ts +195 -0
- package/dist/model3d/rig/template.js +456 -0
- package/dist/model3d/scene.d.ts +115 -0
- package/dist/model3d/scene.js +684 -0
- package/dist/model3d/views.d.ts +77 -0
- package/dist/model3d/views.js +190 -0
- package/dist/origin.d.ts +162 -0
- package/dist/origin.js +134 -0
- package/dist/paths.d.ts +53 -0
- package/dist/paths.js +240 -0
- package/dist/planning.d.ts +261 -0
- package/dist/planning.js +1470 -0
- package/dist/policy/blocklist.d.ts +28 -0
- package/dist/policy/blocklist.js +58 -0
- package/dist/policy/brief.d.ts +67 -0
- package/dist/policy/brief.js +110 -0
- package/dist/policy/cuts.d.ts +26 -0
- package/dist/policy/cuts.js +80 -0
- package/dist/policy/model.d.ts +69 -0
- package/dist/policy/model.js +202 -0
- package/dist/policy/text.d.ts +183 -0
- package/dist/policy/text.js +285 -0
- package/dist/postprocess.d.ts +68 -0
- package/dist/postprocess.js +302 -0
- package/dist/profile.d.ts +5 -0
- package/dist/profile.js +98 -0
- package/dist/project-rules.d.ts +54 -0
- package/dist/project-rules.js +105 -0
- package/dist/provenance-binding.d.ts +55 -0
- package/dist/provenance-binding.js +352 -0
- package/dist/providers/adapter.d.ts +176 -0
- package/dist/providers/adapter.js +418 -0
- package/dist/providers/index.d.ts +33 -0
- package/dist/providers/index.js +49 -0
- package/dist/providers/script.d.ts +13 -0
- package/dist/providers/script.js +65 -0
- package/dist/providers/set.d.ts +76 -0
- package/dist/providers/set.js +134 -0
- package/dist/pure-cbor.d.ts +1 -0
- package/dist/pure-cbor.js +8 -0
- package/dist/qa/stability.d.ts +215 -0
- package/dist/qa/stability.js +393 -0
- package/dist/qa/stability.json +32 -0
- package/dist/qa.d.ts +36 -0
- package/dist/qa.js +148 -0
- package/dist/reconcile.d.ts +111 -0
- package/dist/reconcile.js +416 -0
- package/dist/redact.d.ts +29 -0
- package/dist/redact.js +74 -0
- package/dist/regions.d.ts +49 -0
- package/dist/regions.js +113 -0
- package/dist/release-policy.d.ts +99 -0
- package/dist/release-policy.js +266 -0
- package/dist/request.d.ts +74 -0
- package/dist/request.js +249 -0
- package/dist/routes.d.ts +327 -0
- package/dist/routes.js +1166 -0
- package/dist/runs/dir.d.ts +33 -0
- package/dist/runs/dir.js +30 -0
- package/dist/runs/execute.d.ts +86 -0
- package/dist/runs/execute.js +422 -0
- package/dist/runs/journal.d.ts +150 -0
- package/dist/runs/journal.js +216 -0
- package/dist/runs/lock.d.ts +57 -0
- package/dist/runs/lock.js +322 -0
- package/dist/runs/plan.d.ts +261 -0
- package/dist/runs/plan.js +404 -0
- package/dist/search/near-match.d.ts +32 -0
- package/dist/search/near-match.js +86 -0
- package/dist/search/reader.d.ts +17 -0
- package/dist/search/reader.js +334 -0
- package/dist/search/sheet.d.ts +4 -0
- package/dist/search/sheet.js +28 -0
- package/dist/search/style-outliers.d.ts +77 -0
- package/dist/search/style-outliers.js +166 -0
- package/dist/settings-write.d.ts +78 -0
- package/dist/settings-write.js +374 -0
- package/dist/settings.d.ts +436 -0
- package/dist/settings.js +622 -0
- package/dist/shared-settings.d.ts +4 -0
- package/dist/shared-settings.js +24 -0
- package/dist/sheet/blobs.d.ts +33 -0
- package/dist/sheet/blobs.js +145 -0
- package/dist/sheet/generate.d.ts +71 -0
- package/dist/sheet/generate.js +278 -0
- package/dist/sheet/group.d.ts +20 -0
- package/dist/sheet/group.js +191 -0
- package/dist/sheet/import.d.ts +315 -0
- package/dist/sheet/import.js +832 -0
- package/dist/sheet/matte.d.ts +25 -0
- package/dist/sheet/matte.js +508 -0
- package/dist/sheet/media-import.d.ts +41 -0
- package/dist/sheet/media-import.js +118 -0
- package/dist/sheet/register.d.ts +17 -0
- package/dist/sheet/register.js +176 -0
- package/dist/sheet/slice.d.ts +73 -0
- package/dist/sheet/slice.js +912 -0
- package/dist/sheet/types.d.ts +225 -0
- package/dist/sheet/types.js +1 -0
- package/dist/source/aseprite.d.ts +14 -0
- package/dist/source/aseprite.js +124 -0
- package/dist/source/stage.d.ts +24 -0
- package/dist/source/stage.js +172 -0
- package/dist/spend.d.ts +220 -0
- package/dist/spend.js +436 -0
- package/dist/sprite/render.d.ts +22 -0
- package/dist/sprite/render.js +272 -0
- package/dist/storage.d.ts +135 -0
- package/dist/storage.js +405 -0
- package/dist/style.d.ts +19 -0
- package/dist/style.js +26 -0
- package/dist/template.d.ts +29 -0
- package/dist/template.js +98 -0
- package/dist/testing/aseprite.d.ts +54 -0
- package/dist/testing/aseprite.js +191 -0
- package/dist/testing/cli.d.ts +24 -0
- package/dist/testing/cli.js +91 -0
- package/dist/testing/conformance.d.ts +61 -0
- package/dist/testing/conformance.js +455 -0
- package/dist/testing/index.d.ts +23 -0
- package/dist/testing/index.js +15 -0
- package/dist/testing/mcp.d.ts +25 -0
- package/dist/testing/mcp.js +80 -0
- package/dist/testing/project.d.ts +81 -0
- package/dist/testing/project.js +215 -0
- package/dist/testing/samples.d.ts +42 -0
- package/dist/testing/samples.js +122 -0
- package/dist/transform/operations.d.ts +5 -0
- package/dist/transform/operations.js +320 -0
- package/dist/transform/raster-engine.d.ts +9 -0
- package/dist/transform/raster-engine.js +329 -0
- package/dist/transform/rendition.d.ts +65 -0
- package/dist/transform/rendition.js +317 -0
- package/dist/transform/run.d.ts +138 -0
- package/dist/transform/run.js +442 -0
- package/dist/transform/schema.d.ts +33 -0
- package/dist/transform/schema.js +73 -0
- package/dist/transform/types.d.ts +101 -0
- package/dist/transform/types.js +1 -0
- package/dist/tree/address.d.ts +18 -0
- package/dist/tree/address.js +59 -0
- package/dist/tree/list.d.ts +18 -0
- package/dist/tree/list.js +101 -0
- package/dist/tree/project.d.ts +61 -0
- package/dist/tree/project.js +145 -0
- package/dist/tree/read.d.ts +43 -0
- package/dist/tree/read.js +715 -0
- package/dist/tree/search.d.ts +20 -0
- package/dist/tree/search.js +44 -0
- package/dist/tree/serve.d.ts +79 -0
- package/dist/tree/serve.js +415 -0
- package/dist/tree/thumbs.d.ts +26 -0
- package/dist/tree/thumbs.js +134 -0
- package/dist/turnaround.d.ts +195 -0
- package/dist/turnaround.js +622 -0
- package/dist/types.d.ts +595 -0
- package/dist/types.js +1 -0
- package/package.json +112 -3
- package/policy/blocklist.json +47 -0
- package/policy/prompt-policy-cuts.json +15 -0
- package/skills/art-direction/SKILL.md +16 -0
- package/skills/art-direction/default.md +14 -0
- package/skills/art-direction/presets/cozy-storybook.md +121 -0
- package/skills/art-direction/presets/dark-gritty-isometric.md +121 -0
- package/skills/art-direction/presets/flat-cartoon-kids.md +121 -0
- package/skills/art-direction/references/bible-format.md +47 -0
- package/skills/assetgrove/SKILL.md +109 -0
- package/skills/assetgrove/references/commands.md +723 -0
|
@@ -0,0 +1,684 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scene of a `.glb` character: node transforms, animation sampling, skinning, the measures the
|
|
3
|
+
* target profile budgets, and the edits Assetgrove makes (normalisation, clip names, loop closing).
|
|
4
|
+
*/
|
|
5
|
+
import { InputError } from "../errors.js";
|
|
6
|
+
import { readAccessor, writeAccessorElement } from "./glb.js";
|
|
7
|
+
// --- math (column-major 4×4, as glTF stores matrices) ---
|
|
8
|
+
export function identity() {
|
|
9
|
+
const m = new Float64Array(16);
|
|
10
|
+
m[0] = m[5] = m[10] = m[15] = 1;
|
|
11
|
+
return m;
|
|
12
|
+
}
|
|
13
|
+
export function multiply(a, b) {
|
|
14
|
+
const out = new Float64Array(16);
|
|
15
|
+
for (let c = 0; c < 4; c++) {
|
|
16
|
+
for (let r = 0; r < 4; r++) {
|
|
17
|
+
let sum = 0;
|
|
18
|
+
for (let k = 0; k < 4; k++)
|
|
19
|
+
sum += a[k * 4 + r] * b[c * 4 + k];
|
|
20
|
+
out[c * 4 + r] = sum;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
export function fromTrs(t, q, s) {
|
|
26
|
+
const [x, y, z, w] = [q[0], q[1], q[2], q[3]];
|
|
27
|
+
const [sx, sy, sz] = [s[0], s[1], s[2]];
|
|
28
|
+
const m = new Float64Array(16);
|
|
29
|
+
m[0] = (1 - 2 * (y * y + z * z)) * sx;
|
|
30
|
+
m[1] = 2 * (x * y + z * w) * sx;
|
|
31
|
+
m[2] = 2 * (x * z - y * w) * sx;
|
|
32
|
+
m[4] = 2 * (x * y - z * w) * sy;
|
|
33
|
+
m[5] = (1 - 2 * (x * x + z * z)) * sy;
|
|
34
|
+
m[6] = 2 * (y * z + x * w) * sy;
|
|
35
|
+
m[8] = 2 * (x * z + y * w) * sz;
|
|
36
|
+
m[9] = 2 * (y * z - x * w) * sz;
|
|
37
|
+
m[10] = (1 - 2 * (x * x + y * y)) * sz;
|
|
38
|
+
m[12] = t[0];
|
|
39
|
+
m[13] = t[1];
|
|
40
|
+
m[14] = t[2];
|
|
41
|
+
m[15] = 1;
|
|
42
|
+
return m;
|
|
43
|
+
}
|
|
44
|
+
export function transformPoint(m, x, y, z) {
|
|
45
|
+
return [
|
|
46
|
+
m[0] * x + m[4] * y + m[8] * z + m[12],
|
|
47
|
+
m[1] * x + m[5] * y + m[9] * z + m[13],
|
|
48
|
+
m[2] * x + m[6] * y + m[10] * z + m[14],
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
export function transformDirection(m, x, y, z) {
|
|
52
|
+
return [
|
|
53
|
+
m[0] * x + m[4] * y + m[8] * z,
|
|
54
|
+
m[1] * x + m[5] * y + m[9] * z,
|
|
55
|
+
m[2] * x + m[6] * y + m[10] * z,
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
function slerp(a, b, t) {
|
|
59
|
+
let dot = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
|
|
60
|
+
const sign = dot < 0 ? -1 : 1;
|
|
61
|
+
dot *= sign;
|
|
62
|
+
let wa = 1 - t;
|
|
63
|
+
let wb = t * sign;
|
|
64
|
+
if (dot < 0.9995) {
|
|
65
|
+
const theta = Math.acos(dot);
|
|
66
|
+
const sin = Math.sin(theta);
|
|
67
|
+
wa = Math.sin((1 - t) * theta) / sin;
|
|
68
|
+
wb = (Math.sin(t * theta) / sin) * sign;
|
|
69
|
+
}
|
|
70
|
+
const q = [0, 1, 2, 3].map((i) => wa * a[i] + wb * b[i]);
|
|
71
|
+
const length = Math.hypot(...q) || 1;
|
|
72
|
+
return q.map((v) => v / length);
|
|
73
|
+
}
|
|
74
|
+
/** The angle in degrees between two unit quaternions. */
|
|
75
|
+
export function quatAngleDeg(a, b) {
|
|
76
|
+
const dot = Math.abs(a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]);
|
|
77
|
+
return (2 * Math.acos(Math.min(1, dot)) * 180) / Math.PI;
|
|
78
|
+
}
|
|
79
|
+
function restTrs(node) {
|
|
80
|
+
return {
|
|
81
|
+
t: [...(node.translation ?? [0, 0, 0])],
|
|
82
|
+
r: [...(node.rotation ?? [0, 0, 0, 1])],
|
|
83
|
+
s: [...(node.scale ?? [1, 1, 1])],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function localMatrix(node, pose) {
|
|
87
|
+
if (pose)
|
|
88
|
+
return fromTrs(pose.t, pose.r, pose.s);
|
|
89
|
+
if (node.matrix)
|
|
90
|
+
return Float64Array.from(node.matrix);
|
|
91
|
+
const rest = restTrs(node);
|
|
92
|
+
return fromTrs(rest.t, rest.r, rest.s);
|
|
93
|
+
}
|
|
94
|
+
/** The scene's root nodes. */
|
|
95
|
+
export function sceneRoots(json) {
|
|
96
|
+
const scene = json.scenes?.[json.scene ?? 0];
|
|
97
|
+
if (scene?.nodes)
|
|
98
|
+
return scene.nodes;
|
|
99
|
+
const children = new Set((json.nodes ?? []).flatMap((n) => n.children ?? []));
|
|
100
|
+
return (json.nodes ?? []).map((_, i) => i).filter((i) => !children.has(i));
|
|
101
|
+
}
|
|
102
|
+
/** Every node's world matrix, in a pose (or the rest pose). Nodes outside the scene are absent. */
|
|
103
|
+
export function worldMatrices(json, pose) {
|
|
104
|
+
const out = new Map();
|
|
105
|
+
const visit = (index, parent, depth) => {
|
|
106
|
+
if (depth > 256 || out.has(index))
|
|
107
|
+
return;
|
|
108
|
+
const node = json.nodes?.[index];
|
|
109
|
+
if (!node)
|
|
110
|
+
return;
|
|
111
|
+
const world = multiply(parent, localMatrix(node, pose?.get(index)));
|
|
112
|
+
out.set(index, world);
|
|
113
|
+
for (const child of node.children ?? [])
|
|
114
|
+
visit(child, world, depth + 1);
|
|
115
|
+
};
|
|
116
|
+
for (const root of sceneRoots(json))
|
|
117
|
+
visit(root, identity(), 0);
|
|
118
|
+
return out;
|
|
119
|
+
}
|
|
120
|
+
export function clips(glb) {
|
|
121
|
+
return (glb.json.animations ?? []).map((animation, index) => {
|
|
122
|
+
let duration = 0;
|
|
123
|
+
for (const sampler of animation.samplers) {
|
|
124
|
+
const max = glb.json.accessors?.[sampler.input]?.max?.[0];
|
|
125
|
+
const times = max === undefined ? readAccessor(glb, sampler.input) : [max];
|
|
126
|
+
for (const t of times)
|
|
127
|
+
duration = Math.max(duration, t);
|
|
128
|
+
}
|
|
129
|
+
return { index, name: animation.name ?? `animation ${index}`, durationS: duration };
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const trackCache = new WeakMap();
|
|
133
|
+
function tracks(glb, animation) {
|
|
134
|
+
let perGlb = trackCache.get(glb);
|
|
135
|
+
if (!perGlb)
|
|
136
|
+
trackCache.set(glb, (perGlb = new Map()));
|
|
137
|
+
const cached = perGlb.get(animation);
|
|
138
|
+
if (cached)
|
|
139
|
+
return cached;
|
|
140
|
+
const a = glb.json.animations?.[animation];
|
|
141
|
+
if (!a)
|
|
142
|
+
throw new InputError(`animation ${animation} does not exist`);
|
|
143
|
+
const out = [];
|
|
144
|
+
for (const channel of a.channels) {
|
|
145
|
+
const { node, path } = channel.target;
|
|
146
|
+
if (node === undefined || !["translation", "rotation", "scale"].includes(path))
|
|
147
|
+
continue;
|
|
148
|
+
const sampler = a.samplers[channel.sampler];
|
|
149
|
+
if (!sampler)
|
|
150
|
+
continue;
|
|
151
|
+
out.push({
|
|
152
|
+
node,
|
|
153
|
+
path: path,
|
|
154
|
+
times: readAccessor(glb, sampler.input),
|
|
155
|
+
values: readAccessor(glb, sampler.output),
|
|
156
|
+
width: path === "rotation" ? 4 : 3,
|
|
157
|
+
interpolation: sampler.interpolation ?? "LINEAR",
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
perGlb.set(animation, out);
|
|
161
|
+
return out;
|
|
162
|
+
}
|
|
163
|
+
function keyValue(track, key) {
|
|
164
|
+
// Cubic-spline outputs hold in-tangent, value, out-tangent per key; take the value.
|
|
165
|
+
const stride = track.interpolation === "CUBICSPLINE" ? track.width * 3 : track.width;
|
|
166
|
+
const offset = track.interpolation === "CUBICSPLINE" ? track.width : 0;
|
|
167
|
+
const start = key * stride + offset;
|
|
168
|
+
return Array.from(track.values.subarray(start, start + track.width));
|
|
169
|
+
}
|
|
170
|
+
function sampleTrack(track, time) {
|
|
171
|
+
const { times } = track;
|
|
172
|
+
const last = times.length - 1;
|
|
173
|
+
if (last < 0)
|
|
174
|
+
return [];
|
|
175
|
+
if (time <= times[0])
|
|
176
|
+
return keyValue(track, 0);
|
|
177
|
+
if (time >= times[last])
|
|
178
|
+
return keyValue(track, last);
|
|
179
|
+
let k = 0;
|
|
180
|
+
while (k < last - 1 && times[k + 1] <= time)
|
|
181
|
+
k++;
|
|
182
|
+
const a = keyValue(track, k);
|
|
183
|
+
if (track.interpolation === "STEP")
|
|
184
|
+
return a;
|
|
185
|
+
const b = keyValue(track, k + 1);
|
|
186
|
+
const t = (time - times[k]) / (times[k + 1] - times[k] || 1);
|
|
187
|
+
if (track.path === "rotation")
|
|
188
|
+
return slerp(a, b, t);
|
|
189
|
+
return a.map((v, i) => v + (b[i] - v) * t);
|
|
190
|
+
}
|
|
191
|
+
/** The pose of an animation at a time in seconds (clamped to its keys). */
|
|
192
|
+
export function samplePose(glb, animation, time) {
|
|
193
|
+
const pose = new Map();
|
|
194
|
+
for (const track of tracks(glb, animation)) {
|
|
195
|
+
const node = glb.json.nodes?.[track.node];
|
|
196
|
+
if (!node)
|
|
197
|
+
continue;
|
|
198
|
+
let trs = pose.get(track.node);
|
|
199
|
+
if (!trs)
|
|
200
|
+
pose.set(track.node, (trs = restTrs(node)));
|
|
201
|
+
const value = sampleTrack(track, time);
|
|
202
|
+
if (value.length === 0)
|
|
203
|
+
continue;
|
|
204
|
+
if (track.path === "translation")
|
|
205
|
+
trs.t = value;
|
|
206
|
+
else if (track.path === "rotation")
|
|
207
|
+
trs.r = value;
|
|
208
|
+
else
|
|
209
|
+
trs.s = value;
|
|
210
|
+
}
|
|
211
|
+
return pose;
|
|
212
|
+
}
|
|
213
|
+
function triangleIndices(glb, primitive, count) {
|
|
214
|
+
const mode = primitive.mode ?? 4;
|
|
215
|
+
const raw = primitive.indices === undefined
|
|
216
|
+
? Uint32Array.from({ length: count }, (_, i) => i)
|
|
217
|
+
: Uint32Array.from(readAccessor(glb, primitive.indices));
|
|
218
|
+
if (mode === 4)
|
|
219
|
+
return raw.subarray(0, raw.length - (raw.length % 3));
|
|
220
|
+
const out = [];
|
|
221
|
+
if (mode === 5) {
|
|
222
|
+
for (let i = 0; i + 2 < raw.length; i++) {
|
|
223
|
+
if (i % 2 === 0)
|
|
224
|
+
out.push(raw[i], raw[i + 1], raw[i + 2]);
|
|
225
|
+
else
|
|
226
|
+
out.push(raw[i + 1], raw[i], raw[i + 2]);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else if (mode === 6) {
|
|
230
|
+
for (let i = 1; i + 1 < raw.length; i++)
|
|
231
|
+
out.push(raw[0], raw[i], raw[i + 1]);
|
|
232
|
+
}
|
|
233
|
+
return Uint32Array.from(out);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Every triangle primitive in world space for a pose (the rest pose when none is given): skinned
|
|
237
|
+
* meshes through their joints, the rest through their node's world matrix.
|
|
238
|
+
*/
|
|
239
|
+
export function posedPrimitives(glb, pose) {
|
|
240
|
+
const { json } = glb;
|
|
241
|
+
const world = worldMatrices(json, pose);
|
|
242
|
+
const out = [];
|
|
243
|
+
for (const [nodeIndex, nodeWorld] of world) {
|
|
244
|
+
const node = json.nodes?.[nodeIndex];
|
|
245
|
+
if (node?.mesh === undefined)
|
|
246
|
+
continue;
|
|
247
|
+
const mesh = json.meshes?.[node.mesh];
|
|
248
|
+
if (!mesh)
|
|
249
|
+
continue;
|
|
250
|
+
const skin = node.skin === undefined ? undefined : json.skins?.[node.skin];
|
|
251
|
+
let jointMatrices;
|
|
252
|
+
if (skin) {
|
|
253
|
+
const ibm = skin.inverseBindMatrices === undefined
|
|
254
|
+
? undefined
|
|
255
|
+
: readAccessor(glb, skin.inverseBindMatrices);
|
|
256
|
+
jointMatrices = skin.joints.map((joint, j) => multiply(world.get(joint) ?? identity(), ibm ? Float64Array.from(ibm.subarray(j * 16, j * 16 + 16)) : identity()));
|
|
257
|
+
}
|
|
258
|
+
for (const primitive of mesh.primitives) {
|
|
259
|
+
const mode = primitive.mode ?? 4;
|
|
260
|
+
if (![4, 5, 6].includes(mode) || primitive.attributes["POSITION"] === undefined)
|
|
261
|
+
continue;
|
|
262
|
+
const source = readAccessor(glb, primitive.attributes["POSITION"]);
|
|
263
|
+
const count = source.length / 3;
|
|
264
|
+
const normalsSource = primitive.attributes["NORMAL"] === undefined
|
|
265
|
+
? undefined
|
|
266
|
+
: readAccessor(glb, primitive.attributes["NORMAL"]);
|
|
267
|
+
const positions = new Float64Array(source.length);
|
|
268
|
+
const normals = normalsSource ? new Float64Array(normalsSource.length) : undefined;
|
|
269
|
+
const joints = jointMatrices && primitive.attributes["JOINTS_0"] !== undefined
|
|
270
|
+
? readAccessor(glb, primitive.attributes["JOINTS_0"])
|
|
271
|
+
: undefined;
|
|
272
|
+
const weights = joints && primitive.attributes["WEIGHTS_0"] !== undefined
|
|
273
|
+
? readAccessor(glb, primitive.attributes["WEIGHTS_0"])
|
|
274
|
+
: undefined;
|
|
275
|
+
for (let v = 0; v < count; v++) {
|
|
276
|
+
let m = nodeWorld;
|
|
277
|
+
if (jointMatrices && joints && weights) {
|
|
278
|
+
m = new Float64Array(16);
|
|
279
|
+
let total = 0;
|
|
280
|
+
for (let k = 0; k < 4; k++) {
|
|
281
|
+
const w = weights[v * 4 + k];
|
|
282
|
+
const jm = jointMatrices[joints[v * 4 + k]];
|
|
283
|
+
if (!w || !jm)
|
|
284
|
+
continue;
|
|
285
|
+
total += w;
|
|
286
|
+
for (let e = 0; e < 16; e++)
|
|
287
|
+
m[e] += jm[e] * w;
|
|
288
|
+
}
|
|
289
|
+
if (total === 0)
|
|
290
|
+
m = nodeWorld;
|
|
291
|
+
else if (Math.abs(total - 1) > 1e-6)
|
|
292
|
+
for (let e = 0; e < 16; e++)
|
|
293
|
+
m[e] /= total;
|
|
294
|
+
}
|
|
295
|
+
const p = transformPoint(m, source[v * 3], source[v * 3 + 1], source[v * 3 + 2]);
|
|
296
|
+
positions.set(p, v * 3);
|
|
297
|
+
if (normals && normalsSource) {
|
|
298
|
+
const n = transformDirection(m, normalsSource[v * 3], normalsSource[v * 3 + 1], normalsSource[v * 3 + 2]);
|
|
299
|
+
const length = Math.hypot(...n) || 1;
|
|
300
|
+
normals.set([n[0] / length, n[1] / length, n[2] / length], v * 3);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const uvs = primitive.attributes["TEXCOORD_0"] === undefined
|
|
304
|
+
? undefined
|
|
305
|
+
: readAccessor(glb, primitive.attributes["TEXCOORD_0"]);
|
|
306
|
+
out.push({
|
|
307
|
+
positions,
|
|
308
|
+
...(normals && { normals }),
|
|
309
|
+
...(uvs && { uvs }),
|
|
310
|
+
indices: triangleIndices(glb, primitive, count),
|
|
311
|
+
...(primitive.material !== undefined && { material: primitive.material }),
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return out;
|
|
316
|
+
}
|
|
317
|
+
export function boundsOf(primitives) {
|
|
318
|
+
const min = [Infinity, Infinity, Infinity];
|
|
319
|
+
const max = [-Infinity, -Infinity, -Infinity];
|
|
320
|
+
for (const p of primitives) {
|
|
321
|
+
for (let i = 0; i < p.positions.length; i += 3) {
|
|
322
|
+
for (let c = 0; c < 3; c++) {
|
|
323
|
+
min[c] = Math.min(min[c], p.positions[i + c]);
|
|
324
|
+
max[c] = Math.max(max[c], p.positions[i + c]);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return Number.isFinite(min[0]) ? { min, max } : undefined;
|
|
329
|
+
}
|
|
330
|
+
// --- measures ---
|
|
331
|
+
/** Width and height from a PNG or JPEG header, without decoding. */
|
|
332
|
+
export function imageSize(bytes) {
|
|
333
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
334
|
+
if (bytes.length >= 24 && bytes[1] === 0x50 && bytes[2] === 0x4e && bytes[3] === 0x47) {
|
|
335
|
+
return { width: view.getUint32(16), height: view.getUint32(20) };
|
|
336
|
+
}
|
|
337
|
+
if (bytes[0] === 0xff && bytes[1] === 0xd8) {
|
|
338
|
+
let at = 2;
|
|
339
|
+
while (at + 9 < bytes.length) {
|
|
340
|
+
if (bytes[at] !== 0xff)
|
|
341
|
+
return undefined;
|
|
342
|
+
const marker = bytes[at + 1];
|
|
343
|
+
const length = view.getUint16(at + 2);
|
|
344
|
+
if (marker >= 0xc0 && marker <= 0xcf && ![0xc4, 0xc8, 0xcc].includes(marker)) {
|
|
345
|
+
return { height: view.getUint16(at + 5), width: view.getUint16(at + 7) };
|
|
346
|
+
}
|
|
347
|
+
at += 2 + length;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (bytes.length >= 30 && Buffer.from(bytes.subarray(8, 12)).toString("latin1") === "WEBP") {
|
|
351
|
+
const chunk = Buffer.from(bytes.subarray(12, 16)).toString("latin1");
|
|
352
|
+
if (chunk === "VP8X") {
|
|
353
|
+
return {
|
|
354
|
+
width: 1 + (bytes[24] | (bytes[25] << 8) | (bytes[26] << 16)),
|
|
355
|
+
height: 1 + (bytes[27] | (bytes[28] << 8) | (bytes[29] << 16)),
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
if (chunk === "VP8 ") {
|
|
359
|
+
return {
|
|
360
|
+
width: view.getUint16(26, true) & 0x3fff,
|
|
361
|
+
height: view.getUint16(28, true) & 0x3fff,
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
if (chunk === "VP8L") {
|
|
365
|
+
const b = view.getUint32(21, true);
|
|
366
|
+
return { width: (b & 0x3fff) + 1, height: ((b >> 14) & 0x3fff) + 1 };
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
371
|
+
/** Counts what the target profile budgets. */
|
|
372
|
+
export function measure(glb) {
|
|
373
|
+
const { json } = glb;
|
|
374
|
+
let triangles = 0;
|
|
375
|
+
for (const index of worldMatrices(json).keys()) {
|
|
376
|
+
const node = json.nodes?.[index];
|
|
377
|
+
const mesh = node?.mesh === undefined ? undefined : json.meshes?.[node.mesh];
|
|
378
|
+
for (const primitive of mesh?.primitives ?? []) {
|
|
379
|
+
const mode = primitive.mode ?? 4;
|
|
380
|
+
const count = primitive.indices !== undefined
|
|
381
|
+
? (json.accessors?.[primitive.indices]?.count ?? 0)
|
|
382
|
+
: (json.accessors?.[primitive.attributes["POSITION"] ?? -1]?.count ?? 0);
|
|
383
|
+
if (mode === 4)
|
|
384
|
+
triangles += Math.floor(count / 3);
|
|
385
|
+
else if (mode === 5 || mode === 6)
|
|
386
|
+
triangles += Math.max(0, count - 2);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
let textureMaxPx = 0;
|
|
390
|
+
const unmeasuredImages = [];
|
|
391
|
+
for (const [index, image] of (json.images ?? []).entries()) {
|
|
392
|
+
const start = image.bufferView === undefined ? undefined : json.bufferViews?.[image.bufferView];
|
|
393
|
+
if (!start) {
|
|
394
|
+
unmeasuredImages.push(index);
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
const bytes = glb.bin.subarray(start.byteOffset ?? 0, (start.byteOffset ?? 0) + start.byteLength);
|
|
398
|
+
const size = imageSize(bytes);
|
|
399
|
+
if (size)
|
|
400
|
+
textureMaxPx = Math.max(textureMaxPx, size.width, size.height);
|
|
401
|
+
else
|
|
402
|
+
unmeasuredImages.push(index);
|
|
403
|
+
}
|
|
404
|
+
let lods = 1;
|
|
405
|
+
for (const node of json.nodes ?? []) {
|
|
406
|
+
const ids = node.extensions?.["MSFT_lod"]?.ids;
|
|
407
|
+
if (ids)
|
|
408
|
+
lods = Math.max(lods, 1 + ids.length);
|
|
409
|
+
}
|
|
410
|
+
const bounds = boundsOf(posedPrimitives(glb));
|
|
411
|
+
return {
|
|
412
|
+
triangles,
|
|
413
|
+
textureMaxPx,
|
|
414
|
+
unmeasuredImages,
|
|
415
|
+
materials: json.materials?.length ?? 0,
|
|
416
|
+
bones: new Set((json.skins ?? []).flatMap((s) => s.joints)).size,
|
|
417
|
+
lods,
|
|
418
|
+
meshes: json.meshes?.length ?? 0,
|
|
419
|
+
skins: json.skins?.length ?? 0,
|
|
420
|
+
...(bounds && { bounds }),
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
export const AXES = ["+x", "-x", "+z", "-z"];
|
|
424
|
+
/** The rotation about +Y, in radians, that turns a model facing `from` to face `to`. */
|
|
425
|
+
export function yawBetween(from, to) {
|
|
426
|
+
const angle = {
|
|
427
|
+
"+z": 0,
|
|
428
|
+
"+x": Math.PI / 2,
|
|
429
|
+
"-z": Math.PI,
|
|
430
|
+
"-x": -Math.PI / 2,
|
|
431
|
+
};
|
|
432
|
+
return angle[to] - angle[from];
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Wraps the scene in one root node that faces the model along `forward`, scales it to `heightM`
|
|
436
|
+
* (when given), stands it on y = 0 and centres it on x and z. Returns the new bounds.
|
|
437
|
+
*/
|
|
438
|
+
export function normalize(glb, options) {
|
|
439
|
+
const { json } = glb;
|
|
440
|
+
const before = boundsOf(posedPrimitives(glb));
|
|
441
|
+
if (!before)
|
|
442
|
+
throw new InputError("the model has no triangle geometry");
|
|
443
|
+
const yaw = yawBetween(options.sourceForward, options.forward);
|
|
444
|
+
const height = before.max[1] - before.min[1];
|
|
445
|
+
let scale = options.heightM !== undefined && height > 0 ? options.heightM / height : 1;
|
|
446
|
+
if (options.heightM === undefined && options.box) {
|
|
447
|
+
// A quarter turn about y swaps the x and z extents.
|
|
448
|
+
const quarter = Math.abs(Math.round(yaw / (Math.PI / 2))) % 2 === 1;
|
|
449
|
+
const extentX = before.max[quarter ? 2 : 0] - before.min[quarter ? 2 : 0];
|
|
450
|
+
const extentZ = before.max[quarter ? 0 : 2] - before.min[quarter ? 0 : 2];
|
|
451
|
+
const alongX = options.forward.endsWith("x");
|
|
452
|
+
const fits = [
|
|
453
|
+
[alongX ? extentZ : extentX, options.box.widthM],
|
|
454
|
+
[height, options.box.heightM],
|
|
455
|
+
[alongX ? extentX : extentZ, options.box.depthM],
|
|
456
|
+
]
|
|
457
|
+
.filter(([extent]) => extent > 0)
|
|
458
|
+
.map(([extent, bound]) => bound / extent);
|
|
459
|
+
if (fits.length > 0)
|
|
460
|
+
scale = Math.min(...fits);
|
|
461
|
+
}
|
|
462
|
+
const rotation = [0, Math.sin(yaw / 2), 0, Math.cos(yaw / 2)];
|
|
463
|
+
const turned = fromTrs([0, 0, 0], rotation, [scale, scale, scale]);
|
|
464
|
+
// Bounds after rotation and scale, to find the translation that grounds and centres the model.
|
|
465
|
+
const corners = [];
|
|
466
|
+
for (const x of [before.min[0], before.max[0]])
|
|
467
|
+
for (const y of [before.min[1], before.max[1]])
|
|
468
|
+
for (const z of [before.min[2], before.max[2]])
|
|
469
|
+
corners.push(transformPoint(turned, x, y, z));
|
|
470
|
+
const min = [0, 1, 2].map((c) => Math.min(...corners.map((p) => p[c])));
|
|
471
|
+
const max = [0, 1, 2].map((c) => Math.max(...corners.map((p) => p[c])));
|
|
472
|
+
const translation = [-(min[0] + max[0]) / 2, -min[1], -(min[2] + max[2]) / 2];
|
|
473
|
+
const nodes = (json.nodes ??= []);
|
|
474
|
+
const roots = sceneRoots(json);
|
|
475
|
+
const root = nodes.length;
|
|
476
|
+
nodes.push({
|
|
477
|
+
name: "assetgrove-root",
|
|
478
|
+
children: roots,
|
|
479
|
+
translation: translation.map((v) => (Math.abs(v) < 1e-12 ? 0 : v)),
|
|
480
|
+
...(Math.abs(yaw) > 1e-9 && { rotation }),
|
|
481
|
+
...(scale !== 1 && { scale: [scale, scale, scale] }),
|
|
482
|
+
});
|
|
483
|
+
json.scenes = json.scenes?.length ? json.scenes : [{}];
|
|
484
|
+
const sceneIndex = json.scene ?? 0;
|
|
485
|
+
json.scene = sceneIndex;
|
|
486
|
+
json.scenes[sceneIndex] = { ...json.scenes[sceneIndex], nodes: [root] };
|
|
487
|
+
trackCache.delete(glb);
|
|
488
|
+
const after = boundsOf(posedPrimitives(glb));
|
|
489
|
+
if (!after)
|
|
490
|
+
throw new InputError("the model has no triangle geometry");
|
|
491
|
+
return after;
|
|
492
|
+
}
|
|
493
|
+
/** Renames animations: each entry maps an animation index to its family name. */
|
|
494
|
+
export function renameClips(glb, names) {
|
|
495
|
+
for (const [index, name] of names) {
|
|
496
|
+
const animation = glb.json.animations?.[index];
|
|
497
|
+
if (animation)
|
|
498
|
+
animation.name = name;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
/** Keeps only the listed animations, in order, renumbered from 0. */
|
|
502
|
+
export function keepClips(glb, keep) {
|
|
503
|
+
const animations = glb.json.animations ?? [];
|
|
504
|
+
glb.json.animations = keep.flatMap((i) => (animations[i] ? [animations[i]] : []));
|
|
505
|
+
if (glb.json.animations.length === 0)
|
|
506
|
+
delete glb.json.animations;
|
|
507
|
+
trackCache.delete(glb);
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* The animations whose keyframes change. A still take, such as a bind or T-pose take, holds every
|
|
511
|
+
* channel at one value from its first keyframe to its last; it is left out. No name is read.
|
|
512
|
+
*/
|
|
513
|
+
export function movingAnimations(glb, tolerance = 1e-5) {
|
|
514
|
+
const moving = [];
|
|
515
|
+
(glb.json.animations ?? []).forEach((animation, index) => {
|
|
516
|
+
const moves = animation.samplers.some((sampler) => {
|
|
517
|
+
const keys = glb.json.accessors?.[sampler.input]?.count ?? 0;
|
|
518
|
+
if (keys < 2)
|
|
519
|
+
return false;
|
|
520
|
+
const values = readAccessor(glb, sampler.output);
|
|
521
|
+
// A cubic spline stores in-tangent, value, out-tangent per keyframe; only values count.
|
|
522
|
+
const stride = sampler.interpolation === "CUBICSPLINE" ? 3 : 1;
|
|
523
|
+
const width = values.length / (keys * stride);
|
|
524
|
+
const at = stride === 3 ? width : 0;
|
|
525
|
+
for (let k = 1; k < keys; k++) {
|
|
526
|
+
for (let c = 0; c < width; c++) {
|
|
527
|
+
const first = values[at + c];
|
|
528
|
+
if (Math.abs(values[k * stride * width + at + c] - first) > tolerance)
|
|
529
|
+
return true;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return false;
|
|
533
|
+
});
|
|
534
|
+
if (moves)
|
|
535
|
+
moving.push(index);
|
|
536
|
+
});
|
|
537
|
+
return moving;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Copies one animation of `from` onto `base`: its keyframes become new float accessors at the end
|
|
541
|
+
* of `base`'s binary chunk, and each channel's target node is the node of `base` with the same
|
|
542
|
+
* name (or, when the name is missing or ambiguous and both have as many nodes, the same index).
|
|
543
|
+
* Throws an InputError, leaving `base` unchanged, when a target node has no counterpart.
|
|
544
|
+
*/
|
|
545
|
+
export function appendAnimation(base, from, animation) {
|
|
546
|
+
const source = from.json.animations?.[animation];
|
|
547
|
+
if (!source)
|
|
548
|
+
throw new InputError(`animation ${animation} does not exist`);
|
|
549
|
+
const fromNodes = from.json.nodes ?? [];
|
|
550
|
+
const baseNodes = base.json.nodes ?? [];
|
|
551
|
+
const countOf = (nodes, name) => nodes.filter((n) => n.name === name).length;
|
|
552
|
+
const nodeMap = new Map();
|
|
553
|
+
for (const channel of source.channels) {
|
|
554
|
+
const node = channel.target.node;
|
|
555
|
+
if (node === undefined || nodeMap.has(node))
|
|
556
|
+
continue;
|
|
557
|
+
const name = fromNodes[node]?.name;
|
|
558
|
+
let target;
|
|
559
|
+
if (name !== undefined && countOf(fromNodes, name) === 1) {
|
|
560
|
+
if (countOf(baseNodes, name) === 1)
|
|
561
|
+
target = baseNodes.findIndex((n) => n.name === name);
|
|
562
|
+
}
|
|
563
|
+
else if (fromNodes.length === baseNodes.length && baseNodes[node])
|
|
564
|
+
target = node;
|
|
565
|
+
if (target === undefined) {
|
|
566
|
+
throw new InputError(`the animation animates node "${name ?? node}" the first clip's model does not have`);
|
|
567
|
+
}
|
|
568
|
+
nodeMap.set(node, target);
|
|
569
|
+
}
|
|
570
|
+
const chunks = [];
|
|
571
|
+
let length = base.bin.byteLength + ((4 - (base.bin.byteLength % 4)) % 4);
|
|
572
|
+
const json = base.json;
|
|
573
|
+
const accessors = (json.accessors ??= []);
|
|
574
|
+
const bufferViews = (json.bufferViews ??= []);
|
|
575
|
+
const copied = new Map();
|
|
576
|
+
const copy = (index, bounds) => {
|
|
577
|
+
const done = copied.get(index);
|
|
578
|
+
if (done !== undefined)
|
|
579
|
+
return done;
|
|
580
|
+
const accessor = from.json.accessors?.[index];
|
|
581
|
+
if (!accessor)
|
|
582
|
+
throw new InputError(`accessor ${index} does not exist`);
|
|
583
|
+
const values = readAccessor(from, index);
|
|
584
|
+
const bytes = new Uint8Array(values.length * 4);
|
|
585
|
+
const view = new DataView(bytes.buffer);
|
|
586
|
+
values.forEach((v, i) => view.setFloat32(i * 4, v, true));
|
|
587
|
+
chunks.push(bytes);
|
|
588
|
+
bufferViews.push({ buffer: 0, byteOffset: length, byteLength: bytes.byteLength });
|
|
589
|
+
length += bytes.byteLength;
|
|
590
|
+
const out = {
|
|
591
|
+
bufferView: bufferViews.length - 1,
|
|
592
|
+
componentType: 5126,
|
|
593
|
+
count: accessor.count,
|
|
594
|
+
type: accessor.type,
|
|
595
|
+
...(bounds && accessor.min && { min: accessor.min }),
|
|
596
|
+
...(bounds && accessor.max && { max: accessor.max }),
|
|
597
|
+
};
|
|
598
|
+
accessors.push(out);
|
|
599
|
+
copied.set(index, accessors.length - 1);
|
|
600
|
+
return accessors.length - 1;
|
|
601
|
+
};
|
|
602
|
+
const samplers = source.samplers.map((sampler) => ({
|
|
603
|
+
input: copy(sampler.input, true),
|
|
604
|
+
output: copy(sampler.output, false),
|
|
605
|
+
...(sampler.interpolation !== undefined && { interpolation: sampler.interpolation }),
|
|
606
|
+
}));
|
|
607
|
+
const bin = new Uint8Array(length);
|
|
608
|
+
bin.set(base.bin);
|
|
609
|
+
let offset = base.bin.byteLength + ((4 - (base.bin.byteLength % 4)) % 4);
|
|
610
|
+
for (const chunk of chunks) {
|
|
611
|
+
bin.set(chunk, offset);
|
|
612
|
+
offset += chunk.byteLength;
|
|
613
|
+
}
|
|
614
|
+
base.bin = bin;
|
|
615
|
+
const buffer = (json.buffers ??= [{ byteLength: 0 }])[0];
|
|
616
|
+
if (buffer)
|
|
617
|
+
buffer.byteLength = length;
|
|
618
|
+
(json.animations ??= []).push({
|
|
619
|
+
...(source.name !== undefined && { name: source.name }),
|
|
620
|
+
channels: source.channels.map((channel) => ({
|
|
621
|
+
sampler: channel.sampler,
|
|
622
|
+
target: {
|
|
623
|
+
...channel.target,
|
|
624
|
+
...(channel.target.node !== undefined && { node: nodeMap.get(channel.target.node) }),
|
|
625
|
+
},
|
|
626
|
+
})),
|
|
627
|
+
samplers,
|
|
628
|
+
});
|
|
629
|
+
trackCache.delete(base);
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Closes a looping clip: the last key of every channel takes the first key's value, so the clip
|
|
633
|
+
* ends in the pose it starts in. Returns how many channels changed.
|
|
634
|
+
*/
|
|
635
|
+
export function closeLoop(glb, animation) {
|
|
636
|
+
const a = glb.json.animations?.[animation];
|
|
637
|
+
if (!a)
|
|
638
|
+
throw new InputError(`animation ${animation} does not exist`);
|
|
639
|
+
let changed = 0;
|
|
640
|
+
const done = new Set();
|
|
641
|
+
for (const channel of a.channels) {
|
|
642
|
+
const sampler = a.samplers[channel.sampler];
|
|
643
|
+
if (!sampler || done.has(sampler.output))
|
|
644
|
+
continue;
|
|
645
|
+
done.add(sampler.output);
|
|
646
|
+
const accessor = glb.json.accessors?.[sampler.output];
|
|
647
|
+
if (!accessor || accessor.count < 2 || accessor.componentType !== 5126)
|
|
648
|
+
continue;
|
|
649
|
+
const width = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4 }[accessor.type] ?? 0;
|
|
650
|
+
if (width === 0)
|
|
651
|
+
continue;
|
|
652
|
+
const values = readAccessor(glb, sampler.output);
|
|
653
|
+
const perKey = sampler.interpolation === "CUBICSPLINE" ? 3 : 1;
|
|
654
|
+
const keys = accessor.count / perKey;
|
|
655
|
+
const first = keys > 0 ? (perKey === 3 ? 1 : 0) : 0;
|
|
656
|
+
const last = (keys - 1) * perKey + first;
|
|
657
|
+
const a0 = values.subarray(first * width, first * width + width);
|
|
658
|
+
const aN = values.subarray(last * width, last * width + width);
|
|
659
|
+
if (a0.every((v, i) => v === aN[i]))
|
|
660
|
+
continue;
|
|
661
|
+
writeAccessorElement(glb, sampler.output, last, a0);
|
|
662
|
+
changed++;
|
|
663
|
+
}
|
|
664
|
+
trackCache.delete(glb);
|
|
665
|
+
return changed;
|
|
666
|
+
}
|
|
667
|
+
/** How far a clip's last pose is from its first: the largest rotation and translation difference. */
|
|
668
|
+
export function loopError(glb, animation) {
|
|
669
|
+
const clip = clips(glb)[animation];
|
|
670
|
+
if (!clip)
|
|
671
|
+
throw new InputError(`animation ${animation} does not exist`);
|
|
672
|
+
const start = samplePose(glb, animation, 0);
|
|
673
|
+
const end = samplePose(glb, animation, clip.durationS);
|
|
674
|
+
let rotationDeg = 0;
|
|
675
|
+
let translation = 0;
|
|
676
|
+
for (const [node, a] of start) {
|
|
677
|
+
const b = end.get(node);
|
|
678
|
+
if (!b)
|
|
679
|
+
continue;
|
|
680
|
+
rotationDeg = Math.max(rotationDeg, quatAngleDeg(a.r, b.r));
|
|
681
|
+
translation = Math.max(translation, Math.hypot(...a.t.map((v, i) => v - b.t[i])));
|
|
682
|
+
}
|
|
683
|
+
return { rotationDeg, translation };
|
|
684
|
+
}
|