Spaces:
Sleeping
Sleeping
staswrs
commited on
Commit
·
91756de
1
Parent(s):
31cbe0e
clean scene 15
Browse files
app.py
CHANGED
|
@@ -85,9 +85,13 @@ def generate(image_path, face_number=50000, guidance_scale=5.0, num_steps=25):
|
|
| 85 |
if mesh is None or mesh.vertices.shape[0] == 0 or mesh.faces.shape[0] == 0:
|
| 86 |
raise ValueError("Mesh generation returned an empty mesh")
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
# Безопасная очистка визуала
|
| 89 |
-
if hasattr(mesh, "visual") and mesh.visual is not None:
|
| 90 |
-
mesh.visual = trimesh.visual.ColorVisuals(mesh=mesh, face_colors=None) ## вот тут последнее изменение
|
| 91 |
|
| 92 |
## можно вернуть это, если нужно
|
| 93 |
# try:
|
|
@@ -95,8 +99,8 @@ def generate(image_path, face_number=50000, guidance_scale=5.0, num_steps=25):
|
|
| 95 |
# except Exception:
|
| 96 |
# print("[WARN] Failed to clear visual, skipping")
|
| 97 |
|
| 98 |
-
mesh.metadata.clear()
|
| 99 |
-
mesh.name = "endless_tools_mesh"
|
| 100 |
|
| 101 |
# Экспорт .glb
|
| 102 |
# glb_data = export_glb(mesh)
|
|
|
|
| 85 |
if mesh is None or mesh.vertices.shape[0] == 0 or mesh.faces.shape[0] == 0:
|
| 86 |
raise ValueError("Mesh generation returned an empty mesh")
|
| 87 |
|
| 88 |
+
mesh = trimesh.Trimesh(vertices=mesh.vertices, faces=mesh.faces)
|
| 89 |
+
mesh.rezero()
|
| 90 |
+
mesh.fix_normals()
|
| 91 |
+
|
| 92 |
# Безопасная очистка визуала
|
| 93 |
+
# if hasattr(mesh, "visual") and mesh.visual is not None:
|
| 94 |
+
# mesh.visual = trimesh.visual.ColorVisuals(mesh=mesh, face_colors=None) ## вот тут последнее изменение
|
| 95 |
|
| 96 |
## можно вернуть это, если нужно
|
| 97 |
# try:
|
|
|
|
| 99 |
# except Exception:
|
| 100 |
# print("[WARN] Failed to clear visual, skipping")
|
| 101 |
|
| 102 |
+
# mesh.metadata.clear()
|
| 103 |
+
# mesh.name = "endless_tools_mesh"
|
| 104 |
|
| 105 |
# Экспорт .glb
|
| 106 |
# glb_data = export_glb(mesh)
|