mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-05 03:57:04 +08:00
change camera_condition type; make camera_condition optional
This commit is contained in:
parent
7a7a5ea323
commit
4c7206027f
@ -1083,7 +1083,8 @@ class WAN21_Camera(WAN21):
|
|||||||
def extra_conds(self, **kwargs):
|
def extra_conds(self, **kwargs):
|
||||||
out = super().extra_conds(**kwargs)
|
out = super().extra_conds(**kwargs)
|
||||||
camera_conditions = kwargs.get("camera_conditions", None)
|
camera_conditions = kwargs.get("camera_conditions", None)
|
||||||
out['camera_conditions'] = comfy.conds.CONDRegular(camera_conditions)
|
if camera_conditions is not None:
|
||||||
|
out['camera_conditions'] = comfy.conds.CONDRegular(camera_conditions)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
class Hunyuan3Dv2(BaseModel):
|
class Hunyuan3Dv2(BaseModel):
|
||||||
|
|||||||
@ -303,7 +303,6 @@ class WanCameraImageToVideo:
|
|||||||
return {"required": {"positive": ("CONDITIONING", ),
|
return {"required": {"positive": ("CONDITIONING", ),
|
||||||
"negative": ("CONDITIONING", ),
|
"negative": ("CONDITIONING", ),
|
||||||
"vae": ("VAE", ),
|
"vae": ("VAE", ),
|
||||||
"camera_conditions": ("LATENT", ),
|
|
||||||
"width": ("INT", {"default": 832, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}),
|
"width": ("INT", {"default": 832, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}),
|
||||||
"height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}),
|
"height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}),
|
||||||
"length": ("INT", {"default": 81, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}),
|
"length": ("INT", {"default": 81, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}),
|
||||||
@ -311,6 +310,7 @@ class WanCameraImageToVideo:
|
|||||||
},
|
},
|
||||||
"optional": {"clip_vision_output": ("CLIP_VISION_OUTPUT", ),
|
"optional": {"clip_vision_output": ("CLIP_VISION_OUTPUT", ),
|
||||||
"start_image": ("IMAGE", ),
|
"start_image": ("IMAGE", ),
|
||||||
|
"camera_conditions": ("WAN_CAMERA_EMBEDDING", ),
|
||||||
}}
|
}}
|
||||||
|
|
||||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT")
|
RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT")
|
||||||
@ -319,7 +319,7 @@ class WanCameraImageToVideo:
|
|||||||
|
|
||||||
CATEGORY = "conditioning/video_models"
|
CATEGORY = "conditioning/video_models"
|
||||||
|
|
||||||
def encode(self, positive, negative, vae, camera_conditions, width, height, length, batch_size, start_image=None, clip_vision_output=None):
|
def encode(self, positive, negative, vae, width, height, length, batch_size, start_image=None, clip_vision_output=None, camera_conditions=None):
|
||||||
latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device())
|
latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device())
|
||||||
concat_latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device())
|
concat_latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device())
|
||||||
concat_latent = comfy.latent_formats.Wan21().process_out(concat_latent)
|
concat_latent = comfy.latent_formats.Wan21().process_out(concat_latent)
|
||||||
@ -329,8 +329,12 @@ class WanCameraImageToVideo:
|
|||||||
concat_latent_image = vae.encode(start_image[:, :, :, :3])
|
concat_latent_image = vae.encode(start_image[:, :, :, :3])
|
||||||
concat_latent[:,:,:concat_latent_image.shape[2]] = concat_latent_image[:,:,:concat_latent.shape[2]]
|
concat_latent[:,:,:concat_latent_image.shape[2]] = concat_latent_image[:,:,:concat_latent.shape[2]]
|
||||||
|
|
||||||
positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent, 'camera_conditions': camera_conditions})
|
positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent})
|
||||||
negative = node_helpers.conditioning_set_values(negative, {"concat_latent_image": concat_latent, 'camera_conditions': camera_conditions})
|
negative = node_helpers.conditioning_set_values(negative, {"concat_latent_image": concat_latent})
|
||||||
|
|
||||||
|
if camera_conditions is not None:
|
||||||
|
positive = node_helpers.conditioning_set_values(positive, {'camera_conditions': camera_conditions})
|
||||||
|
negative = node_helpers.conditioning_set_values(negative, {'camera_conditions': camera_conditions})
|
||||||
|
|
||||||
if clip_vision_output is not None:
|
if clip_vision_output is not None:
|
||||||
positive = node_helpers.conditioning_set_values(positive, {"clip_vision_output": clip_vision_output})
|
positive = node_helpers.conditioning_set_values(positive, {"clip_vision_output": clip_vision_output})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user