Bigger combine nodes...

...until I figure out how to create this dynamically
This commit is contained in:
kijai 2023-10-11 00:34:15 +03:00
parent 510d1e237e
commit 75373f0219

View File

@ -616,12 +616,108 @@ class ConditioningSetMaskAndCombine3:
c2.append(n)
return (c, c2)
class ConditioningSetMaskAndCombine4:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"positive_1": ("CONDITIONING", ),
"negative_1": ("CONDITIONING", ),
"positive_2": ("CONDITIONING", ),
"negative_2": ("CONDITIONING", ),
"positive_3": ("CONDITIONING", ),
"negative_3": ("CONDITIONING", ),
"mask_1": ("MASK", ),
"mask_2": ("MASK", ),
"mask_3": ("MASK", ),
"strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
"set_cond_area": (["default", "mask bounds"],),
}
}
RETURN_TYPES = ("CONDITIONING","CONDITIONING",)
RETURN_NAMES = ("combined_positive", "combined_negative",)
FUNCTION = "append"
CATEGORY = "KJNodes"
def append(self, positive_1, negative_1, positive_2, positive_3, positive_4, negative_2, negative_3, negative_4,mask_1, mask_2, mask_3, mask_4, set_cond_area, strength):
c = []
c2 = []
set_area_to_bounds = False
if set_cond_area != "default":
set_area_to_bounds = True
if len(mask_1.shape) < 3:
mask_1 = mask_1.unsqueeze(0)
if len(mask_2.shape) < 3:
mask_2 = mask_2.unsqueeze(0)
if len(mask_3.shape) < 3:
mask_3 = mask_3.unsqueeze(0)
if len(mask_4.shape) < 3:
mask_4 = mask_4.unsqueeze(0)
for t in positive_1:
n = [t[0], t[1].copy()]
_, h, w = mask_1.shape
n[1]['mask'] = mask_1
n[1]['set_area_to_bounds'] = set_area_to_bounds
n[1]['mask_strength'] = strength
c.append(n)
for t in positive_2:
n = [t[0], t[1].copy()]
_, h, w = mask_2.shape
n[1]['mask'] = mask_2
n[1]['set_area_to_bounds'] = set_area_to_bounds
n[1]['mask_strength'] = strength
c.append(n)
for t in positive_3:
n = [t[0], t[1].copy()]
_, h, w = mask_3.shape
n[1]['mask'] = mask_3
n[1]['set_area_to_bounds'] = set_area_to_bounds
n[1]['mask_strength'] = strength
c.append(n)
for t in positive_4:
n = [t[0], t[1].copy()]
_, h, w = mask_3.shape
n[1]['mask'] = mask_3
n[1]['set_area_to_bounds'] = set_area_to_bounds
n[1]['mask_strength'] = strength
c.append(n)
for t in negative_1:
n = [t[0], t[1].copy()]
_, h, w = mask_1.shape
n[1]['mask'] = mask_1
n[1]['set_area_to_bounds'] = set_area_to_bounds
n[1]['mask_strength'] = strength
c2.append(n)
for t in negative_2:
n = [t[0], t[1].copy()]
_, h, w = mask_2.shape
n[1]['mask'] = mask_2
n[1]['set_area_to_bounds'] = set_area_to_bounds
n[1]['mask_strength'] = strength
c2.append(n)
for t in negative_3:
n = [t[0], t[1].copy()]
_, h, w = mask_3.shape
n[1]['mask'] = mask_3
n[1]['set_area_to_bounds'] = set_area_to_bounds
n[1]['mask_strength'] = strength
c2.append(n)
for t in negative_4:
n = [t[0], t[1].copy()]
_, h, w = mask_3.shape
n[1]['mask'] = mask_3
n[1]['set_area_to_bounds'] = set_area_to_bounds
n[1]['mask_strength'] = strength
c2.append(n)
return (c, c2)
NODE_CLASS_MAPPINGS = {
"INTConstant": INTConstant,
"ConditioningMultiCombine": ConditioningMultiCombine,
"ConditioningSetMaskAndCombine": ConditioningSetMaskAndCombine,
"ConditioningSetMaskAndCombine3": ConditioningSetMaskAndCombine3,
"ConditioningSetMaskAndCombine4": ConditioningSetMaskAndCombine4,
"GrowMaskWithBlur": GrowMaskWithBlur,
"ColorToMask": ColorToMask,
"CreateGradientMask": CreateGradientMask,
@ -635,6 +731,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"ConditioningMultiCombine": "Conditioning Multi Combine",
"ConditioningSetMaskAndCombine": "ConditioningSetMaskAndCombine",
"ConditioningSetMaskAndCombine3": "ConditioningSetMaskAndCombine3",
"ConditioningSetMaskAndCombine4": "ConditioningSetMaskAndCombine4",
"GrowMaskWithBlur": "GrowMaskWithBlur",
"ColorToMask": "ColorToMask",
"CreateGradientMask": "CreateGradientMask",