mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-19 02:53:05 +08:00
first commit
This commit is contained in:
parent
3f52e7cbb1
commit
77a6c6c861
24
nodes.py
24
nodes.py
@ -58,6 +58,30 @@ class ConditioningCombine:
|
|||||||
def combine(self, conditioning_1, conditioning_2):
|
def combine(self, conditioning_1, conditioning_2):
|
||||||
return (conditioning_1 + conditioning_2, )
|
return (conditioning_1 + conditioning_2, )
|
||||||
|
|
||||||
|
class ConditioningAddWeighted:
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {"required": {"conditioning_1": ("CONDITIONING", ), "conditioning_2": ("CONDITIONING", ),
|
||||||
|
"conditioning_1_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.1}),
|
||||||
|
"conditioning_2_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.1})
|
||||||
|
}}
|
||||||
|
RETURN_TYPES = ("CONDITIONING",)
|
||||||
|
FUNCTION = "addWeighted"
|
||||||
|
|
||||||
|
CATEGORY = "conditioning"
|
||||||
|
|
||||||
|
|
||||||
|
def addWeighted(self, conditioning_1, conditioning_2, conditioning_1_strength, conditioning_2_strength):
|
||||||
|
conditioning_1_tensor = conditioning_1[0][0]
|
||||||
|
conditioning_2_tensor = conditioning_2[0][0]
|
||||||
|
output = conditioning_1
|
||||||
|
if conditioning_1_tensor.shape[1] > conditioning_2_tensor.shape[1]:
|
||||||
|
conditioning_2_tensor = torch.cat((conditioning_2_tensor, torch.zeros((1,conditioning_1_tensor.shape[1] - conditioning_2_tensor.shape[1],768))), dim=1)
|
||||||
|
elif conditioning_2_tensor.shape[1] > conditioning_1_tensor.shape[1]:
|
||||||
|
conditioning_1_tensor = torch.cat((conditioning_1_tensor, torch.zeros((1,conditioning_2_tensor.shape[1] - conditioning_1_tensor.shape[1],768))), dim=1)
|
||||||
|
output[0][0] = ((conditioning_1_tensor * conditioning_1_strength) + (conditioning_2_tensor * conditioning_2_strength))/(conditioning_1_strength + conditioning_2_strength)
|
||||||
|
return (output, )
|
||||||
|
|
||||||
class ConditioningSetArea:
|
class ConditioningSetArea:
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user