Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
fix model transform in model component editor (#10235)
Browse files Browse the repository at this point in the history
* fix model transform in model component editor

* fix error on defunct server transform
  • Loading branch information
dinomut1 authored May 31, 2024
1 parent b6b8977 commit 3b6c801
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default function ModelTransformProperties({ entity, onChangeModel }: { en

for (const variant of variants) {
if (clientside) {
await clientSideTransformModel(variant as ModelTransformParameters)
nuPath = await clientSideTransformModel(variant as ModelTransformParameters)
} else {
await Engine.instance.api.service(modelTransformPath).create(variant)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ function hashBuffer(buffer: Uint8Array): string {
export async function transformModel(
args: ModelTransformParameters,
onMetadata: (key: string, data: any) => void = (key, data) => {}
) {
): Promise<string> {
const parms = args

/**
Expand Down Expand Up @@ -758,6 +758,7 @@ export async function transformModel(
}
})
)*/
result = finalPath
console.log('Handled glb file')
} else if (parms.modelFormat === 'gltf') {
await Promise.all(
Expand Down Expand Up @@ -842,7 +843,7 @@ export async function transformModel(
finalPath += '.gltf'
}
await doUpload(new Blob([JSON.stringify(json)], { type: 'application/json' }), finalPath)

result = finalPath
console.log('Handled gltf file')
}

Expand All @@ -856,6 +857,6 @@ export async function transformModel(
}
}
onMetadata('vertexCount', totalVertexCount)

result = pathJoin(LoaderUtils.extractUrlBase(args.src), result)
return result
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export class ModelTransformService implements ServiceInterface<void> {
const createParams: ModelTransformParameters = data
console.log('config', config)
if (!config.kubernetes?.enabled) {
return transformModel(createParams)
await transformModel(createParams)
return
}
try {
const transformParms = createParams
Expand Down

0 comments on commit 3b6c801

Please sign in to comment.