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
80bda6c1
Commit
80bda6c1
authored
Apr 07, 2024
by
comfyanonymous
Browse files
Cleanup a few conditioning nodes.
parent
0a030098
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
27 deletions
+22
-27
node_helpers.py
node_helpers.py
+10
-0
nodes.py
nodes.py
+12
-27
No files found.
node_helpers.py
0 → 100644
View file @
80bda6c1
def
conditioning_set_values
(
conditioning
,
values
=
{}):
c
=
[]
for
t
in
conditioning
:
n
=
[
t
[
0
],
t
[
1
].
copy
()]
for
k
in
values
:
n
[
1
][
k
]
=
values
[
k
]
c
.
append
(
n
)
return
c
nodes.py
View file @
80bda6c1
...
@@ -34,6 +34,7 @@ import importlib
...
@@ -34,6 +34,7 @@ import importlib
import
folder_paths
import
folder_paths
import
latent_preview
import
latent_preview
import
node_helpers
def
before_node_execution
():
def
before_node_execution
():
comfy
.
model_management
.
throw_exception_if_processing_interrupted
()
comfy
.
model_management
.
throw_exception_if_processing_interrupted
()
...
@@ -151,13 +152,9 @@ class ConditioningSetArea:
...
@@ -151,13 +152,9 @@ class ConditioningSetArea:
CATEGORY
=
"conditioning"
CATEGORY
=
"conditioning"
def
append
(
self
,
conditioning
,
width
,
height
,
x
,
y
,
strength
):
def
append
(
self
,
conditioning
,
width
,
height
,
x
,
y
,
strength
):
c
=
[]
c
=
node_helpers
.
conditioning_set_values
(
conditioning
,
{
"area"
:
(
height
//
8
,
width
//
8
,
y
//
8
,
x
//
8
),
for
t
in
conditioning
:
"strength"
:
strength
,
n
=
[
t
[
0
],
t
[
1
].
copy
()]
"set_area_to_bounds"
:
False
})
n
[
1
][
'area'
]
=
(
height
//
8
,
width
//
8
,
y
//
8
,
x
//
8
)
n
[
1
][
'strength'
]
=
strength
n
[
1
][
'set_area_to_bounds'
]
=
False
c
.
append
(
n
)
return
(
c
,
)
return
(
c
,
)
class
ConditioningSetAreaPercentage
:
class
ConditioningSetAreaPercentage
:
...
@@ -176,13 +173,9 @@ class ConditioningSetAreaPercentage:
...
@@ -176,13 +173,9 @@ class ConditioningSetAreaPercentage:
CATEGORY
=
"conditioning"
CATEGORY
=
"conditioning"
def
append
(
self
,
conditioning
,
width
,
height
,
x
,
y
,
strength
):
def
append
(
self
,
conditioning
,
width
,
height
,
x
,
y
,
strength
):
c
=
[]
c
=
node_helpers
.
conditioning_set_values
(
conditioning
,
{
"area"
:
(
"percentage"
,
height
,
width
,
y
,
x
),
for
t
in
conditioning
:
"strength"
:
strength
,
n
=
[
t
[
0
],
t
[
1
].
copy
()]
"set_area_to_bounds"
:
False
})
n
[
1
][
'area'
]
=
(
"percentage"
,
height
,
width
,
y
,
x
)
n
[
1
][
'strength'
]
=
strength
n
[
1
][
'set_area_to_bounds'
]
=
False
c
.
append
(
n
)
return
(
c
,
)
return
(
c
,
)
class
ConditioningSetAreaStrength
:
class
ConditioningSetAreaStrength
:
...
@@ -197,11 +190,7 @@ class ConditioningSetAreaStrength:
...
@@ -197,11 +190,7 @@ class ConditioningSetAreaStrength:
CATEGORY
=
"conditioning"
CATEGORY
=
"conditioning"
def
append
(
self
,
conditioning
,
strength
):
def
append
(
self
,
conditioning
,
strength
):
c
=
[]
c
=
node_helpers
.
conditioning_set_values
(
conditioning
,
{
"strength"
:
strength
})
for
t
in
conditioning
:
n
=
[
t
[
0
],
t
[
1
].
copy
()]
n
[
1
][
'strength'
]
=
strength
c
.
append
(
n
)
return
(
c
,
)
return
(
c
,
)
...
@@ -219,19 +208,15 @@ class ConditioningSetMask:
...
@@ -219,19 +208,15 @@ class ConditioningSetMask:
CATEGORY
=
"conditioning"
CATEGORY
=
"conditioning"
def
append
(
self
,
conditioning
,
mask
,
set_cond_area
,
strength
):
def
append
(
self
,
conditioning
,
mask
,
set_cond_area
,
strength
):
c
=
[]
set_area_to_bounds
=
False
set_area_to_bounds
=
False
if
set_cond_area
!=
"default"
:
if
set_cond_area
!=
"default"
:
set_area_to_bounds
=
True
set_area_to_bounds
=
True
if
len
(
mask
.
shape
)
<
3
:
if
len
(
mask
.
shape
)
<
3
:
mask
=
mask
.
unsqueeze
(
0
)
mask
=
mask
.
unsqueeze
(
0
)
for
t
in
conditioning
:
n
=
[
t
[
0
],
t
[
1
].
copy
()]
c
=
node_helpers
.
conditioning_set_values
(
conditioning
,
{
"mask"
:
mask
,
_
,
h
,
w
=
mask
.
shape
"set_area_to_bounds"
:
set_area_to_bounds
,
n
[
1
][
'mask'
]
=
mask
"mask_strength"
:
strength
})
n
[
1
][
'set_area_to_bounds'
]
=
set_area_to_bounds
n
[
1
][
'mask_strength'
]
=
strength
c
.
append
(
n
)
return
(
c
,
)
return
(
c
,
)
class
ConditioningZeroOut
:
class
ConditioningZeroOut
:
...
...
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