From 7607a6478c264ce950a61fbfde314120199a214f Mon Sep 17 00:00:00 2001 From: AI Bot Date: Thu, 3 Sep 2026 11:55:23 +0530 Subject: [PATCH] fix(ImageTo3D): enforce glb format in Meshy API payload --- check_indicav2.cjs | 12 ++++++++++++ check_new_scene.cjs | 12 ++++++++++++ check_old_scene.cjs | 12 ++++++++++++ check_scene.cjs | 12 ++++++++++++ indicav2.titanscene | Bin 0 -> 1054 bytes model.titanscene | Bin 0 -> 950 bytes newmodel.titanscene | Bin 0 -> 1007 bytes src/components/ImageTo3DModal.tsx | 3 ++- src/pages/Editor.tsx | 4 ++++ test_zip.cjs | 9 +++++++++ test_zip.js | 10 ++++++++++ 11 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 check_indicav2.cjs create mode 100644 check_new_scene.cjs create mode 100644 check_old_scene.cjs create mode 100644 check_scene.cjs create mode 100644 indicav2.titanscene create mode 100644 model.titanscene create mode 100644 newmodel.titanscene create mode 100644 test_zip.cjs create mode 100644 test_zip.js diff --git a/check_indicav2.cjs b/check_indicav2.cjs new file mode 100644 index 0000000..326eb9a --- /dev/null +++ b/check_indicav2.cjs @@ -0,0 +1,12 @@ +const fs = require('fs'); +const fflate = require('fflate'); + +const zipBuffer = fs.readFileSync('indicav2.titanscene'); +const unzipped = fflate.unzipSync(zipBuffer); +const sceneData = JSON.parse(new TextDecoder().decode(unzipped['scene.json'])); +console.log('cameraProps:', sceneData.cameraProps); +console.log('modelData:', sceneData.modelData); +console.log('sceneObjects length:', sceneData.sceneObjects?.length); +if (sceneData.sceneObjects?.length > 0) { + console.log('Main model transform:', sceneData.sceneObjects[0].transformProps); +} diff --git a/check_new_scene.cjs b/check_new_scene.cjs new file mode 100644 index 0000000..7e7a9ee --- /dev/null +++ b/check_new_scene.cjs @@ -0,0 +1,12 @@ +const fs = require('fs'); +const fflate = require('fflate'); + +const zipBuffer = fs.readFileSync('newmodel.titanscene'); +const unzipped = fflate.unzipSync(zipBuffer); +const sceneData = JSON.parse(new TextDecoder().decode(unzipped['scene.json'])); +console.log('cameraProps:', sceneData.cameraProps); +console.log('modelData:', sceneData.modelData); +console.log('sceneObjects length:', sceneData.sceneObjects?.length); +if (sceneData.sceneObjects?.length > 0) { + console.log('Main model transform:', sceneData.sceneObjects[0].transformProps); +} diff --git a/check_old_scene.cjs b/check_old_scene.cjs new file mode 100644 index 0000000..2b83892 --- /dev/null +++ b/check_old_scene.cjs @@ -0,0 +1,12 @@ +const fs = require('fs'); +const fflate = require('fflate'); + +const zipBuffer = fs.readFileSync('model.titanscene'); +const unzipped = fflate.unzipSync(zipBuffer); +const sceneData = JSON.parse(new TextDecoder().decode(unzipped['scene.json'])); +console.log('cameraProps:', sceneData.cameraProps); +console.log('modelData:', sceneData.modelData); +console.log('sceneObjects length:', sceneData.sceneObjects?.length); +if (sceneData.sceneObjects?.length > 0) { + console.log('Main model transform:', sceneData.sceneObjects[0].transformProps); +} diff --git a/check_scene.cjs b/check_scene.cjs new file mode 100644 index 0000000..120b752 --- /dev/null +++ b/check_scene.cjs @@ -0,0 +1,12 @@ +const fs = require('fs'); +const fflate = require('fflate'); + +const zipBuffer = fs.readFileSync('model.titanscene'); +const unzipped = fflate.unzipSync(zipBuffer); +const sceneData = JSON.parse(new TextDecoder().decode(unzipped['scene.json'])); +console.log('cameraProps:', sceneData.cameraProps); +console.log('modelData extension:', sceneData.modelData?.extension); +console.log('sceneObjects length:', sceneData.sceneObjects?.length); +if (sceneData.sceneObjects?.length > 0) { + console.log('Main model transform:', sceneData.sceneObjects[0].transformProps); +} diff --git a/indicav2.titanscene b/indicav2.titanscene new file mode 100644 index 0000000000000000000000000000000000000000..2868e4e3419488358c0774e59e4e6956352a0345 GIT binary patch literal 1054 zcmV+(1mXKoO9KQH000080Lon>U3WEP;HU!t04oRp015yA0CQtyZe=cNb8l|FRZVZ( zI1v3SfqIn%eM`bkXUW#HtOO(Y8B?=TNqYd)k`-YNSJMPD=^2HnuXWq1qcQ}~O139?USPo3{-rOT#Z>99TNsMAA;b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=C0MTx^L9tt{V?Gft8c&u1$%*$R<7OwUW{ zf5v347iCb~K4~vBxJp(L6Asklmpp#JG#bxbkt_@^i9Ljc;Z-WBn?xmu4a0L?I{~D` zbu@gN=tpqJ`yT$UiOw*v;}K3uHm#q?kr&9Wsd6o^%;8>gc;DtTV2#a^@f)vXfVntk ztO2FEnzFjq9A2W+IF%G~-rTI15}kuirWaHD6U&KRGX5!a<68jDQL%(*ET1aYW?*+q zxc)Mxi@osRP0WnuYpxtX80%ZpSl(lZlhJeAj2uQ5&s4q2mf4D$KKqFIUJm9wB!Qu| z0(pGzj0z}A^KYR=OpqW}(s`~+xNK(Y?R;LWHpOPU-mdc<(EgHLpyrBVw!8SCGF@Ws zCyEw}*>1brtTzz-rGfe68Pxes_*lXUU0A<6I+-B3~He5jkpBjTe0{{TZ1^@sG000000000000000000000CQtyZe=cNb8l`? YO9ci1000010096v0001J0{{R30KYoMoB#j- literal 0 HcmV?d00001 diff --git a/newmodel.titanscene b/newmodel.titanscene new file mode 100644 index 0000000000000000000000000000000000000000..9408aea496144e8a18c5cf420349bf984223abf9 GIT binary patch literal 1007 zcmWIWW@Zs#U|`^2I1!~BTWqkRyONoK;V&Bl0~b)VI5{;hRWGYJKd&_OcHV6ZfxlB7 zYC~D>>Q|m&o6WnSTf}#RzU#&Xs;3^c39-hdY-#+zw|$AKwW*eUp~W1_;tIaMax13! zeX0CzpSzXo-M)S7Yq;Mv1(r;?uNE5n+%wLsa8kIVgip$n8#PBbJx$)`*?C`_8Fv3q z^5uyO_MbO9IQLkQ+9bbUoUH1HD0w%p5*z}sZYar@y}`l?xQBc!VO0f zWkd_x;)7K}!_+)ywSC-fFu`eZaUb`}X*X8IPZrppe>{1IpX1d6>G_Sfzt)%SeRSj( z^O^f+{&K$)-0bc4gKf8HjK`dRS9bHOFERL?xQOdECtrZ?k8N3&s+&Yz*vmh5woKG~ z>b9w|acjPvq;?v&dSIg>yH{=74A0YF%ENumZZVy6V!7vK&L=-LN?FCNA1}XAdteKj zeo){U9sPN>GRCL1ALrbv)^c1EIq!E|pu*Oe-3O-k*2&17v{C+l^>XI42NfAxNG zpKRbiv2JA$^UEU-=Lx3VKPI?gS7Po5?w2zhE$rJ4%1!aR8y3p@=)$P`( zT6;k?L%vFIuieHsH@6<#|8mQ9=7wW0ZaA4t%8{+!$WksDRL^0!E3)I_q0nO=Y#(wd zv|MSv;cfI-X!`=SqWwiLBKA!9nJf6TH1v4nyzt1lu+SMUnU|*&-c-p94Ntw);yOjG zGFIGomS|+`@>bo0Vug{Hnz!1q>`YnCV&0JY)zD$}jznvx<5SdvyQgSry;eEdt+oD@ z(9~?7&&|EZ`08g*4~#n&Dy1&ECOoZ>Q`S#+N}p^I~U>tahD zwq(wOtirh;B&rJ^zjU7X)OguOU*@I0$6LPs`*LxI^`(73fB#4}O?hYcWZrkbec$G} z)-T>7@&A=dw0y~It73@1h7{umu6%x7@qEiQ~tStBGQ7kIwgZ zuTI)wxBoW3UBPGl#q2KY=T;=H(D8B3o)GVoeqXiyL1V_F-}3cL0p5&EA`G~*C@_~I a0Yruk@MZ;OVg?3AAhZC|3xV01fdK$#!onE< literal 0 HcmV?d00001 diff --git a/src/components/ImageTo3DModal.tsx b/src/components/ImageTo3DModal.tsx index a72ad07..bbe162e 100644 --- a/src/components/ImageTo3DModal.tsx +++ b/src/components/ImageTo3DModal.tsx @@ -301,7 +301,8 @@ export const ImageTo3DModal: React.FC = ({ isOpen, onClose, image_url: dataUrl, model_type: meshyModelType, should_texture: meshyShouldTexture, - should_enhance_image: meshyEnhanceImage + should_enhance_image: meshyEnhanceImage, + target_formats: ['glb'] }; if (meshyModelType !== 'lowpoly') { diff --git a/src/pages/Editor.tsx b/src/pages/Editor.tsx index 7c4fbbc..34e9c9b 100644 --- a/src/pages/Editor.tsx +++ b/src/pages/Editor.tsx @@ -403,6 +403,7 @@ export default function Editor() { if (sd.cameraPresets) setCameraPresets(sd.cameraPresets); if (sd.modelData && sd.modelData.data) { + setModelData(sd.modelData); reImportModel(sd.modelData); } } @@ -992,6 +993,7 @@ export default function Editor() { // Re-load model if data exists if (data.modelData && data.modelData.data) { + setModelData(data.modelData); reImportModel(data.modelData); } } catch (err) { @@ -5300,3 +5302,5 @@ export default function Editor() { ); } + + diff --git a/test_zip.cjs b/test_zip.cjs new file mode 100644 index 0000000..be1e172 --- /dev/null +++ b/test_zip.cjs @@ -0,0 +1,9 @@ +const fflate = require('fflate'); + +const zipObj = {}; +zipObj['model.glb'] = new Uint8Array([1, 2, 3, 4, 5]); + +const zipped = fflate.zipSync(zipObj); +const unzipped = fflate.unzipSync(zipped); + +console.log(unzipped['model.glb']); diff --git a/test_zip.js b/test_zip.js new file mode 100644 index 0000000..eaff290 --- /dev/null +++ b/test_zip.js @@ -0,0 +1,10 @@ +const fs = require('fs'); +const fflate = require('fflate'); + +const zipObj = {}; +zipObj['model.glb'] = new Uint8Array([1, 2, 3, 4, 5]); + +const zipped = fflate.zipSync(zipObj); +const unzipped = fflate.unzipSync(zipped); + +console.log(unzipped['model.glb']);