mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-31 00:30:21 +08:00
Added a scalable version of ConditioningCombine called ConditioningCombineWeighted
This commit is contained in:
parent
b1a7c9ebf6
commit
68e7f4ec53
18
nodes.py
18
nodes.py
@ -40,6 +40,23 @@ class CLIPTextEncode:
|
|||||||
def encode(self, clip, text):
|
def encode(self, clip, text):
|
||||||
return ([[clip.encode(text), {}]], )
|
return ([[clip.encode(text), {}]], )
|
||||||
|
|
||||||
|
class ConditioningCombineWeighted:
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {"required": {"conditioning_1": ("CONDITIONING", ), "conditioning_2": ("CONDITIONING", ),
|
||||||
|
"conditioning_1_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.1}),
|
||||||
|
"conditioning_2_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.1})
|
||||||
|
}}
|
||||||
|
RETURN_TYPES = ("CONDITIONING",)
|
||||||
|
FUNCTION = "combineWeighted"
|
||||||
|
|
||||||
|
CATEGORY = "conditioning"
|
||||||
|
|
||||||
|
def combineWeighted(self, conditioning_1, conditioning_2, conditioning_1_strength, conditioning_2_strength):
|
||||||
|
output = conditioning_1
|
||||||
|
output[0][0] = (conditioning_1[0][0] * conditioning_1_strength + conditioning_2[0][0] * conditioning_2_strength)/(conditioning_1_strength + conditioning_2_strength)
|
||||||
|
return (output, )
|
||||||
|
|
||||||
class ConditioningCombine:
|
class ConditioningCombine:
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
@ -561,6 +578,7 @@ NODE_CLASS_MAPPINGS = {
|
|||||||
"LoadImage": LoadImage,
|
"LoadImage": LoadImage,
|
||||||
"ImageScale": ImageScale,
|
"ImageScale": ImageScale,
|
||||||
"ConditioningCombine": ConditioningCombine,
|
"ConditioningCombine": ConditioningCombine,
|
||||||
|
"ConditioningCombineWeighted": ConditioningCombineWeighted,
|
||||||
"ConditioningSetArea": ConditioningSetArea,
|
"ConditioningSetArea": ConditioningSetArea,
|
||||||
"KSamplerAdvanced": KSamplerAdvanced,
|
"KSamplerAdvanced": KSamplerAdvanced,
|
||||||
"LatentComposite": LatentComposite,
|
"LatentComposite": LatentComposite,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user