Skip to content

Commit e77b34d

Browse files
authored
add File3DAny output to Load3D node; extend SaveGLB to accept File3DAny as input (Comfy-Org#12276)
* add File3DAny output to Load3D node; extend SaveGLB node to accept File3DAny as input * fix(grammar): capitalize letter
1 parent ef73070 commit e77b34d

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

comfy_extras/nodes_hunyuan3d.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ class SaveGLB(IO.ComfyNode):
618618
def define_schema(cls):
619619
return IO.Schema(
620620
node_id="SaveGLB",
621+
display_name="Save 3D Model",
621622
search_aliases=["export 3d model", "save mesh"],
622623
category="3d",
623624
is_output_node=True,
@@ -626,8 +627,14 @@ def define_schema(cls):
626627
IO.Mesh.Input("mesh"),
627628
types=[
628629
IO.File3DGLB,
630+
IO.File3DGLTF,
631+
IO.File3DOBJ,
632+
IO.File3DFBX,
633+
IO.File3DSTL,
634+
IO.File3DUSDZ,
635+
IO.File3DAny,
629636
],
630-
tooltip="Mesh or GLB file to save",
637+
tooltip="Mesh or 3D file to save",
631638
),
632639
IO.String.Input("filename_prefix", default="mesh/ComfyUI"),
633640
],
@@ -649,7 +656,8 @@ def execute(cls, mesh: Types.MESH | Types.File3D, filename_prefix: str) -> IO.No
649656

650657
if isinstance(mesh, Types.File3D):
651658
# Handle File3D input - save BytesIO data to output folder
652-
f = f"{filename}_{counter:05}_.glb"
659+
ext = mesh.format or "glb"
660+
f = f"{filename}_{counter:05}_.{ext}"
653661
mesh.save_to(os.path.join(full_output_folder, f))
654662
results.append({
655663
"filename": f,

comfy_extras/nodes_load_3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def define_schema(cls):
4545
IO.Image.Output(display_name="normal"),
4646
IO.Load3DCamera.Output(display_name="camera_info"),
4747
IO.Video.Output(display_name="recording_video"),
48+
IO.File3DAny.Output(display_name="model_3d"),
4849
],
4950
)
5051

@@ -66,7 +67,8 @@ def execute(cls, model_file, image, **kwargs) -> IO.NodeOutput:
6667

6768
video = InputImpl.VideoFromFile(recording_video_path)
6869

69-
return IO.NodeOutput(output_image, output_mask, model_file, normal_image, image['camera_info'], video)
70+
file_3d = Types.File3D(folder_paths.get_annotated_filepath(model_file))
71+
return IO.NodeOutput(output_image, output_mask, model_file, normal_image, image['camera_info'], video, file_3d)
7072

7173
process = execute # TODO: remove
7274

0 commit comments

Comments
 (0)