Skip to content

Commit e7214d7

Browse files
authored
feat: add model_info output to Load3D node (Comfy-Org#14144)
1 parent b10a616 commit e7214d7

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

comfy_api/latest/_io.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,17 @@ class CameraInfo(TypedDict):
777777
Type = CameraInfo
778778

779779

780+
@comfytype(io_type="LOAD3D_MODEL_INFO")
781+
class Load3DModelInfo(ComfyTypeIO):
782+
class Model3DTransform(TypedDict):
783+
# Coordinate system: right-handed, Y-up, world space
784+
position: dict[str, float | int] # scene units
785+
quaternion: dict[str, float | int] # normalized, dimensionless; world rotation
786+
scale: dict[str, float | int] # dimensionless multiplier
787+
788+
Type = list[Model3DTransform]
789+
790+
780791
@comfytype(io_type="LOAD_3D")
781792
class Load3D(ComfyTypeIO):
782793
"""3D models are stored as a dictionary."""
@@ -786,6 +797,7 @@ class Model3DDict(TypedDict):
786797
normal: str
787798
camera_info: Load3DCamera.CameraInfo
788799
recording: NotRequired[str]
800+
model_3d_info: NotRequired[list[Load3DModelInfo.Model3DTransform]]
789801

790802
Type = Model3DDict
791803

@@ -2298,6 +2310,7 @@ def as_dict(self):
22982310
"FlowControl",
22992311
"Accumulation",
23002312
"Load3DCamera",
2313+
"Load3DModelInfo",
23012314
"Load3D",
23022315
"Load3DAnimation",
23032316
"Photomaker",

comfy_extras/nodes_load_3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def define_schema(cls):
4747
IO.Load3DCamera.Output(display_name="camera_info"),
4848
IO.Video.Output(display_name="recording_video"),
4949
IO.File3DAny.Output(display_name="model_3d"),
50+
IO.Load3DModelInfo.Output(display_name="model_3d_info"),
5051
],
5152
)
5253

@@ -73,7 +74,8 @@ def execute(cls, model_file, image, **kwargs) -> IO.NodeOutput:
7374
if model_file and model_file != "none":
7475
file_3d = Types.File3D(folder_paths.get_annotated_filepath(model_file))
7576
mesh_path = model_file
76-
return IO.NodeOutput(output_image, output_mask, mesh_path, normal_image, image['camera_info'], video, file_3d)
77+
model_3d_info = image.get('model_3d_info', [])
78+
return IO.NodeOutput(output_image, output_mask, mesh_path, normal_image, image['camera_info'], video, file_3d, model_3d_info)
7779

7880
process = execute # TODO: remove
7981

0 commit comments

Comments
 (0)