Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions comfy_api/latest/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,13 @@ class CameraInfo(TypedDict):
target: dict[str, float | int]
zoom: int
cameraType: str
quaternion: NotRequired[dict[str, float | int]]
rotation: NotRequired[dict[str, float | int | str]]
fov: NotRequired[float | int]
aspect: NotRequired[float | int]
near: NotRequired[float | int]
far: NotRequired[float | int]
frustum: NotRequired[dict[str, float | int]]

Type = CameraInfo

Expand Down
19 changes: 18 additions & 1 deletion comfy_api_nodes/nodes_bytedance.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
ApiEndpoint,
download_url_to_image_tensor,
download_url_to_video_output,
downscale_image_tensor_by_max_side,
downscale_video_to_max_pixels,
get_number_of_images,
image_tensor_pair_to_batch,
Expand Down Expand Up @@ -122,6 +123,14 @@ def _validate_ref_video_pixels(video: Input.Video, model_id: str, resolution: st
)


def _prepare_seedance_image(image: Input.Image) -> Input.Image:
"""Auto-downscale a Seedance image input to the per-side limits, then validate it."""
validate_image_aspect_ratio(image, (2, 5), (5, 2), strict=False) # 0.4 to 2.5
image = downscale_image_tensor_by_max_side(image, max_side=6000)
validate_image_dimensions(image, min_width=300, min_height=300, max_width=6000, max_height=6000)
return image


async def _resolve_reference_assets(
cls: type[IO.ComfyNode],
asset_ids: list[str],
Expand Down Expand Up @@ -1781,6 +1790,11 @@ async def execute(
if last_frame is not None and last_frame_asset_id:
raise ValueError("Provide only one of last_frame or last_frame_asset_id, not both.")

if first_frame is not None:
first_frame = _prepare_seedance_image(first_frame)
if last_frame is not None:
last_frame = _prepare_seedance_image(last_frame)

asset_ids_to_resolve = [a for a in (first_frame_asset_id, last_frame_asset_id) if a]
image_assets: dict[str, str] = {}
if asset_ids_to_resolve:
Expand Down Expand Up @@ -1887,7 +1901,7 @@ def _seedance2_reference_inputs(resolutions: list[str], default_ratio: str = "16
),
IO.Boolean.Input(
"auto_downscale",
default=False,
default=True,
optional=True,
tooltip="Automatically downscale reference videos that exceed the model's pixel budget "
"for the selected resolution. Aspect ratio is preserved; videos already within limits are untouched.",
Expand Down Expand Up @@ -2055,6 +2069,9 @@ async def execute(
f"(audios={len(reference_audios)}, audio assets={len(reference_audio_assets)}). Maximum is 3."
)

for key in reference_images:
reference_images[key] = _prepare_seedance_image(reference_images[key])

model_id = SEEDANCE_MODELS[model["model"]]
has_video_input = total_videos > 0

Expand Down
10 changes: 7 additions & 3 deletions comfy_extras/nodes_load_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def define_schema(cls):
essentials_category="Basics",
is_experimental=True,
inputs=[
IO.Combo.Input("model_file", options=sorted(files), upload=IO.UploadType.model),
IO.Combo.Input("model_file", options=["none"] + sorted(files), upload=IO.UploadType.model),
IO.Load3D.Input("image"),
IO.Int.Input("width", default=1024, min=1, max=4096, step=1),
IO.Int.Input("height", default=1024, min=1, max=4096, step=1),
Expand Down Expand Up @@ -68,8 +68,12 @@ def execute(cls, model_file, image, **kwargs) -> IO.NodeOutput:

video = InputImpl.VideoFromFile(recording_video_path)

file_3d = Types.File3D(folder_paths.get_annotated_filepath(model_file))
return IO.NodeOutput(output_image, output_mask, model_file, normal_image, image['camera_info'], video, file_3d)
file_3d = None
mesh_path = ""
if model_file and model_file != "none":
file_3d = Types.File3D(folder_paths.get_annotated_filepath(model_file))
mesh_path = model_file
return IO.NodeOutput(output_image, output_mask, mesh_path, normal_image, image['camera_info'], video, file_3d)

process = execute # TODO: remove

Expand Down
Loading