Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
fa962e86
Commit
fa962e86
authored
Aug 04, 2023
by
comfyanonymous
Browse files
Make LatentBlend more consistent with other nodes.
parent
11ad6060
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
nodes.py
nodes.py
+12
-13
No files found.
nodes.py
View file @
fa962e86
...
@@ -1059,15 +1059,14 @@ class LatentBlend:
...
@@ -1059,15 +1059,14 @@ class LatentBlend:
@
classmethod
@
classmethod
def
INPUT_TYPES
(
s
):
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
return
{
"required"
:
{
"samples
_a
"
:
(
"LATENT"
,),
"samples
1
"
:
(
"LATENT"
,),
"samples
_b
"
:
(
"LATENT"
,),
"samples
2
"
:
(
"LATENT"
,),
"blend_factor"
:
(
"FLOAT"
,
{
"blend_factor"
:
(
"FLOAT"
,
{
"default"
:
0.5
,
"default"
:
0.5
,
"min"
:
0
,
"min"
:
0
,
"max"
:
1
,
"max"
:
1
,
"step"
:
0.01
"step"
:
0.01
}),
}),
"blend_mode"
:
([
"normal"
],),
}}
}}
RETURN_TYPES
=
(
"LATENT"
,)
RETURN_TYPES
=
(
"LATENT"
,)
...
@@ -1075,19 +1074,19 @@ class LatentBlend:
...
@@ -1075,19 +1074,19 @@ class LatentBlend:
CATEGORY
=
"_for_testing"
CATEGORY
=
"_for_testing"
def
blend
(
self
,
samples
_a
,
samples
_b
,
blend_factor
:
float
,
blend_mode
:
str
):
def
blend
(
self
,
samples
1
,
samples
2
,
blend_factor
:
float
,
blend_mode
:
str
=
"normal"
):
samples_out
=
samples
_a
.
copy
()
samples_out
=
samples
1
.
copy
()
samples
_a
=
samples
_a
[
"samples"
]
samples
1
=
samples
1
[
"samples"
]
samples
_b
=
samples
_b
[
"samples"
]
samples
2
=
samples
2
[
"samples"
]
if
samples
_a
.
shape
!=
samples
_b
.
shape
:
if
samples
1
.
shape
!=
samples
2
.
shape
:
samples
_b
.
permute
(
0
,
3
,
1
,
2
)
samples
2
.
permute
(
0
,
3
,
1
,
2
)
samples
_b
=
comfy
.
utils
.
common_upscale
(
samples
_b
,
samples
_a
.
shape
[
3
],
samples
_a
.
shape
[
2
],
'bicubic'
,
crop
=
'center'
)
samples
2
=
comfy
.
utils
.
common_upscale
(
samples
2
,
samples
1
.
shape
[
3
],
samples
1
.
shape
[
2
],
'bicubic'
,
crop
=
'center'
)
samples
_b
.
permute
(
0
,
2
,
3
,
1
)
samples
2
.
permute
(
0
,
2
,
3
,
1
)
samples_blended
=
self
.
blend_mode
(
samples
_a
,
samples
_b
,
blend_mode
)
samples_blended
=
self
.
blend_mode
(
samples
1
,
samples
2
,
blend_mode
)
samples_blended
=
samples
_a
*
(
1
-
blend_factor
)
+
samples_blended
*
blend_factor
samples_blended
=
samples1
*
blend_factor
+
samples_blended
*
(
1
-
blend_factor
)
samples_out
[
"samples"
]
=
samples_blended
samples_out
[
"samples"
]
=
samples_blended
return
(
samples_out
,)
return
(
samples_out
,)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment