Spaces:
Sleeping
Sleeping
LogicalTrue commited on
Commit ·
cd7e522
1
Parent(s): 0257786
Use non-destructive fast cleanup for FBX export to preserve original UV mapping, materials, and textures without distortion
Browse files- backend/scripts/blender/clean_mesh_blender.py +2 -2
- backend/server.py +2 -2
- frontend/app.js +3 -3
- frontend/viewer.html +1 -1
backend/scripts/blender/clean_mesh_blender.py
CHANGED
|
@@ -100,7 +100,7 @@ def strip_gltf_extensions(glb_path):
|
|
| 100 |
except Exception as e:
|
| 101 |
print(f"[Blender] Extension strip note: {e}")
|
| 102 |
|
| 103 |
-
def run_blender_cleanup(input_path, output_path, target_faces=8000, remesh_method="
|
| 104 |
print(f"[Blender] Loading model: {input_path} (target_faces={target_faces}, remesh_method={remesh_method})")
|
| 105 |
|
| 106 |
# 1. Reset scene to factory default empty scene
|
|
@@ -388,7 +388,7 @@ if __name__ == "__main__":
|
|
| 388 |
except ValueError:
|
| 389 |
pass
|
| 390 |
|
| 391 |
-
remesh_method = "
|
| 392 |
if len(args) >= 4:
|
| 393 |
remesh_method = args[3]
|
| 394 |
|
|
|
|
| 100 |
except Exception as e:
|
| 101 |
print(f"[Blender] Extension strip note: {e}")
|
| 102 |
|
| 103 |
+
def run_blender_cleanup(input_path, output_path, target_faces=8000, remesh_method="cleanup"):
|
| 104 |
print(f"[Blender] Loading model: {input_path} (target_faces={target_faces}, remesh_method={remesh_method})")
|
| 105 |
|
| 106 |
# 1. Reset scene to factory default empty scene
|
|
|
|
| 388 |
except ValueError:
|
| 389 |
pass
|
| 390 |
|
| 391 |
+
remesh_method = "cleanup"
|
| 392 |
if len(args) >= 4:
|
| 393 |
remesh_method = args[3]
|
| 394 |
|
backend/server.py
CHANGED
|
@@ -154,7 +154,7 @@ def execute_job_3d(job_id, username, params):
|
|
| 154 |
auto_optimize = params.get('auto_optimize', False)
|
| 155 |
quad_target_faces = int(params.get('quad_target_faces', 60000))
|
| 156 |
prompt = params.get('prompt', '')
|
| 157 |
-
remesh_method = params.get('remeshMethod', '
|
| 158 |
|
| 159 |
if not image_data_b64:
|
| 160 |
raise Exception("No image data provided")
|
|
@@ -1113,7 +1113,7 @@ class F23DHTTPRequestHandler(SimpleHTTPRequestHandler):
|
|
| 1113 |
|
| 1114 |
model_url = params.get('modelUrl', '') # e.g. "/generated_models/model_1782268665.glb"
|
| 1115 |
quad_target_faces = int(params.get('quad_target_faces', 60000))
|
| 1116 |
-
remesh_method = params.get('remeshMethod', '
|
| 1117 |
if not model_url:
|
| 1118 |
self.send_error_response(400, "No modelUrl provided")
|
| 1119 |
return
|
|
|
|
| 154 |
auto_optimize = params.get('auto_optimize', False)
|
| 155 |
quad_target_faces = int(params.get('quad_target_faces', 60000))
|
| 156 |
prompt = params.get('prompt', '')
|
| 157 |
+
remesh_method = params.get('remeshMethod', 'cleanup')
|
| 158 |
|
| 159 |
if not image_data_b64:
|
| 160 |
raise Exception("No image data provided")
|
|
|
|
| 1113 |
|
| 1114 |
model_url = params.get('modelUrl', '') # e.g. "/generated_models/model_1782268665.glb"
|
| 1115 |
quad_target_faces = int(params.get('quad_target_faces', 60000))
|
| 1116 |
+
remesh_method = params.get('remeshMethod', 'cleanup')
|
| 1117 |
if not model_url:
|
| 1118 |
self.send_error_response(400, "No modelUrl provided")
|
| 1119 |
return
|
frontend/app.js
CHANGED
|
@@ -558,7 +558,7 @@ generate3dBtn.addEventListener('click', async () => {
|
|
| 558 |
const slatStepsNum = parseInt(slatStepsInput.value);
|
| 559 |
const autoOptimize = false;
|
| 560 |
const quadTargetFaces = 60000;
|
| 561 |
-
const remeshMethod = '
|
| 562 |
|
| 563 |
const response = await fetch(`${apiBase}/api/generate-3d`, {
|
| 564 |
method: 'POST',
|
|
@@ -1253,7 +1253,7 @@ function load3DModel(gltfUrl, downloadUrl, fbxUrl, detectedCategory = 'unknown')
|
|
| 1253 |
body: JSON.stringify({
|
| 1254 |
modelUrl: activeModelRelativeUrl,
|
| 1255 |
quad_target_faces: 60000,
|
| 1256 |
-
remeshMethod: '
|
| 1257 |
})
|
| 1258 |
});
|
| 1259 |
|
|
@@ -2021,7 +2021,7 @@ function renderGallery(items) {
|
|
| 2021 |
body: JSON.stringify({
|
| 2022 |
modelUrl: item.url,
|
| 2023 |
quad_target_faces: 60000,
|
| 2024 |
-
remeshMethod: '
|
| 2025 |
})
|
| 2026 |
});
|
| 2027 |
|
|
|
|
| 558 |
const slatStepsNum = parseInt(slatStepsInput.value);
|
| 559 |
const autoOptimize = false;
|
| 560 |
const quadTargetFaces = 60000;
|
| 561 |
+
const remeshMethod = 'cleanup';
|
| 562 |
|
| 563 |
const response = await fetch(`${apiBase}/api/generate-3d`, {
|
| 564 |
method: 'POST',
|
|
|
|
| 1253 |
body: JSON.stringify({
|
| 1254 |
modelUrl: activeModelRelativeUrl,
|
| 1255 |
quad_target_faces: 60000,
|
| 1256 |
+
remeshMethod: 'cleanup'
|
| 1257 |
})
|
| 1258 |
});
|
| 1259 |
|
|
|
|
| 2021 |
body: JSON.stringify({
|
| 2022 |
modelUrl: item.url,
|
| 2023 |
quad_target_faces: 60000,
|
| 2024 |
+
remeshMethod: 'cleanup'
|
| 2025 |
})
|
| 2026 |
});
|
| 2027 |
|
frontend/viewer.html
CHANGED
|
@@ -785,7 +785,7 @@
|
|
| 785 |
slat_steps: 12,
|
| 786 |
auto_optimize: false,
|
| 787 |
quad_target_faces: 60000,
|
| 788 |
-
remeshMethod: '
|
| 789 |
prompt: ''
|
| 790 |
})
|
| 791 |
});
|
|
|
|
| 785 |
slat_steps: 12,
|
| 786 |
auto_optimize: false,
|
| 787 |
quad_target_faces: 60000,
|
| 788 |
+
remeshMethod: 'cleanup',
|
| 789 |
prompt: ''
|
| 790 |
})
|
| 791 |
});
|