diff --git a/cli.js b/cli.js index 4ea0d56..6d471ed 100755 --- a/cli.js +++ b/cli.js @@ -63,7 +63,7 @@ const cli = meow( keepmeshes: { type: 'boolean', shortFlag: 'j', default: false }, keepmaterials: { type: 'boolean', shortFlag: 'M', default: false }, format: { type: 'string', shortFlag: 'f', default: 'webp' }, - exportdefault: { type: 'boolean', alias: 'E' }, + exportdefault: { type: 'boolean', shortFlag: 'E' }, weld: { type: 'number', default: 0.0001 }, ratio: { type: 'number', default: 0.75 }, error: { type: 'number', default: 0.001 }, diff --git a/src/utils/parser.js b/src/utils/parser.js index 4c47f5e..d68627d 100644 --- a/src/utils/parser.js +++ b/src/utils/parser.js @@ -101,7 +101,9 @@ function parse(gltf, { fileName = 'model', ...options } = {}) { if (animations.length) { animationTypes = `\n type ActionName = ${animations.map((clip, i) => `"${clip.name}"`).join(' | ')}; - type GLTFActions = Record;\n` + interface GLTFAction extends THREE.AnimationClip {\n + name: ActionName;\n + }` } const types = [...new Set([...meshes, ...bones].map((o) => getType(o)))] @@ -117,6 +119,7 @@ function parse(gltf, { fileName = 'model', ...options } = {}) { materials: { ${materials.map(({ name, type }) => (isVarName(name) ? name : `['${name}']`) + ': THREE.' + type).join(',')} } + animations: GLTFAction[] }\n${animationTypes}\n${contextType}` } @@ -376,9 +379,7 @@ function parse(gltf, { fileName = 'model', ...options } = {}) { } function printAnimations(animations) { - return animations.length - ? `\nconst { actions } = useAnimations${options.types ? '' : ''}(animations, group)` - : '' + return animations.length ? `\nconst { actions } = useAnimations(animations, group)` : '' } function parseExtras(extras) {