Skip to content

add support to output camera state #7582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions comfy_extras/nodes_load_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def INPUT_TYPES(s):
"height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}),
}}

RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "IMAGE")
RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "lineart")
RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "IMAGE", "LOAD3D_CAMERA")
RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "lineart", "camera_info")

FUNCTION = "process"
EXPERIMENTAL = True
Expand All @@ -41,7 +41,7 @@ def process(self, model_file, image, **kwargs):
normal_image, ignore_mask2 = load_image_node.load_image(image=normal_path)
lineart_image, ignore_mask3 = load_image_node.load_image(image=lineart_path)

return output_image, output_mask, model_file, normal_image, lineart_image
return output_image, output_mask, model_file, normal_image, lineart_image, image['camera_info']

class Load3DAnimation():
@classmethod
Expand All @@ -59,8 +59,8 @@ def INPUT_TYPES(s):
"height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}),
}}

RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE")
RETURN_NAMES = ("image", "mask", "mesh_path", "normal")
RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "LOAD3D_CAMERA")
RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "camera_info")

FUNCTION = "process"
EXPERIMENTAL = True
Expand All @@ -77,13 +77,16 @@ def process(self, model_file, image, **kwargs):
ignore_image, output_mask = load_image_node.load_image(image=mask_path)
normal_image, ignore_mask2 = load_image_node.load_image(image=normal_path)

return output_image, output_mask, model_file, normal_image
return output_image, output_mask, model_file, normal_image, image['camera_info']

class Preview3D():
@classmethod
def INPUT_TYPES(s):
return {"required": {
"model_file": ("STRING", {"default": "", "multiline": False}),
},
"optional": {
"camera_info": ("LOAD3D_CAMERA", {})
}}

OUTPUT_NODE = True
Expand All @@ -95,13 +98,22 @@ def INPUT_TYPES(s):
EXPERIMENTAL = True

def process(self, model_file, **kwargs):
return {"ui": {"model_file": [model_file]}, "result": ()}
camera_info = kwargs.get("camera_info", None)

return {
"ui": {
"result": [model_file, camera_info]
}
}

class Preview3DAnimation():
@classmethod
def INPUT_TYPES(s):
return {"required": {
"model_file": ("STRING", {"default": "", "multiline": False}),
},
"optional": {
"camera_info": ("LOAD3D_CAMERA", {})
}}

OUTPUT_NODE = True
Expand All @@ -113,7 +125,13 @@ def INPUT_TYPES(s):
EXPERIMENTAL = True

def process(self, model_file, **kwargs):
return {"ui": {"model_file": [model_file]}, "result": ()}
camera_info = kwargs.get("camera_info", None)

return {
"ui": {
"result": [model_file, camera_info]
}
}

NODE_CLASS_MAPPINGS = {
"Load3D": Load3D,
Expand Down