From 476d543fe80b55b696ab87535c28bcccab667bf9 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 15 Apr 2023 10:56:15 -0400 Subject: [PATCH] Fix for older python. from: https://github.com/comfyanonymous/ComfyUI/discussions/476 --- comfy_extras/nodes_mask.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/comfy_extras/nodes_mask.py b/comfy_extras/nodes_mask.py index 4dfb0b93e4d..131cd6a9f3d 100644 --- a/comfy_extras/nodes_mask.py +++ b/comfy_extras/nodes_mask.py @@ -187,13 +187,12 @@ def combine(self, destination, source, x, y, operation): source_portion = source[:visible_height, :visible_width] destination_portion = destination[top:bottom, left:right] - match operation: - case "multiply": - output[top:bottom, left:right] = destination_portion * source_portion - case "add": - output[top:bottom, left:right] = destination_portion + source_portion - case "subtract": - output[top:bottom, left:right] = destination_portion - source_portion + if operation == "multiply": + output[top:bottom, left:right] = destination_portion * source_portion + elif operation == "add": + output[top:bottom, left:right] = destination_portion + source_portion + elif operation == "subtract": + output[top:bottom, left:right] = destination_portion - source_portion output = torch.clamp(output, 0.0, 1.0)