From e660e1d67884b2ff9deea1f70172180ce69f64d6 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Sat, 12 Apr 2025 11:27:05 -0400 Subject: [PATCH] [3d] add support to output camera state (#3421) --- src/extensions/core/load3d.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/extensions/core/load3d.ts b/src/extensions/core/load3d.ts index eeda9772b..47026a0c1 100644 --- a/src/extensions/core/load3d.ts +++ b/src/extensions/core/load3d.ts @@ -153,7 +153,8 @@ useExtensionService().registerExtension({ image: `threed/${data.name} [temp]`, mask: `threed/${dataMask.name} [temp]`, normal: `threed/${dataNormal.name} [temp]`, - lineart: `threed/${dataLineart.name} [temp]` + lineart: `threed/${dataLineart.name} [temp]`, + camera_info: node.properties['Camera Info'] } } } @@ -293,7 +294,8 @@ useExtensionService().registerExtension({ return { image: `threed/${data.name} [temp]`, mask: `threed/${dataMask.name} [temp]`, - normal: `threed/${dataNormal.name} [temp]` + normal: `threed/${dataNormal.name} [temp]`, + camera_info: node.properties['Camera Info'] } } } @@ -350,7 +352,7 @@ useExtensionService().registerExtension({ node.onExecuted = function (message: any) { onExecuted?.apply(this, arguments as any) - let filePath = message.model_file[0] + let filePath = message.result[0] if (!filePath) { const msg = t('toastMessages.unableToGetModelFilePath') @@ -360,6 +362,8 @@ useExtensionService().registerExtension({ const load3d = useLoad3dService().getLoad3d(node) + let cameraState = message.result[1] + const modelWidget = node.widgets?.find( (w: IWidget) => w.name === 'model_file' ) @@ -369,7 +373,7 @@ useExtensionService().registerExtension({ const config = new Load3DConfiguration(load3d) - config.configure('output', modelWidget) + config.configure('output', modelWidget, cameraState) } } } @@ -425,7 +429,7 @@ useExtensionService().registerExtension({ node.onExecuted = function (message: any) { onExecuted?.apply(this, arguments as any) - let filePath = message.model_file[0] + let filePath = message.result[0] if (!filePath) { const msg = t('toastMessages.unableToGetModelFilePath') @@ -433,6 +437,8 @@ useExtensionService().registerExtension({ useToastStore().addAlert(msg) } + let cameraState = message.result[1] + const load3d = useLoad3dService().getLoad3d(node) const modelWidget = node.widgets?.find( @@ -443,7 +449,7 @@ useExtensionService().registerExtension({ const config = new Load3DConfiguration(load3d) - config.configure('output', modelWidget) + config.configure('output', modelWidget, cameraState) } } }