Skip to content

Commit

Permalink
fix: output
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Jan 5, 2025
1 parent 78e33b1 commit aadc788
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-three-gltf",
"version": "1.1.1",
"version": "1.1.2",
"description": "GLTF to Angular Three converter",
"scripts": {
"cleanup": "rimraf node_modules"
Expand Down
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export default function (file, output, options) {
const { name } = path.parse(file);
const outputDir = path.parse(path.resolve(output ?? file)).dir;
const transformOut = path.join(outputDir, name + "-transformed.glb");

console.log({ file, name, outputDir, transformOut });

await transform(file, transformOut, options);
const { size: sizeOriginal, sizeKB: sizeKBOriginal } =
getFileSize(file);
Expand All @@ -84,7 +87,7 @@ export default function (file, output, options) {
arrayBuffer,
"",
async (gltf) => {
let output = parse(filePath, gltf, options);
let output = parse(filePath, gltf, { ...options, size });

try {
output = await prettier.format(output, {
Expand Down
6 changes: 3 additions & 3 deletions src/utils/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ function parse(fileName, gltf, options = {}) {
const imports = `
import type * as THREE from 'three';
import { Group${ngtTypesArr.length ? ", " + ngtTypesArr.join(", ") : ""} } from 'three';
import { extend, NgtGroup, NgtObjectEvents, NgtObjectEventsInputs, NgtObjectEventsOutputs${hasArgs ? ", NgtArgs" : ""} } from 'angular-three';
import { extend, NgtGroup, NgtObjectEvents, ${hasArgs ? ", NgtArgs" : ""} } from 'angular-three';
import { Component, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, Signal, input, viewChild, ElementRef, inject, effect${hasAnimations ? ", computed, model" : ""} } from '@angular/core';
import { injectGLTF } from 'angular-three-soba/loaders';
import { GLTF } from 'three-stdlib';
Expand Down Expand Up @@ -652,7 +652,7 @@ function parse(fileName, gltf, options = {}) {
options.header
? options.header
: "Auto-generated by: https://github.com/angular-threejs/gltf"
}
} ${options.size ? `Size: ${options.size}` : ""}
${parseExtras(gltf.parser.json.asset && gltf.parser.json.asset.extras)}**/
${imports}
Expand Down Expand Up @@ -739,7 +739,7 @@ export class ${componentName} {
const model = this.modelRef()?.nativeElement;
if (!model) return;
this.objectEvents.ngtObjectEvents.set(model);
objectEvents.ngtObjectEvents.set(model);
});
}
}`;
Expand Down

0 comments on commit aadc788

Please sign in to comment.