Spaces:
Running
Running
LogicalTrue commited on
Commit 路
3bede7b
1
Parent(s): fd497ef
Automatically open and load newly generated 3D models directly into viewer upon completion
Browse files- frontend/app.js +4 -7
- frontend/viewer.html +10 -12
frontend/app.js
CHANGED
|
@@ -710,16 +710,13 @@ generate3dBtn.addEventListener('click', async () => {
|
|
| 710 |
updateLoader(job.progress || 10, job.status === 'pending' ? 'En cola de espera...' : 'Procesando en segundo plano...', job.message || 'Generando modelo 3D...');
|
| 711 |
} else if (job.status === 'completed') {
|
| 712 |
clearInterval(pollInterval);
|
|
|
|
| 713 |
|
| 714 |
const data = job.result;
|
| 715 |
if (data.gltfUrl && data.glbUrl) {
|
| 716 |
-
|
| 717 |
-
|
| 718 |
-
|
| 719 |
-
fbxUrl: data.fbxUrl,
|
| 720 |
-
detectedCategory: data.detectedCategory
|
| 721 |
-
}));
|
| 722 |
-
window.location.reload();
|
| 723 |
} else {
|
| 724 |
throw new Error('El resultado de la tarea no contiene las URLs de modelo esperadas.');
|
| 725 |
}
|
|
|
|
| 710 |
updateLoader(job.progress || 10, job.status === 'pending' ? 'En cola de espera...' : 'Procesando en segundo plano...', job.message || 'Generando modelo 3D...');
|
| 711 |
} else if (job.status === 'completed') {
|
| 712 |
clearInterval(pollInterval);
|
| 713 |
+
statusOverlay.classList.remove('active');
|
| 714 |
|
| 715 |
const data = job.result;
|
| 716 |
if (data.gltfUrl && data.glbUrl) {
|
| 717 |
+
refreshGallery();
|
| 718 |
+
showCustomToast('隆Modelo 3D generado y cargado con 茅xito!', 'success');
|
| 719 |
+
load3DModel(data.gltfUrl, data.glbUrl, data.fbxUrl, data.detectedCategory);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 720 |
} else {
|
| 721 |
throw new Error('El resultado de la tarea no contiene las URLs de modelo esperadas.');
|
| 722 |
}
|
frontend/viewer.html
CHANGED
|
@@ -1432,20 +1432,18 @@
|
|
| 1432 |
clearInterval(pollInterval);
|
| 1433 |
creatorStatus.style.display = 'none';
|
| 1434 |
btnCreate3DMobile.disabled = false;
|
| 1435 |
-
|
| 1436 |
-
alert('隆Modelo 3D creado con 茅xito! Se ha a帽adido a tu biblioteca.');
|
| 1437 |
-
|
| 1438 |
-
creatorContainer.style.display = 'none';
|
| 1439 |
-
galleryContainer.style.display = 'flex';
|
| 1440 |
-
const mobNavigation = document.getElementById('mobNavigation');
|
| 1441 |
-
const mobGalleryHeader = document.getElementById('mobGalleryHeader');
|
| 1442 |
-
const mobFilterTabs = document.getElementById('mobFilterTabs');
|
| 1443 |
-
if (mobNavigation) mobNavigation.style.display = 'flex';
|
| 1444 |
-
if (mobGalleryHeader) mobGalleryHeader.style.display = 'block';
|
| 1445 |
-
if (mobFilterTabs) mobFilterTabs.style.display = 'flex';
|
| 1446 |
-
if (navTabGallery) setMobNavActive(navTabGallery);
|
| 1447 |
resetCreatorState();
|
| 1448 |
fetchGallery();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1449 |
} else if (job.status === 'failed') {
|
| 1450 |
clearInterval(pollInterval);
|
| 1451 |
throw new Error(job.message || job.error || 'La generaci贸n 3D fall贸.');
|
|
|
|
| 1432 |
clearInterval(pollInterval);
|
| 1433 |
creatorStatus.style.display = 'none';
|
| 1434 |
btnCreate3DMobile.disabled = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1435 |
resetCreatorState();
|
| 1436 |
fetchGallery();
|
| 1437 |
+
fetchUserInfo();
|
| 1438 |
+
|
| 1439 |
+
const resData = job.result;
|
| 1440 |
+
const modelUrl = resData ? (resData.gltfUrl || resData.glbUrl) : null;
|
| 1441 |
+
if (modelUrl) {
|
| 1442 |
+
const absoluteUrl = modelUrl.startsWith('http') ? modelUrl : `${apiBase}${modelUrl}`;
|
| 1443 |
+
loadModelInViewer(absoluteUrl);
|
| 1444 |
+
} else {
|
| 1445 |
+
alert('隆Modelo 3D creado con 茅xito! Se ha a帽adido a tu biblioteca.');
|
| 1446 |
+
}
|
| 1447 |
} else if (job.status === 'failed') {
|
| 1448 |
clearInterval(pollInterval);
|
| 1449 |
throw new Error(job.message || job.error || 'La generaci贸n 3D fall贸.');
|