2024-07-22 15:27:32 +00:00
|
|
|
from comfy.cldm.control_types import UNION_CONTROLNET_TYPES
|
2024-07-16 21:01:40 +00:00
|
|
|
|
|
|
|
class SetUnionControlNetType:
|
|
|
|
@classmethod
|
|
|
|
def INPUT_TYPES(s):
|
|
|
|
return {"required": {"control_net": ("CONTROL_NET", ),
|
2024-07-22 15:30:38 +00:00
|
|
|
"type": (["auto"] + list(UNION_CONTROLNET_TYPES.keys()),)
|
2024-07-16 21:01:40 +00:00
|
|
|
}}
|
|
|
|
|
2024-07-16 21:08:25 +00:00
|
|
|
CATEGORY = "conditioning/controlnet"
|
2024-07-16 21:01:40 +00:00
|
|
|
RETURN_TYPES = ("CONTROL_NET",)
|
|
|
|
|
|
|
|
FUNCTION = "set_controlnet_type"
|
|
|
|
|
|
|
|
def set_controlnet_type(self, control_net, type):
|
|
|
|
control_net = control_net.copy()
|
2024-07-22 15:30:38 +00:00
|
|
|
type_number = UNION_CONTROLNET_TYPES.get(type, -1)
|
2024-07-16 21:01:40 +00:00
|
|
|
if type_number >= 0:
|
|
|
|
control_net.set_extra_arg("control_type", [type_number])
|
|
|
|
else:
|
|
|
|
control_net.set_extra_arg("control_type", [])
|
|
|
|
|
|
|
|
return (control_net,)
|
|
|
|
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
|
|
"SetUnionControlNetType": SetUnionControlNetType,
|
|
|
|
}
|