Skip to content

Commit 9ad287f

Browse files
authored
add support to record video as output for 3d node (Comfy-Org#7927)
* add support to record video as output for 3d node * source format * add support to record video for load3d animation node
1 parent f5cacae commit 9ad287f

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

comfy_extras/nodes_load_3d.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
import folder_paths
33
import os
44

5+
from comfy.comfy_types import IO
6+
from comfy_api.input_impl import VideoFromFile
7+
8+
59
def normalize_path(path):
610
return path.replace('\\', '/')
711

@@ -21,8 +25,8 @@ def INPUT_TYPES(s):
2125
"height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}),
2226
}}
2327

24-
RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "IMAGE", "LOAD3D_CAMERA")
25-
RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "lineart", "camera_info")
28+
RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "IMAGE", "LOAD3D_CAMERA", IO.VIDEO)
29+
RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "lineart", "camera_info", "recording_video")
2630

2731
FUNCTION = "process"
2832
EXPERIMENTAL = True
@@ -41,7 +45,14 @@ def process(self, model_file, image, **kwargs):
4145
normal_image, ignore_mask2 = load_image_node.load_image(image=normal_path)
4246
lineart_image, ignore_mask3 = load_image_node.load_image(image=lineart_path)
4347

44-
return output_image, output_mask, model_file, normal_image, lineart_image, image['camera_info']
48+
video = None
49+
50+
if image['recording'] != "":
51+
recording_video_path = folder_paths.get_annotated_filepath(image['recording'])
52+
53+
video = VideoFromFile(recording_video_path)
54+
55+
return output_image, output_mask, model_file, normal_image, lineart_image, image['camera_info'], video
4556

4657
class Load3DAnimation():
4758
@classmethod
@@ -59,8 +70,8 @@ def INPUT_TYPES(s):
5970
"height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}),
6071
}}
6172

62-
RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "LOAD3D_CAMERA")
63-
RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "camera_info")
73+
RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "LOAD3D_CAMERA", IO.VIDEO)
74+
RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "camera_info", "recording_video")
6475

6576
FUNCTION = "process"
6677
EXPERIMENTAL = True
@@ -77,7 +88,14 @@ def process(self, model_file, image, **kwargs):
7788
ignore_image, output_mask = load_image_node.load_image(image=mask_path)
7889
normal_image, ignore_mask2 = load_image_node.load_image(image=normal_path)
7990

80-
return output_image, output_mask, model_file, normal_image, image['camera_info']
91+
video = None
92+
93+
if image['recording'] != "":
94+
recording_video_path = folder_paths.get_annotated_filepath(image['recording'])
95+
96+
video = VideoFromFile(recording_video_path)
97+
98+
return output_image, output_mask, model_file, normal_image, image['camera_info'], video
8199

82100
class Preview3D():
83101
@classmethod

0 commit comments

Comments
 (0)