@@ -43,10 +43,14 @@ def INPUT_TYPES(s):
4343 CATEGORY = "conditioning/controlnet"
4444
4545 def apply_inpaint_controlnet (self , positive , negative , control_net , vae , image , mask , strength , start_percent , end_percent ):
46- mask = 1.0 - mask .reshape ((- 1 , 1 , mask .shape [- 2 ], mask .shape [- 1 ]))
47- mask_apply = comfy .utils .common_upscale (mask , image .shape [2 ], image .shape [1 ], "bilinear" , "center" ).round ()
48- image = image * mask_apply .movedim (1 , - 1 ).repeat (1 , 1 , 1 , image .shape [3 ])
49- return self .apply_controlnet (positive , negative , control_net , image , strength , start_percent , end_percent , vae = vae , extra_concat = [mask ])
46+ extra_concat = []
47+ if control_net .concat_mask :
48+ mask = 1.0 - mask .reshape ((- 1 , 1 , mask .shape [- 2 ], mask .shape [- 1 ]))
49+ mask_apply = comfy .utils .common_upscale (mask , image .shape [2 ], image .shape [1 ], "bilinear" , "center" ).round ()
50+ image = image * mask_apply .movedim (1 , - 1 ).repeat (1 , 1 , 1 , image .shape [3 ])
51+ extra_concat = [mask ]
52+
53+ return self .apply_controlnet (positive , negative , control_net , image , strength , start_percent , end_percent , vae = vae , extra_concat = extra_concat )
5054
5155
5256
0 commit comments