Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

support upload 3d model to custom subfolder (#8597)

Terry Jia79ed75274874
diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py
index 40d03e18a..899608149 100644
--- a/comfy_extras/nodes_load_3d.py
+++ b/comfy_extras/nodes_load_3d.py
@@ -5,6 +5,8 @@ import os
from comfy.comfy_types import IO
from comfy_api.input_impl import VideoFromFile
+from pathlib import Path
+
def normalize_path(path):
return path.replace('\\', '/')
@@ -16,7 +18,14 @@ class Load3D():
os.makedirs(input_dir, exist_ok=True)
- files = [normalize_path(os.path.join("3d", f)) for f in os.listdir(input_dir) if f.endswith(('.gltf', '.glb', '.obj', '.fbx', '.stl'))]
+ input_path = Path(input_dir)
+ base_path = Path(folder_paths.get_input_directory())
+
+ files = [
+ normalize_path(str(file_path.relative_to(base_path)))
+ for file_path in input_path.rglob("*")
+ if file_path.suffix.lower() in {'.gltf', '.glb', '.obj', '.fbx', '.stl'}
+ ]
return {"required": {
"model_file": (sorted(files), {"file_upload": True}),
@@ -61,7 +70,14 @@ class Load3DAnimation():
os.makedirs(input_dir, exist_ok=True)
- files = [normalize_path(os.path.join("3d", f)) for f in os.listdir(input_dir) if f.endswith(('.gltf', '.glb', '.fbx'))]
+ input_path = Path(input_dir)
+ base_path = Path(folder_paths.get_input_directory())
+
+ files = [
+ normalize_path(str(file_path.relative_to(base_path)))
+ for file_path in input_path.rglob("*")
+ if file_path.suffix.lower() in {'.gltf', '.glb', '.fbx'}
+ ]
return {"required": {
"model_file": (sorted(files), {"file_upload": True}),