HEL-892: document Qwen3-TTS multi-role dialogue reference
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"sha":"b874bd2b8c324d58cfc37bff0754dd16815a8f3c","node_id":"C_kwDOIygeJtoAKGI4NzRiZDJiOGMzMjRkNThjZmMzN2JmZjA3NTRkZDE2ODE1YThmM2M","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/commits/b874bd2b8c324d58cfc37bff0754dd16815a8f3c","html_url":"https://github.com/Comfy-Org/ComfyUI/commit/b874bd2b8c324d58cfc37bff0754dd16815a8f3c","author":{"name":"comfyanonymous","email":"comfyanonymous@protonmail.com","date":"2026-02-24T17:37:16Z"},"committer":{"name":"comfyanonymous","email":"comfyanonymous@protonmail.com","date":"2026-02-24T17:42:15Z"},"tree":{"sha":"7b8179ffb38c06974fcd9f5c127b3e943893c6f5","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/trees/7b8179ffb38c06974fcd9f5c127b3e943893c6f5"},"message":"ComfyUI v0.15.0","parents":[{"sha":"0aa02453bbe7d2fac332e829ade1f13a1cf53820","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/commits/0aa02453bbe7d2fac332e829ade1f13a1cf53820","html_url":"https://github.com/Comfy-Org/ComfyUI/commit/0aa02453bbe7d2fac332e829ade1f13a1cf53820"}],"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null,"verified_at":null}}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,475 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import random
|
||||
import uuid
|
||||
from io import BytesIO
|
||||
|
||||
import av
|
||||
import numpy as np
|
||||
import torch
|
||||
try:
|
||||
import torchaudio
|
||||
TORCH_AUDIO_AVAILABLE = True
|
||||
except:
|
||||
TORCH_AUDIO_AVAILABLE = False
|
||||
from PIL import Image as PILImage
|
||||
from PIL.PngImagePlugin import PngInfo
|
||||
|
||||
import folder_paths
|
||||
|
||||
# used for image preview
|
||||
from comfy.cli_args import args
|
||||
from ._io import ComfyNode, FolderType, Image, _UIOutput
|
||||
|
||||
|
||||
class SavedResult(dict):
|
||||
def __init__(self, filename: str, subfolder: str, type: FolderType):
|
||||
super().__init__(filename=filename, subfolder=subfolder,type=type.value)
|
||||
|
||||
@property
|
||||
def filename(self) -> str:
|
||||
return self["filename"]
|
||||
|
||||
@property
|
||||
def subfolder(self) -> str:
|
||||
return self["subfolder"]
|
||||
|
||||
@property
|
||||
def type(self) -> FolderType:
|
||||
return FolderType(self["type"])
|
||||
|
||||
|
||||
class SavedImages(_UIOutput):
|
||||
"""A UI output class to represent one or more saved images, potentially animated."""
|
||||
def __init__(self, results: list[SavedResult], is_animated: bool = False):
|
||||
super().__init__()
|
||||
self.results = results
|
||||
self.is_animated = is_animated
|
||||
|
||||
def as_dict(self) -> dict:
|
||||
data = {"images": self.results}
|
||||
if self.is_animated:
|
||||
data["animated"] = (True,)
|
||||
return data
|
||||
|
||||
|
||||
class SavedAudios(_UIOutput):
|
||||
"""UI wrapper around one or more audio files on disk (FLAC / MP3 / Opus)."""
|
||||
def __init__(self, results: list[SavedResult]):
|
||||
super().__init__()
|
||||
self.results = results
|
||||
|
||||
def as_dict(self) -> dict:
|
||||
return {"audio": self.results}
|
||||
|
||||
|
||||
def _get_directory_by_folder_type(folder_type: FolderType) -> str:
|
||||
if folder_type == FolderType.input:
|
||||
return folder_paths.get_input_directory()
|
||||
if folder_type == FolderType.output:
|
||||
return folder_paths.get_output_directory()
|
||||
return folder_paths.get_temp_directory()
|
||||
|
||||
|
||||
class ImageSaveHelper:
|
||||
"""A helper class with static methods to handle image saving and metadata."""
|
||||
|
||||
@staticmethod
|
||||
def _convert_tensor_to_pil(image_tensor: torch.Tensor) -> PILImage.Image:
|
||||
"""Converts a single torch tensor to a PIL Image."""
|
||||
return PILImage.fromarray(np.clip(255.0 * image_tensor.cpu().numpy(), 0, 255).astype(np.uint8))
|
||||
|
||||
@staticmethod
|
||||
def _create_png_metadata(cls: type[ComfyNode] | None) -> PngInfo | None:
|
||||
"""Creates a PngInfo object with prompt and extra_pnginfo."""
|
||||
if args.disable_metadata or cls is None or not cls.hidden:
|
||||
return None
|
||||
metadata = PngInfo()
|
||||
if cls.hidden.prompt:
|
||||
metadata.add_text("prompt", json.dumps(cls.hidden.prompt))
|
||||
if cls.hidden.extra_pnginfo:
|
||||
for x in cls.hidden.extra_pnginfo:
|
||||
metadata.add_text(x, json.dumps(cls.hidden.extra_pnginfo[x]))
|
||||
return metadata
|
||||
|
||||
@staticmethod
|
||||
def _create_animated_png_metadata(cls: type[ComfyNode] | None) -> PngInfo | None:
|
||||
"""Creates a PngInfo object with prompt and extra_pnginfo for animated PNGs (APNG)."""
|
||||
if args.disable_metadata or cls is None or not cls.hidden:
|
||||
return None
|
||||
metadata = PngInfo()
|
||||
if cls.hidden.prompt:
|
||||
metadata.add(
|
||||
b"comf",
|
||||
"prompt".encode("latin-1", "strict")
|
||||
+ b"\0"
|
||||
+ json.dumps(cls.hidden.prompt).encode("latin-1", "strict"),
|
||||
after_idat=True,
|
||||
)
|
||||
if cls.hidden.extra_pnginfo:
|
||||
for x in cls.hidden.extra_pnginfo:
|
||||
metadata.add(
|
||||
b"comf",
|
||||
x.encode("latin-1", "strict")
|
||||
+ b"\0"
|
||||
+ json.dumps(cls.hidden.extra_pnginfo[x]).encode("latin-1", "strict"),
|
||||
after_idat=True,
|
||||
)
|
||||
return metadata
|
||||
|
||||
@staticmethod
|
||||
def _create_webp_metadata(pil_image: PILImage.Image, cls: type[ComfyNode] | None) -> PILImage.Exif:
|
||||
"""Creates EXIF metadata bytes for WebP images."""
|
||||
exif_data = pil_image.getexif()
|
||||
if args.disable_metadata or cls is None or cls.hidden is None:
|
||||
return exif_data
|
||||
if cls.hidden.prompt is not None:
|
||||
exif_data[0x0110] = "prompt:{}".format(json.dumps(cls.hidden.prompt)) # EXIF 0x0110 = Model
|
||||
if cls.hidden.extra_pnginfo is not None:
|
||||
inital_exif_tag = 0x010F # EXIF 0x010f = Make
|
||||
for key, value in cls.hidden.extra_pnginfo.items():
|
||||
exif_data[inital_exif_tag] = "{}:{}".format(key, json.dumps(value))
|
||||
inital_exif_tag -= 1
|
||||
return exif_data
|
||||
|
||||
@staticmethod
|
||||
def save_images(
|
||||
images, filename_prefix: str, folder_type: FolderType, cls: type[ComfyNode] | None, compress_level = 4,
|
||||
) -> list[SavedResult]:
|
||||
"""Saves a batch of images as individual PNG files."""
|
||||
full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
|
||||
filename_prefix, _get_directory_by_folder_type(folder_type), images[0].shape[1], images[0].shape[0]
|
||||
)
|
||||
results = []
|
||||
metadata = ImageSaveHelper._create_png_metadata(cls)
|
||||
for batch_number, image_tensor in enumerate(images):
|
||||
img = ImageSaveHelper._convert_tensor_to_pil(image_tensor)
|
||||
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
|
||||
file = f"{filename_with_batch_num}_{counter:05}_.png"
|
||||
img.save(os.path.join(full_output_folder, file), pnginfo=metadata, compress_level=compress_level)
|
||||
results.append(SavedResult(file, subfolder, folder_type))
|
||||
counter += 1
|
||||
return results
|
||||
|
||||
@staticmethod
|
||||
def get_save_images_ui(images, filename_prefix: str, cls: type[ComfyNode] | None, compress_level=4) -> SavedImages:
|
||||
"""Saves a batch of images and returns a UI object for the node output."""
|
||||
return SavedImages(
|
||||
ImageSaveHelper.save_images(
|
||||
images,
|
||||
filename_prefix=filename_prefix,
|
||||
folder_type=FolderType.output,
|
||||
cls=cls,
|
||||
compress_level=compress_level,
|
||||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def save_animated_png(
|
||||
images, filename_prefix: str, folder_type: FolderType, cls: type[ComfyNode] | None, fps: float, compress_level: int
|
||||
) -> SavedResult:
|
||||
"""Saves a batch of images as a single animated PNG."""
|
||||
full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
|
||||
filename_prefix, _get_directory_by_folder_type(folder_type), images[0].shape[1], images[0].shape[0]
|
||||
)
|
||||
pil_images = [ImageSaveHelper._convert_tensor_to_pil(img) for img in images]
|
||||
metadata = ImageSaveHelper._create_animated_png_metadata(cls)
|
||||
file = f"{filename}_{counter:05}_.png"
|
||||
save_path = os.path.join(full_output_folder, file)
|
||||
pil_images[0].save(
|
||||
save_path,
|
||||
pnginfo=metadata,
|
||||
compress_level=compress_level,
|
||||
save_all=True,
|
||||
duration=int(1000.0 / fps),
|
||||
append_images=pil_images[1:],
|
||||
)
|
||||
return SavedResult(file, subfolder, folder_type)
|
||||
|
||||
@staticmethod
|
||||
def get_save_animated_png_ui(
|
||||
images, filename_prefix: str, cls: type[ComfyNode] | None, fps: float, compress_level: int
|
||||
) -> SavedImages:
|
||||
"""Saves an animated PNG and returns a UI object for the node output."""
|
||||
result = ImageSaveHelper.save_animated_png(
|
||||
images,
|
||||
filename_prefix=filename_prefix,
|
||||
folder_type=FolderType.output,
|
||||
cls=cls,
|
||||
fps=fps,
|
||||
compress_level=compress_level,
|
||||
)
|
||||
return SavedImages([result], is_animated=len(images) > 1)
|
||||
|
||||
@staticmethod
|
||||
def save_animated_webp(
|
||||
images,
|
||||
filename_prefix: str,
|
||||
folder_type: FolderType,
|
||||
cls: type[ComfyNode] | None,
|
||||
fps: float,
|
||||
lossless: bool,
|
||||
quality: int,
|
||||
method: int,
|
||||
) -> SavedResult:
|
||||
"""Saves a batch of images as a single animated WebP."""
|
||||
full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
|
||||
filename_prefix, _get_directory_by_folder_type(folder_type), images[0].shape[1], images[0].shape[0]
|
||||
)
|
||||
pil_images = [ImageSaveHelper._convert_tensor_to_pil(img) for img in images]
|
||||
pil_exif = ImageSaveHelper._create_webp_metadata(pil_images[0], cls)
|
||||
file = f"{filename}_{counter:05}_.webp"
|
||||
pil_images[0].save(
|
||||
os.path.join(full_output_folder, file),
|
||||
save_all=True,
|
||||
duration=int(1000.0 / fps),
|
||||
append_images=pil_images[1:],
|
||||
exif=pil_exif,
|
||||
lossless=lossless,
|
||||
quality=quality,
|
||||
method=method,
|
||||
)
|
||||
return SavedResult(file, subfolder, folder_type)
|
||||
|
||||
@staticmethod
|
||||
def get_save_animated_webp_ui(
|
||||
images,
|
||||
filename_prefix: str,
|
||||
cls: type[ComfyNode] | None,
|
||||
fps: float,
|
||||
lossless: bool,
|
||||
quality: int,
|
||||
method: int,
|
||||
) -> SavedImages:
|
||||
"""Saves an animated WebP and returns a UI object for the node output."""
|
||||
result = ImageSaveHelper.save_animated_webp(
|
||||
images,
|
||||
filename_prefix=filename_prefix,
|
||||
folder_type=FolderType.output,
|
||||
cls=cls,
|
||||
fps=fps,
|
||||
lossless=lossless,
|
||||
quality=quality,
|
||||
method=method,
|
||||
)
|
||||
return SavedImages([result], is_animated=len(images) > 1)
|
||||
|
||||
|
||||
class AudioSaveHelper:
|
||||
"""A helper class with static methods to handle audio saving and metadata."""
|
||||
_OPUS_RATES = [8000, 12000, 16000, 24000, 48000]
|
||||
|
||||
@staticmethod
|
||||
def save_audio(
|
||||
audio: dict,
|
||||
filename_prefix: str,
|
||||
folder_type: FolderType,
|
||||
cls: type[ComfyNode] | None,
|
||||
format: str = "flac",
|
||||
quality: str = "128k",
|
||||
) -> list[SavedResult]:
|
||||
full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
|
||||
filename_prefix, _get_directory_by_folder_type(folder_type)
|
||||
)
|
||||
|
||||
metadata = {}
|
||||
if not args.disable_metadata and cls is not None:
|
||||
if cls.hidden.prompt is not None:
|
||||
metadata["prompt"] = json.dumps(cls.hidden.prompt)
|
||||
if cls.hidden.extra_pnginfo is not None:
|
||||
for x in cls.hidden.extra_pnginfo:
|
||||
metadata[x] = json.dumps(cls.hidden.extra_pnginfo[x])
|
||||
|
||||
results = []
|
||||
for batch_number, waveform in enumerate(audio["waveform"].cpu()):
|
||||
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
|
||||
file = f"{filename_with_batch_num}_{counter:05}_.{format}"
|
||||
output_path = os.path.join(full_output_folder, file)
|
||||
|
||||
# Use original sample rate initially
|
||||
sample_rate = audio["sample_rate"]
|
||||
|
||||
# Handle Opus sample rate requirements
|
||||
if format == "opus":
|
||||
if sample_rate > 48000:
|
||||
sample_rate = 48000
|
||||
elif sample_rate not in AudioSaveHelper._OPUS_RATES:
|
||||
# Find the next highest supported rate
|
||||
for rate in sorted(AudioSaveHelper._OPUS_RATES):
|
||||
if rate > sample_rate:
|
||||
sample_rate = rate
|
||||
break
|
||||
if sample_rate not in AudioSaveHelper._OPUS_RATES: # Fallback if still not supported
|
||||
sample_rate = 48000
|
||||
|
||||
# Resample if necessary
|
||||
if sample_rate != audio["sample_rate"]:
|
||||
if not TORCH_AUDIO_AVAILABLE:
|
||||
raise Exception("torchaudio is not available; cannot resample audio.")
|
||||
waveform = torchaudio.functional.resample(waveform, audio["sample_rate"], sample_rate)
|
||||
|
||||
# Create output with specified format
|
||||
output_buffer = BytesIO()
|
||||
output_container = av.open(output_buffer, mode="w", format=format)
|
||||
|
||||
# Set metadata on the container
|
||||
for key, value in metadata.items():
|
||||
output_container.metadata[key] = value
|
||||
|
||||
layout = "mono" if waveform.shape[0] == 1 else "stereo"
|
||||
# Set up the output stream with appropriate properties
|
||||
if format == "opus":
|
||||
out_stream = output_container.add_stream("libopus", rate=sample_rate, layout=layout)
|
||||
if quality == "64k":
|
||||
out_stream.bit_rate = 64000
|
||||
elif quality == "96k":
|
||||
out_stream.bit_rate = 96000
|
||||
elif quality == "128k":
|
||||
out_stream.bit_rate = 128000
|
||||
elif quality == "192k":
|
||||
out_stream.bit_rate = 192000
|
||||
elif quality == "320k":
|
||||
out_stream.bit_rate = 320000
|
||||
elif format == "mp3":
|
||||
out_stream = output_container.add_stream("libmp3lame", rate=sample_rate, layout=layout)
|
||||
if quality == "V0":
|
||||
# TODO i would really love to support V3 and V5 but there doesn't seem to be a way to set the qscale level, the property below is a bool
|
||||
out_stream.codec_context.qscale = 1
|
||||
elif quality == "128k":
|
||||
out_stream.bit_rate = 128000
|
||||
elif quality == "320k":
|
||||
out_stream.bit_rate = 320000
|
||||
else: # format == "flac":
|
||||
out_stream = output_container.add_stream("flac", rate=sample_rate, layout=layout)
|
||||
|
||||
frame = av.AudioFrame.from_ndarray(
|
||||
waveform.movedim(0, 1).reshape(1, -1).float().numpy(),
|
||||
format="flt",
|
||||
layout=layout,
|
||||
)
|
||||
frame.sample_rate = sample_rate
|
||||
frame.pts = 0
|
||||
output_container.mux(out_stream.encode(frame))
|
||||
|
||||
# Flush encoder
|
||||
output_container.mux(out_stream.encode(None))
|
||||
|
||||
# Close containers
|
||||
output_container.close()
|
||||
|
||||
# Write the output to file
|
||||
output_buffer.seek(0)
|
||||
with open(output_path, "wb") as f:
|
||||
f.write(output_buffer.getbuffer())
|
||||
|
||||
results.append(SavedResult(file, subfolder, folder_type))
|
||||
counter += 1
|
||||
|
||||
return results
|
||||
|
||||
@staticmethod
|
||||
def get_save_audio_ui(
|
||||
audio, filename_prefix: str, cls: type[ComfyNode] | None, format: str = "flac", quality: str = "128k",
|
||||
) -> SavedAudios:
|
||||
"""Save and instantly wrap for UI."""
|
||||
return SavedAudios(
|
||||
AudioSaveHelper.save_audio(
|
||||
audio,
|
||||
filename_prefix=filename_prefix,
|
||||
folder_type=FolderType.output,
|
||||
cls=cls,
|
||||
format=format,
|
||||
quality=quality,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class PreviewImage(_UIOutput):
|
||||
def __init__(self, image: Image.Type, animated: bool = False, cls: type[ComfyNode] = None, **kwargs):
|
||||
self.values = ImageSaveHelper.save_images(
|
||||
image,
|
||||
filename_prefix="ComfyUI_temp_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for _ in range(5)),
|
||||
folder_type=FolderType.temp,
|
||||
cls=cls,
|
||||
compress_level=1,
|
||||
)
|
||||
self.animated = animated
|
||||
|
||||
def as_dict(self):
|
||||
return {
|
||||
"images": self.values,
|
||||
"animated": (self.animated,)
|
||||
}
|
||||
|
||||
|
||||
class PreviewMask(PreviewImage):
|
||||
def __init__(self, mask: PreviewMask.Type, animated: bool=False, cls: ComfyNode=None, **kwargs):
|
||||
preview = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3)
|
||||
super().__init__(preview, animated, cls, **kwargs)
|
||||
|
||||
|
||||
class PreviewAudio(_UIOutput):
|
||||
def __init__(self, audio: dict, cls: type[ComfyNode] = None, **kwargs):
|
||||
self.values = AudioSaveHelper.save_audio(
|
||||
audio,
|
||||
filename_prefix="ComfyUI_temp_" + "".join(random.choice("abcdefghijklmnopqrstuvwxyz") for _ in range(5)),
|
||||
folder_type=FolderType.temp,
|
||||
cls=cls,
|
||||
format="flac",
|
||||
quality="128k",
|
||||
)
|
||||
|
||||
def as_dict(self) -> dict:
|
||||
return {"audio": self.values}
|
||||
|
||||
|
||||
class PreviewVideo(_UIOutput):
|
||||
def __init__(self, values: list[SavedResult | dict], **kwargs):
|
||||
self.values = values
|
||||
|
||||
def as_dict(self):
|
||||
return {"images": self.values, "animated": (True,)}
|
||||
|
||||
|
||||
class PreviewUI3D(_UIOutput):
|
||||
def __init__(self, model_file, camera_info, **kwargs):
|
||||
self.model_file = model_file
|
||||
self.camera_info = camera_info
|
||||
self.bg_image_path = None
|
||||
bg_image = kwargs.get("bg_image", None)
|
||||
if bg_image is not None:
|
||||
img_array = (bg_image[0].cpu().numpy() * 255).astype(np.uint8)
|
||||
img = PILImage.fromarray(img_array)
|
||||
temp_dir = folder_paths.get_temp_directory()
|
||||
filename = f"bg_{uuid.uuid4().hex}.png"
|
||||
bg_image_path = os.path.join(temp_dir, filename)
|
||||
img.save(bg_image_path, compress_level=1)
|
||||
self.bg_image_path = f"temp/{filename}"
|
||||
|
||||
def as_dict(self):
|
||||
return {"result": [self.model_file, self.camera_info, self.bg_image_path]}
|
||||
|
||||
|
||||
class PreviewText(_UIOutput):
|
||||
def __init__(self, value: str, **kwargs):
|
||||
self.value = value
|
||||
|
||||
def as_dict(self):
|
||||
return {"text": (self.value,)}
|
||||
|
||||
|
||||
__all__ = [
|
||||
"SavedResult",
|
||||
"SavedImages",
|
||||
"SavedAudios",
|
||||
"ImageSaveHelper",
|
||||
"AudioSaveHelper",
|
||||
"PreviewImage",
|
||||
"PreviewMask",
|
||||
"PreviewAudio",
|
||||
"PreviewVideo",
|
||||
"PreviewUI3D",
|
||||
"PreviewText",
|
||||
]
|
||||
@@ -0,0 +1,792 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import av
|
||||
import torchaudio
|
||||
import torch
|
||||
import comfy.model_management
|
||||
import folder_paths
|
||||
import os
|
||||
import hashlib
|
||||
import node_helpers
|
||||
import logging
|
||||
from typing_extensions import override
|
||||
from comfy_api.latest import ComfyExtension, IO, UI
|
||||
|
||||
class EmptyLatentAudio(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="EmptyLatentAudio",
|
||||
display_name="Empty Latent Audio",
|
||||
category="latent/audio",
|
||||
inputs=[
|
||||
IO.Float.Input("seconds", default=47.6, min=1.0, max=1000.0, step=0.1),
|
||||
IO.Int.Input(
|
||||
"batch_size", default=1, min=1, max=4096, tooltip="The number of latent images in the batch.",
|
||||
),
|
||||
],
|
||||
outputs=[IO.Latent.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, seconds, batch_size) -> IO.NodeOutput:
|
||||
length = round((seconds * 44100 / 2048) / 2) * 2
|
||||
latent = torch.zeros([batch_size, 64, length], device=comfy.model_management.intermediate_device())
|
||||
return IO.NodeOutput({"samples":latent, "type": "audio"})
|
||||
|
||||
generate = execute # TODO: remove
|
||||
|
||||
|
||||
class ConditioningStableAudio(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="ConditioningStableAudio",
|
||||
category="conditioning",
|
||||
inputs=[
|
||||
IO.Conditioning.Input("positive"),
|
||||
IO.Conditioning.Input("negative"),
|
||||
IO.Float.Input("seconds_start", default=0.0, min=0.0, max=1000.0, step=0.1),
|
||||
IO.Float.Input("seconds_total", default=47.0, min=0.0, max=1000.0, step=0.1),
|
||||
],
|
||||
outputs=[
|
||||
IO.Conditioning.Output(display_name="positive"),
|
||||
IO.Conditioning.Output(display_name="negative"),
|
||||
],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, positive, negative, seconds_start, seconds_total) -> IO.NodeOutput:
|
||||
positive = node_helpers.conditioning_set_values(positive, {"seconds_start": seconds_start, "seconds_total": seconds_total})
|
||||
negative = node_helpers.conditioning_set_values(negative, {"seconds_start": seconds_start, "seconds_total": seconds_total})
|
||||
return IO.NodeOutput(positive, negative)
|
||||
|
||||
append = execute # TODO: remove
|
||||
|
||||
|
||||
class VAEEncodeAudio(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="VAEEncodeAudio",
|
||||
search_aliases=["audio to latent"],
|
||||
display_name="VAE Encode Audio",
|
||||
category="latent/audio",
|
||||
inputs=[
|
||||
IO.Audio.Input("audio"),
|
||||
IO.Vae.Input("vae"),
|
||||
],
|
||||
outputs=[IO.Latent.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, vae, audio) -> IO.NodeOutput:
|
||||
sample_rate = audio["sample_rate"]
|
||||
vae_sample_rate = getattr(vae, "audio_sample_rate", 44100)
|
||||
if vae_sample_rate != sample_rate:
|
||||
waveform = torchaudio.functional.resample(audio["waveform"], sample_rate, vae_sample_rate)
|
||||
else:
|
||||
waveform = audio["waveform"]
|
||||
|
||||
t = vae.encode(waveform.movedim(1, -1))
|
||||
return IO.NodeOutput({"samples": t})
|
||||
|
||||
encode = execute # TODO: remove
|
||||
|
||||
|
||||
def vae_decode_audio(vae, samples, tile=None, overlap=None):
|
||||
if tile is not None:
|
||||
audio = vae.decode_tiled(samples["samples"], tile_y=tile, overlap=overlap).movedim(-1, 1)
|
||||
else:
|
||||
audio = vae.decode(samples["samples"]).movedim(-1, 1)
|
||||
|
||||
std = torch.std(audio, dim=[1, 2], keepdim=True) * 5.0
|
||||
std[std < 1.0] = 1.0
|
||||
audio /= std
|
||||
vae_sample_rate = getattr(vae, "audio_sample_rate", 44100)
|
||||
return {"waveform": audio, "sample_rate": vae_sample_rate if "sample_rate" not in samples else samples["sample_rate"]}
|
||||
|
||||
|
||||
class VAEDecodeAudio(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="VAEDecodeAudio",
|
||||
search_aliases=["latent to audio"],
|
||||
display_name="VAE Decode Audio",
|
||||
category="latent/audio",
|
||||
inputs=[
|
||||
IO.Latent.Input("samples"),
|
||||
IO.Vae.Input("vae"),
|
||||
],
|
||||
outputs=[IO.Audio.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, vae, samples) -> IO.NodeOutput:
|
||||
return IO.NodeOutput(vae_decode_audio(vae, samples))
|
||||
|
||||
decode = execute # TODO: remove
|
||||
|
||||
|
||||
class VAEDecodeAudioTiled(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="VAEDecodeAudioTiled",
|
||||
search_aliases=["latent to audio"],
|
||||
display_name="VAE Decode Audio (Tiled)",
|
||||
category="latent/audio",
|
||||
inputs=[
|
||||
IO.Latent.Input("samples"),
|
||||
IO.Vae.Input("vae"),
|
||||
IO.Int.Input("tile_size", default=512, min=32, max=8192, step=8),
|
||||
IO.Int.Input("overlap", default=64, min=0, max=1024, step=8),
|
||||
],
|
||||
outputs=[IO.Audio.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, vae, samples, tile_size, overlap) -> IO.NodeOutput:
|
||||
return IO.NodeOutput(vae_decode_audio(vae, samples, tile_size, overlap))
|
||||
|
||||
|
||||
class SaveAudio(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="SaveAudio",
|
||||
search_aliases=["export flac"],
|
||||
display_name="Save Audio (FLAC)",
|
||||
category="audio",
|
||||
essentials_category="Audio",
|
||||
inputs=[
|
||||
IO.Audio.Input("audio"),
|
||||
IO.String.Input("filename_prefix", default="audio/ComfyUI"),
|
||||
],
|
||||
hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
|
||||
is_output_node=True,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio, filename_prefix="ComfyUI", format="flac") -> IO.NodeOutput:
|
||||
return IO.NodeOutput(
|
||||
ui=UI.AudioSaveHelper.get_save_audio_ui(audio, filename_prefix=filename_prefix, cls=cls, format=format)
|
||||
)
|
||||
|
||||
save_flac = execute # TODO: remove
|
||||
|
||||
|
||||
class SaveAudioMP3(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="SaveAudioMP3",
|
||||
search_aliases=["export mp3"],
|
||||
display_name="Save Audio (MP3)",
|
||||
category="audio",
|
||||
inputs=[
|
||||
IO.Audio.Input("audio"),
|
||||
IO.String.Input("filename_prefix", default="audio/ComfyUI"),
|
||||
IO.Combo.Input("quality", options=["V0", "128k", "320k"], default="V0"),
|
||||
],
|
||||
hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
|
||||
is_output_node=True,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio, filename_prefix="ComfyUI", format="mp3", quality="128k") -> IO.NodeOutput:
|
||||
return IO.NodeOutput(
|
||||
ui=UI.AudioSaveHelper.get_save_audio_ui(
|
||||
audio, filename_prefix=filename_prefix, cls=cls, format=format, quality=quality
|
||||
)
|
||||
)
|
||||
|
||||
save_mp3 = execute # TODO: remove
|
||||
|
||||
|
||||
class SaveAudioOpus(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="SaveAudioOpus",
|
||||
search_aliases=["export opus"],
|
||||
display_name="Save Audio (Opus)",
|
||||
category="audio",
|
||||
inputs=[
|
||||
IO.Audio.Input("audio"),
|
||||
IO.String.Input("filename_prefix", default="audio/ComfyUI"),
|
||||
IO.Combo.Input("quality", options=["64k", "96k", "128k", "192k", "320k"], default="128k"),
|
||||
],
|
||||
hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
|
||||
is_output_node=True,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio, filename_prefix="ComfyUI", format="opus", quality="V3") -> IO.NodeOutput:
|
||||
return IO.NodeOutput(
|
||||
ui=UI.AudioSaveHelper.get_save_audio_ui(
|
||||
audio, filename_prefix=filename_prefix, cls=cls, format=format, quality=quality
|
||||
)
|
||||
)
|
||||
|
||||
save_opus = execute # TODO: remove
|
||||
|
||||
|
||||
class PreviewAudio(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="PreviewAudio",
|
||||
search_aliases=["play audio"],
|
||||
display_name="Preview Audio",
|
||||
category="audio",
|
||||
inputs=[
|
||||
IO.Audio.Input("audio"),
|
||||
],
|
||||
hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
|
||||
is_output_node=True,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio) -> IO.NodeOutput:
|
||||
return IO.NodeOutput(ui=UI.PreviewAudio(audio, cls=cls))
|
||||
|
||||
save_flac = execute # TODO: remove
|
||||
|
||||
|
||||
def f32_pcm(wav: torch.Tensor) -> torch.Tensor:
|
||||
"""Convert audio to float 32 bits PCM format."""
|
||||
if wav.dtype.is_floating_point:
|
||||
return wav
|
||||
elif wav.dtype == torch.int16:
|
||||
return wav.float() / (2 ** 15)
|
||||
elif wav.dtype == torch.int32:
|
||||
return wav.float() / (2 ** 31)
|
||||
raise ValueError(f"Unsupported wav dtype: {wav.dtype}")
|
||||
|
||||
def load(filepath: str) -> tuple[torch.Tensor, int]:
|
||||
with av.open(filepath) as af:
|
||||
if not af.streams.audio:
|
||||
raise ValueError("No audio stream found in the file.")
|
||||
|
||||
stream = af.streams.audio[0]
|
||||
sr = stream.codec_context.sample_rate
|
||||
n_channels = stream.channels
|
||||
|
||||
frames = []
|
||||
length = 0
|
||||
for frame in af.decode(streams=stream.index):
|
||||
buf = torch.from_numpy(frame.to_ndarray())
|
||||
if buf.shape[0] != n_channels:
|
||||
buf = buf.view(-1, n_channels).t()
|
||||
|
||||
frames.append(buf)
|
||||
length += buf.shape[1]
|
||||
|
||||
if not frames:
|
||||
raise ValueError("No audio frames decoded.")
|
||||
|
||||
wav = torch.cat(frames, dim=1)
|
||||
wav = f32_pcm(wav)
|
||||
return wav, sr
|
||||
|
||||
class LoadAudio(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
input_dir = folder_paths.get_input_directory()
|
||||
files = folder_paths.filter_files_content_types(os.listdir(input_dir), ["audio", "video"])
|
||||
return IO.Schema(
|
||||
node_id="LoadAudio",
|
||||
search_aliases=["import audio", "open audio", "audio file"],
|
||||
display_name="Load Audio",
|
||||
category="audio",
|
||||
essentials_category="Audio",
|
||||
inputs=[
|
||||
IO.Combo.Input("audio", upload=IO.UploadType.audio, options=sorted(files)),
|
||||
],
|
||||
outputs=[IO.Audio.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio) -> IO.NodeOutput:
|
||||
audio_path = folder_paths.get_annotated_filepath(audio)
|
||||
waveform, sample_rate = load(audio_path)
|
||||
audio = {"waveform": waveform.unsqueeze(0), "sample_rate": sample_rate}
|
||||
return IO.NodeOutput(audio)
|
||||
|
||||
@classmethod
|
||||
def fingerprint_inputs(cls, audio):
|
||||
image_path = folder_paths.get_annotated_filepath(audio)
|
||||
m = hashlib.sha256()
|
||||
with open(image_path, 'rb') as f:
|
||||
m.update(f.read())
|
||||
return m.digest().hex()
|
||||
|
||||
@classmethod
|
||||
def validate_inputs(cls, audio):
|
||||
if not folder_paths.exists_annotated_filepath(audio):
|
||||
return "Invalid audio file: {}".format(audio)
|
||||
return True
|
||||
|
||||
load = execute # TODO: remove
|
||||
|
||||
|
||||
class RecordAudio(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="RecordAudio",
|
||||
search_aliases=["microphone input", "audio capture", "voice input"],
|
||||
display_name="Record Audio",
|
||||
category="audio",
|
||||
inputs=[
|
||||
IO.Custom("AUDIO_RECORD").Input("audio"),
|
||||
],
|
||||
outputs=[IO.Audio.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio) -> IO.NodeOutput:
|
||||
audio_path = folder_paths.get_annotated_filepath(audio)
|
||||
|
||||
waveform, sample_rate = load(audio_path)
|
||||
audio = {"waveform": waveform.unsqueeze(0), "sample_rate": sample_rate}
|
||||
return IO.NodeOutput(audio)
|
||||
|
||||
load = execute # TODO: remove
|
||||
|
||||
|
||||
class TrimAudioDuration(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="TrimAudioDuration",
|
||||
search_aliases=["cut audio", "audio clip", "shorten audio"],
|
||||
display_name="Trim Audio Duration",
|
||||
description="Trim audio tensor into chosen time range.",
|
||||
category="audio",
|
||||
inputs=[
|
||||
IO.Audio.Input("audio"),
|
||||
IO.Float.Input(
|
||||
"start_index",
|
||||
default=0.0,
|
||||
min=-0xffffffffffffffff,
|
||||
max=0xffffffffffffffff,
|
||||
step=0.01,
|
||||
tooltip="Start time in seconds, can be negative to count from the end (supports sub-seconds).",
|
||||
),
|
||||
IO.Float.Input(
|
||||
"duration",
|
||||
default=60.0,
|
||||
min=0.0,
|
||||
step=0.01,
|
||||
tooltip="Duration in seconds",
|
||||
),
|
||||
],
|
||||
outputs=[IO.Audio.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio, start_index, duration) -> IO.NodeOutput:
|
||||
waveform = audio["waveform"]
|
||||
sample_rate = audio["sample_rate"]
|
||||
audio_length = waveform.shape[-1]
|
||||
|
||||
if start_index < 0:
|
||||
start_frame = audio_length + int(round(start_index * sample_rate))
|
||||
else:
|
||||
start_frame = int(round(start_index * sample_rate))
|
||||
start_frame = max(0, min(start_frame, audio_length - 1))
|
||||
|
||||
end_frame = start_frame + int(round(duration * sample_rate))
|
||||
end_frame = max(0, min(end_frame, audio_length))
|
||||
|
||||
if start_frame >= end_frame:
|
||||
raise ValueError("AudioTrim: Start time must be less than end time and be within the audio length.")
|
||||
|
||||
return IO.NodeOutput({"waveform": waveform[..., start_frame:end_frame], "sample_rate": sample_rate})
|
||||
|
||||
trim = execute # TODO: remove
|
||||
|
||||
|
||||
class SplitAudioChannels(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="SplitAudioChannels",
|
||||
search_aliases=["stereo to mono"],
|
||||
display_name="Split Audio Channels",
|
||||
description="Separates the audio into left and right channels.",
|
||||
category="audio",
|
||||
inputs=[
|
||||
IO.Audio.Input("audio"),
|
||||
],
|
||||
outputs=[
|
||||
IO.Audio.Output(display_name="left"),
|
||||
IO.Audio.Output(display_name="right"),
|
||||
],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio) -> IO.NodeOutput:
|
||||
waveform = audio["waveform"]
|
||||
sample_rate = audio["sample_rate"]
|
||||
|
||||
if waveform.shape[1] != 2:
|
||||
raise ValueError("AudioSplit: Input audio has only one channel.")
|
||||
|
||||
left_channel = waveform[..., 0:1, :]
|
||||
right_channel = waveform[..., 1:2, :]
|
||||
|
||||
return IO.NodeOutput({"waveform": left_channel, "sample_rate": sample_rate}, {"waveform": right_channel, "sample_rate": sample_rate})
|
||||
|
||||
separate = execute # TODO: remove
|
||||
|
||||
class JoinAudioChannels(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="JoinAudioChannels",
|
||||
display_name="Join Audio Channels",
|
||||
description="Joins left and right mono audio channels into a stereo audio.",
|
||||
category="audio",
|
||||
inputs=[
|
||||
IO.Audio.Input("audio_left"),
|
||||
IO.Audio.Input("audio_right"),
|
||||
],
|
||||
outputs=[
|
||||
IO.Audio.Output(display_name="audio"),
|
||||
],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio_left, audio_right) -> IO.NodeOutput:
|
||||
waveform_left = audio_left["waveform"]
|
||||
sample_rate_left = audio_left["sample_rate"]
|
||||
waveform_right = audio_right["waveform"]
|
||||
sample_rate_right = audio_right["sample_rate"]
|
||||
|
||||
if waveform_left.shape[1] != 1 or waveform_right.shape[1] != 1:
|
||||
raise ValueError("AudioJoin: Both input audios must be mono.")
|
||||
|
||||
# Handle different sample rates by resampling to the higher rate
|
||||
waveform_left, waveform_right, output_sample_rate = match_audio_sample_rates(
|
||||
waveform_left, sample_rate_left, waveform_right, sample_rate_right
|
||||
)
|
||||
|
||||
# Handle different lengths by trimming to the shorter length
|
||||
length_left = waveform_left.shape[-1]
|
||||
length_right = waveform_right.shape[-1]
|
||||
|
||||
if length_left != length_right:
|
||||
min_length = min(length_left, length_right)
|
||||
if length_left > min_length:
|
||||
logging.info(f"JoinAudioChannels: Trimming left channel from {length_left} to {min_length} samples.")
|
||||
waveform_left = waveform_left[..., :min_length]
|
||||
if length_right > min_length:
|
||||
logging.info(f"JoinAudioChannels: Trimming right channel from {length_right} to {min_length} samples.")
|
||||
waveform_right = waveform_right[..., :min_length]
|
||||
|
||||
# Join the channels into stereo
|
||||
left_channel = waveform_left[..., 0:1, :]
|
||||
right_channel = waveform_right[..., 0:1, :]
|
||||
stereo_waveform = torch.cat([left_channel, right_channel], dim=1)
|
||||
|
||||
return IO.NodeOutput({"waveform": stereo_waveform, "sample_rate": output_sample_rate})
|
||||
|
||||
|
||||
def match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2):
|
||||
if sample_rate_1 != sample_rate_2:
|
||||
if sample_rate_1 > sample_rate_2:
|
||||
waveform_2 = torchaudio.functional.resample(waveform_2, sample_rate_2, sample_rate_1)
|
||||
output_sample_rate = sample_rate_1
|
||||
logging.info(f"Resampling audio2 from {sample_rate_2}Hz to {sample_rate_1}Hz for merging.")
|
||||
else:
|
||||
waveform_1 = torchaudio.functional.resample(waveform_1, sample_rate_1, sample_rate_2)
|
||||
output_sample_rate = sample_rate_2
|
||||
logging.info(f"Resampling audio1 from {sample_rate_1}Hz to {sample_rate_2}Hz for merging.")
|
||||
else:
|
||||
output_sample_rate = sample_rate_1
|
||||
return waveform_1, waveform_2, output_sample_rate
|
||||
|
||||
|
||||
class AudioConcat(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="AudioConcat",
|
||||
search_aliases=["join audio", "combine audio", "append audio"],
|
||||
display_name="Audio Concat",
|
||||
description="Concatenates the audio1 to audio2 in the specified direction.",
|
||||
category="audio",
|
||||
inputs=[
|
||||
IO.Audio.Input("audio1"),
|
||||
IO.Audio.Input("audio2"),
|
||||
IO.Combo.Input(
|
||||
"direction",
|
||||
options=['after', 'before'],
|
||||
default="after",
|
||||
tooltip="Whether to append audio2 after or before audio1.",
|
||||
)
|
||||
],
|
||||
outputs=[IO.Audio.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio1, audio2, direction) -> IO.NodeOutput:
|
||||
waveform_1 = audio1["waveform"]
|
||||
waveform_2 = audio2["waveform"]
|
||||
sample_rate_1 = audio1["sample_rate"]
|
||||
sample_rate_2 = audio2["sample_rate"]
|
||||
|
||||
if waveform_1.shape[1] == 1:
|
||||
waveform_1 = waveform_1.repeat(1, 2, 1)
|
||||
logging.info("AudioConcat: Converted mono audio1 to stereo by duplicating the channel.")
|
||||
if waveform_2.shape[1] == 1:
|
||||
waveform_2 = waveform_2.repeat(1, 2, 1)
|
||||
logging.info("AudioConcat: Converted mono audio2 to stereo by duplicating the channel.")
|
||||
|
||||
waveform_1, waveform_2, output_sample_rate = match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2)
|
||||
|
||||
if direction == 'after':
|
||||
concatenated_audio = torch.cat((waveform_1, waveform_2), dim=2)
|
||||
elif direction == 'before':
|
||||
concatenated_audio = torch.cat((waveform_2, waveform_1), dim=2)
|
||||
|
||||
return IO.NodeOutput({"waveform": concatenated_audio, "sample_rate": output_sample_rate})
|
||||
|
||||
concat = execute # TODO: remove
|
||||
|
||||
|
||||
class AudioMerge(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="AudioMerge",
|
||||
search_aliases=["mix audio", "overlay audio", "layer audio"],
|
||||
display_name="Audio Merge",
|
||||
description="Combine two audio tracks by overlaying their waveforms.",
|
||||
category="audio",
|
||||
inputs=[
|
||||
IO.Audio.Input("audio1"),
|
||||
IO.Audio.Input("audio2"),
|
||||
IO.Combo.Input(
|
||||
"merge_method",
|
||||
options=["add", "mean", "subtract", "multiply"],
|
||||
tooltip="The method used to combine the audio waveforms.",
|
||||
)
|
||||
],
|
||||
outputs=[IO.Audio.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio1, audio2, merge_method) -> IO.NodeOutput:
|
||||
waveform_1 = audio1["waveform"]
|
||||
waveform_2 = audio2["waveform"]
|
||||
sample_rate_1 = audio1["sample_rate"]
|
||||
sample_rate_2 = audio2["sample_rate"]
|
||||
|
||||
waveform_1, waveform_2, output_sample_rate = match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2)
|
||||
|
||||
length_1 = waveform_1.shape[-1]
|
||||
length_2 = waveform_2.shape[-1]
|
||||
|
||||
if length_2 > length_1:
|
||||
logging.info(f"AudioMerge: Trimming audio2 from {length_2} to {length_1} samples to match audio1 length.")
|
||||
waveform_2 = waveform_2[..., :length_1]
|
||||
elif length_2 < length_1:
|
||||
logging.info(f"AudioMerge: Padding audio2 from {length_2} to {length_1} samples to match audio1 length.")
|
||||
pad_shape = list(waveform_2.shape)
|
||||
pad_shape[-1] = length_1 - length_2
|
||||
pad_tensor = torch.zeros(pad_shape, dtype=waveform_2.dtype, device=waveform_2.device)
|
||||
waveform_2 = torch.cat((waveform_2, pad_tensor), dim=-1)
|
||||
|
||||
if merge_method == "add":
|
||||
waveform = waveform_1 + waveform_2
|
||||
elif merge_method == "subtract":
|
||||
waveform = waveform_1 - waveform_2
|
||||
elif merge_method == "multiply":
|
||||
waveform = waveform_1 * waveform_2
|
||||
elif merge_method == "mean":
|
||||
waveform = (waveform_1 + waveform_2) / 2
|
||||
|
||||
max_val = waveform.abs().max()
|
||||
if max_val > 1.0:
|
||||
waveform = waveform / max_val
|
||||
|
||||
return IO.NodeOutput({"waveform": waveform, "sample_rate": output_sample_rate})
|
||||
|
||||
merge = execute # TODO: remove
|
||||
|
||||
|
||||
class AudioAdjustVolume(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="AudioAdjustVolume",
|
||||
search_aliases=["audio gain", "loudness", "audio level"],
|
||||
display_name="Audio Adjust Volume",
|
||||
category="audio",
|
||||
inputs=[
|
||||
IO.Audio.Input("audio"),
|
||||
IO.Int.Input(
|
||||
"volume",
|
||||
default=1,
|
||||
min=-100,
|
||||
max=100,
|
||||
tooltip="Volume adjustment in decibels (dB). 0 = no change, +6 = double, -6 = half, etc",
|
||||
)
|
||||
],
|
||||
outputs=[IO.Audio.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio, volume) -> IO.NodeOutput:
|
||||
if volume == 0:
|
||||
return IO.NodeOutput(audio)
|
||||
waveform = audio["waveform"]
|
||||
sample_rate = audio["sample_rate"]
|
||||
|
||||
gain = 10 ** (volume / 20)
|
||||
waveform = waveform * gain
|
||||
|
||||
return IO.NodeOutput({"waveform": waveform, "sample_rate": sample_rate})
|
||||
|
||||
adjust_volume = execute # TODO: remove
|
||||
|
||||
|
||||
class EmptyAudio(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="EmptyAudio",
|
||||
search_aliases=["blank audio"],
|
||||
display_name="Empty Audio",
|
||||
category="audio",
|
||||
inputs=[
|
||||
IO.Float.Input(
|
||||
"duration",
|
||||
default=60.0,
|
||||
min=0.0,
|
||||
max=0xffffffffffffffff,
|
||||
step=0.01,
|
||||
tooltip="Duration of the empty audio clip in seconds",
|
||||
),
|
||||
IO.Int.Input(
|
||||
"sample_rate",
|
||||
default=44100,
|
||||
tooltip="Sample rate of the empty audio clip.",
|
||||
min=1,
|
||||
max=192000,
|
||||
advanced=True,
|
||||
),
|
||||
IO.Int.Input(
|
||||
"channels",
|
||||
default=2,
|
||||
min=1,
|
||||
max=2,
|
||||
tooltip="Number of audio channels (1 for mono, 2 for stereo).",
|
||||
advanced=True,
|
||||
),
|
||||
],
|
||||
outputs=[IO.Audio.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, duration, sample_rate, channels) -> IO.NodeOutput:
|
||||
num_samples = int(round(duration * sample_rate))
|
||||
waveform = torch.zeros((1, channels, num_samples), dtype=torch.float32)
|
||||
return IO.NodeOutput({"waveform": waveform, "sample_rate": sample_rate})
|
||||
|
||||
create_empty_audio = execute # TODO: remove
|
||||
|
||||
|
||||
class AudioEqualizer3Band(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="AudioEqualizer3Band",
|
||||
search_aliases=["eq", "bass boost", "treble boost", "equalizer"],
|
||||
display_name="Audio Equalizer (3-Band)",
|
||||
category="audio",
|
||||
is_experimental=True,
|
||||
inputs=[
|
||||
IO.Audio.Input("audio"),
|
||||
IO.Float.Input("low_gain_dB", default=0.0, min=-24.0, max=24.0, step=0.1, tooltip="Gain for Low frequencies (Bass)"),
|
||||
IO.Int.Input("low_freq", default=100, min=20, max=500, tooltip="Cutoff frequency for Low shelf"),
|
||||
IO.Float.Input("mid_gain_dB", default=0.0, min=-24.0, max=24.0, step=0.1, tooltip="Gain for Mid frequencies"),
|
||||
IO.Int.Input("mid_freq", default=1000, min=200, max=4000, tooltip="Center frequency for Mids"),
|
||||
IO.Float.Input("mid_q", default=0.707, min=0.1, max=10.0, step=0.1, tooltip="Q factor (bandwidth) for Mids"),
|
||||
IO.Float.Input("high_gain_dB", default=0.0, min=-24.0, max=24.0, step=0.1, tooltip="Gain for High frequencies (Treble)"),
|
||||
IO.Int.Input("high_freq", default=5000, min=1000, max=15000, tooltip="Cutoff frequency for High shelf"),
|
||||
],
|
||||
outputs=[IO.Audio.Output()],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, audio, low_gain_dB, low_freq, mid_gain_dB, mid_freq, mid_q, high_gain_dB, high_freq) -> IO.NodeOutput:
|
||||
waveform = audio["waveform"]
|
||||
sample_rate = audio["sample_rate"]
|
||||
eq_waveform = waveform.clone()
|
||||
|
||||
# 1. Apply Low Shelf (Bass)
|
||||
if low_gain_dB != 0:
|
||||
eq_waveform = torchaudio.functional.bass_biquad(
|
||||
eq_waveform,
|
||||
sample_rate,
|
||||
gain=low_gain_dB,
|
||||
central_freq=float(low_freq),
|
||||
Q=0.707
|
||||
)
|
||||
|
||||
# 2. Apply Peaking EQ (Mids)
|
||||
if mid_gain_dB != 0:
|
||||
eq_waveform = torchaudio.functional.equalizer_biquad(
|
||||
eq_waveform,
|
||||
sample_rate,
|
||||
center_freq=float(mid_freq),
|
||||
gain=mid_gain_dB,
|
||||
Q=mid_q
|
||||
)
|
||||
|
||||
# 3. Apply High Shelf (Treble)
|
||||
if high_gain_dB != 0:
|
||||
eq_waveform = torchaudio.functional.treble_biquad(
|
||||
eq_waveform,
|
||||
sample_rate,
|
||||
gain=high_gain_dB,
|
||||
central_freq=float(high_freq),
|
||||
Q=0.707
|
||||
)
|
||||
|
||||
return IO.NodeOutput({"waveform": eq_waveform, "sample_rate": sample_rate})
|
||||
|
||||
|
||||
class AudioExtension(ComfyExtension):
|
||||
@override
|
||||
async def get_node_list(self) -> list[type[IO.ComfyNode]]:
|
||||
return [
|
||||
EmptyLatentAudio,
|
||||
VAEEncodeAudio,
|
||||
VAEDecodeAudio,
|
||||
VAEDecodeAudioTiled,
|
||||
SaveAudio,
|
||||
SaveAudioMP3,
|
||||
SaveAudioOpus,
|
||||
LoadAudio,
|
||||
PreviewAudio,
|
||||
ConditioningStableAudio,
|
||||
RecordAudio,
|
||||
TrimAudioDuration,
|
||||
SplitAudioChannels,
|
||||
JoinAudioChannels,
|
||||
AudioConcat,
|
||||
AudioMerge,
|
||||
AudioAdjustVolume,
|
||||
EmptyAudio,
|
||||
AudioEqualizer3Band,
|
||||
]
|
||||
|
||||
async def comfy_entrypoint() -> AudioExtension:
|
||||
return AudioExtension()
|
||||
@@ -0,0 +1,44 @@
|
||||
import json
|
||||
from comfy.comfy_types.node_typing import IO
|
||||
|
||||
# Preview Any - original implement from
|
||||
# https://github.com/rgthree/rgthree-comfy/blob/main/py/display_any.py
|
||||
# upstream requested in https://github.com/Kosinkadink/rfcs/blob/main/rfcs/0000-corenodes.md#preview-nodes
|
||||
class PreviewAny():
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {"source": (IO.ANY, {})},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ()
|
||||
FUNCTION = "main"
|
||||
OUTPUT_NODE = True
|
||||
|
||||
CATEGORY = "utils"
|
||||
SEARCH_ALIASES = ["show output", "inspect", "debug", "print value", "show text"]
|
||||
|
||||
def main(self, source=None):
|
||||
value = 'None'
|
||||
if isinstance(source, str):
|
||||
value = source
|
||||
elif isinstance(source, (int, float, bool)):
|
||||
value = str(source)
|
||||
elif source is not None:
|
||||
try:
|
||||
value = json.dumps(source, indent=4)
|
||||
except Exception:
|
||||
try:
|
||||
value = str(source)
|
||||
except Exception:
|
||||
value = 'source exists, but could not be serialized.'
|
||||
|
||||
return {"ui": {"text": (value,)}}
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"PreviewAny": PreviewAny,
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"PreviewAny": "Preview as Text",
|
||||
}
|
||||
@@ -0,0 +1,496 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import time
|
||||
import mimetypes
|
||||
import logging
|
||||
from typing import Literal, List
|
||||
from collections.abc import Collection
|
||||
|
||||
from comfy.cli_args import args
|
||||
|
||||
supported_pt_extensions: set[str] = {'.ckpt', '.pt', '.pt2', '.bin', '.pth', '.safetensors', '.pkl', '.sft'}
|
||||
|
||||
folder_names_and_paths: dict[str, tuple[list[str], set[str]]] = {}
|
||||
|
||||
# --base-directory - Resets all default paths configured in folder_paths with a new base path
|
||||
if args.base_directory:
|
||||
base_path = os.path.abspath(args.base_directory)
|
||||
else:
|
||||
base_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
models_dir = os.path.join(base_path, "models")
|
||||
folder_names_and_paths["checkpoints"] = ([os.path.join(models_dir, "checkpoints")], supported_pt_extensions)
|
||||
folder_names_and_paths["configs"] = ([os.path.join(models_dir, "configs")], [".yaml"])
|
||||
|
||||
folder_names_and_paths["loras"] = ([os.path.join(models_dir, "loras")], supported_pt_extensions)
|
||||
folder_names_and_paths["vae"] = ([os.path.join(models_dir, "vae")], supported_pt_extensions)
|
||||
folder_names_and_paths["text_encoders"] = ([os.path.join(models_dir, "text_encoders"), os.path.join(models_dir, "clip")], supported_pt_extensions)
|
||||
folder_names_and_paths["diffusion_models"] = ([os.path.join(models_dir, "unet"), os.path.join(models_dir, "diffusion_models")], supported_pt_extensions)
|
||||
folder_names_and_paths["clip_vision"] = ([os.path.join(models_dir, "clip_vision")], supported_pt_extensions)
|
||||
folder_names_and_paths["style_models"] = ([os.path.join(models_dir, "style_models")], supported_pt_extensions)
|
||||
folder_names_and_paths["embeddings"] = ([os.path.join(models_dir, "embeddings")], supported_pt_extensions)
|
||||
folder_names_and_paths["diffusers"] = ([os.path.join(models_dir, "diffusers")], ["folder"])
|
||||
folder_names_and_paths["vae_approx"] = ([os.path.join(models_dir, "vae_approx")], supported_pt_extensions)
|
||||
|
||||
folder_names_and_paths["controlnet"] = ([os.path.join(models_dir, "controlnet"), os.path.join(models_dir, "t2i_adapter")], supported_pt_extensions)
|
||||
folder_names_and_paths["gligen"] = ([os.path.join(models_dir, "gligen")], supported_pt_extensions)
|
||||
|
||||
folder_names_and_paths["upscale_models"] = ([os.path.join(models_dir, "upscale_models")], supported_pt_extensions)
|
||||
|
||||
folder_names_and_paths["latent_upscale_models"] = ([os.path.join(models_dir, "latent_upscale_models")], supported_pt_extensions)
|
||||
|
||||
folder_names_and_paths["custom_nodes"] = ([os.path.join(base_path, "custom_nodes")], set())
|
||||
|
||||
folder_names_and_paths["hypernetworks"] = ([os.path.join(models_dir, "hypernetworks")], supported_pt_extensions)
|
||||
|
||||
folder_names_and_paths["photomaker"] = ([os.path.join(models_dir, "photomaker")], supported_pt_extensions)
|
||||
|
||||
folder_names_and_paths["classifiers"] = ([os.path.join(models_dir, "classifiers")], {""})
|
||||
|
||||
folder_names_and_paths["model_patches"] = ([os.path.join(models_dir, "model_patches")], supported_pt_extensions)
|
||||
|
||||
folder_names_and_paths["audio_encoders"] = ([os.path.join(models_dir, "audio_encoders")], supported_pt_extensions)
|
||||
|
||||
output_directory = os.path.join(base_path, "output")
|
||||
temp_directory = os.path.join(base_path, "temp")
|
||||
input_directory = os.path.join(base_path, "input")
|
||||
user_directory = os.path.join(base_path, "user")
|
||||
|
||||
filename_list_cache: dict[str, tuple[list[str], dict[str, float], float]] = {}
|
||||
|
||||
class CacheHelper:
|
||||
"""
|
||||
Helper class for managing file list cache data.
|
||||
"""
|
||||
def __init__(self):
|
||||
self.cache: dict[str, tuple[list[str], dict[str, float], float]] = {}
|
||||
self.active = False
|
||||
|
||||
def get(self, key: str, default=None) -> tuple[list[str], dict[str, float], float]:
|
||||
if not self.active:
|
||||
return default
|
||||
return self.cache.get(key, default)
|
||||
|
||||
def set(self, key: str, value: tuple[list[str], dict[str, float], float]) -> None:
|
||||
if self.active:
|
||||
self.cache[key] = value
|
||||
|
||||
def clear(self):
|
||||
self.cache.clear()
|
||||
|
||||
def __enter__(self):
|
||||
self.active = True
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.active = False
|
||||
self.clear()
|
||||
|
||||
cache_helper = CacheHelper()
|
||||
|
||||
extension_mimetypes_cache = {
|
||||
"webp" : "image",
|
||||
"fbx" : "model",
|
||||
}
|
||||
|
||||
def map_legacy(folder_name: str) -> str:
|
||||
legacy = {"unet": "diffusion_models",
|
||||
"clip": "text_encoders"}
|
||||
return legacy.get(folder_name, folder_name)
|
||||
|
||||
if not os.path.exists(input_directory):
|
||||
try:
|
||||
os.makedirs(input_directory)
|
||||
except:
|
||||
logging.error("Failed to create input directory")
|
||||
|
||||
def set_output_directory(output_dir: str) -> None:
|
||||
global output_directory
|
||||
output_directory = output_dir
|
||||
|
||||
def set_temp_directory(temp_dir: str) -> None:
|
||||
global temp_directory
|
||||
temp_directory = temp_dir
|
||||
|
||||
def set_input_directory(input_dir: str) -> None:
|
||||
global input_directory
|
||||
input_directory = input_dir
|
||||
|
||||
def get_output_directory() -> str:
|
||||
global output_directory
|
||||
return output_directory
|
||||
|
||||
def get_temp_directory() -> str:
|
||||
global temp_directory
|
||||
return temp_directory
|
||||
|
||||
def get_input_directory() -> str:
|
||||
global input_directory
|
||||
return input_directory
|
||||
|
||||
def get_user_directory() -> str:
|
||||
return user_directory
|
||||
|
||||
def set_user_directory(user_dir: str) -> None:
|
||||
global user_directory
|
||||
user_directory = user_dir
|
||||
|
||||
|
||||
# System User Protection - Protects system directories from HTTP endpoint access
|
||||
# System Users are internal-only users that cannot be accessed via HTTP endpoints.
|
||||
# They use the '__' prefix convention (similar to Python's private member convention).
|
||||
SYSTEM_USER_PREFIX = "__"
|
||||
|
||||
|
||||
def get_system_user_directory(name: str = "system") -> str:
|
||||
"""
|
||||
Get the path to a System User directory.
|
||||
|
||||
System User directories (prefixed with '__') are only accessible via internal API,
|
||||
not through HTTP endpoints. Use this for storing system-internal data that
|
||||
should not be exposed to users.
|
||||
|
||||
Args:
|
||||
name: System user name (e.g., "system", "cache"). Must be alphanumeric
|
||||
with underscores allowed, but cannot start with underscore.
|
||||
|
||||
Returns:
|
||||
Absolute path to the system user directory.
|
||||
|
||||
Raises:
|
||||
ValueError: If name is empty, invalid, or starts with underscore.
|
||||
|
||||
Example:
|
||||
>>> get_system_user_directory("cache")
|
||||
'/path/to/user/__cache'
|
||||
"""
|
||||
if not name or not isinstance(name, str):
|
||||
raise ValueError("System user name cannot be empty")
|
||||
if not name.replace("_", "").isalnum():
|
||||
raise ValueError(f"Invalid system user name: '{name}'")
|
||||
if name.startswith("_"):
|
||||
raise ValueError("System user name should not start with underscore")
|
||||
return os.path.join(get_user_directory(), f"{SYSTEM_USER_PREFIX}{name}")
|
||||
|
||||
|
||||
def get_public_user_directory(user_id: str) -> str | None:
|
||||
"""
|
||||
Get the path to a Public User directory for HTTP endpoint access.
|
||||
|
||||
This function provides structural security by returning None for any
|
||||
System User (prefixed with '__'). All HTTP endpoints should use this
|
||||
function instead of directly constructing user paths.
|
||||
|
||||
Args:
|
||||
user_id: User identifier from HTTP request.
|
||||
|
||||
Returns:
|
||||
Absolute path to the user directory, or None if user_id is invalid
|
||||
or refers to a System User.
|
||||
|
||||
Example:
|
||||
>>> get_public_user_directory("default")
|
||||
'/path/to/user/default'
|
||||
>>> get_public_user_directory("__system")
|
||||
None
|
||||
"""
|
||||
if not user_id or not isinstance(user_id, str):
|
||||
return None
|
||||
if user_id.startswith(SYSTEM_USER_PREFIX):
|
||||
return None
|
||||
return os.path.join(get_user_directory(), user_id)
|
||||
|
||||
|
||||
#NOTE: used in http server so don't put folders that should not be accessed remotely
|
||||
def get_directory_by_type(type_name: str) -> str | None:
|
||||
if type_name == "output":
|
||||
return get_output_directory()
|
||||
if type_name == "temp":
|
||||
return get_temp_directory()
|
||||
if type_name == "input":
|
||||
return get_input_directory()
|
||||
return None
|
||||
|
||||
def filter_files_content_types(files: list[str], content_types: List[Literal["image", "video", "audio", "model"]]) -> list[str]:
|
||||
"""
|
||||
Example:
|
||||
files = os.listdir(folder_paths.get_input_directory())
|
||||
videos = filter_files_content_types(files, ["video"])
|
||||
|
||||
Note:
|
||||
- 'model' in MIME context refers to 3D models, not files containing trained weights and parameters
|
||||
"""
|
||||
global extension_mimetypes_cache
|
||||
result = []
|
||||
for file in files:
|
||||
extension = file.split('.')[-1]
|
||||
if extension not in extension_mimetypes_cache:
|
||||
mime_type, _ = mimetypes.guess_type(file, strict=False)
|
||||
if not mime_type:
|
||||
continue
|
||||
content_type = mime_type.split('/')[0]
|
||||
extension_mimetypes_cache[extension] = content_type
|
||||
else:
|
||||
content_type = extension_mimetypes_cache[extension]
|
||||
|
||||
if content_type in content_types:
|
||||
result.append(file)
|
||||
return result
|
||||
|
||||
# determine base_dir rely on annotation if name is 'filename.ext [annotation]' format
|
||||
# otherwise use default_path as base_dir
|
||||
def annotated_filepath(name: str) -> tuple[str, str | None]:
|
||||
if name.endswith("[output]"):
|
||||
base_dir = get_output_directory()
|
||||
name = name[:-9]
|
||||
elif name.endswith("[input]"):
|
||||
base_dir = get_input_directory()
|
||||
name = name[:-8]
|
||||
elif name.endswith("[temp]"):
|
||||
base_dir = get_temp_directory()
|
||||
name = name[:-7]
|
||||
else:
|
||||
return name, None
|
||||
|
||||
return name, base_dir
|
||||
|
||||
|
||||
def get_annotated_filepath(name: str, default_dir: str | None=None) -> str:
|
||||
name, base_dir = annotated_filepath(name)
|
||||
|
||||
if base_dir is None:
|
||||
if default_dir is not None:
|
||||
base_dir = default_dir
|
||||
else:
|
||||
base_dir = get_input_directory() # fallback path
|
||||
|
||||
return os.path.join(base_dir, name)
|
||||
|
||||
|
||||
def exists_annotated_filepath(name) -> bool:
|
||||
name, base_dir = annotated_filepath(name)
|
||||
|
||||
if base_dir is None:
|
||||
base_dir = get_input_directory() # fallback path
|
||||
|
||||
filepath = os.path.join(base_dir, name)
|
||||
return os.path.exists(filepath)
|
||||
|
||||
|
||||
def add_model_folder_path(folder_name: str, full_folder_path: str, is_default: bool = False) -> None:
|
||||
global folder_names_and_paths
|
||||
folder_name = map_legacy(folder_name)
|
||||
if folder_name in folder_names_and_paths:
|
||||
paths, _exts = folder_names_and_paths[folder_name]
|
||||
if full_folder_path in paths:
|
||||
if is_default and paths[0] != full_folder_path:
|
||||
# If the path to the folder is not the first in the list, move it to the beginning.
|
||||
paths.remove(full_folder_path)
|
||||
paths.insert(0, full_folder_path)
|
||||
else:
|
||||
if is_default:
|
||||
paths.insert(0, full_folder_path)
|
||||
else:
|
||||
paths.append(full_folder_path)
|
||||
else:
|
||||
folder_names_and_paths[folder_name] = ([full_folder_path], set())
|
||||
|
||||
def get_folder_paths(folder_name: str) -> list[str]:
|
||||
folder_name = map_legacy(folder_name)
|
||||
return folder_names_and_paths[folder_name][0][:]
|
||||
|
||||
def recursive_search(directory: str, excluded_dir_names: list[str] | None=None) -> tuple[list[str], dict[str, float]]:
|
||||
if not os.path.isdir(directory):
|
||||
return [], {}
|
||||
|
||||
if excluded_dir_names is None:
|
||||
excluded_dir_names = []
|
||||
|
||||
result = []
|
||||
dirs = {}
|
||||
|
||||
# Attempt to add the initial directory to dirs with error handling
|
||||
try:
|
||||
dirs[directory] = os.path.getmtime(directory)
|
||||
except FileNotFoundError:
|
||||
logging.warning(f"Warning: Unable to access {directory}. Skipping this path.")
|
||||
|
||||
logging.debug("recursive file list on directory {}".format(directory))
|
||||
dirpath: str
|
||||
subdirs: list[str]
|
||||
filenames: list[str]
|
||||
|
||||
for dirpath, subdirs, filenames in os.walk(directory, followlinks=True, topdown=True):
|
||||
subdirs[:] = [d for d in subdirs if d not in excluded_dir_names]
|
||||
for file_name in filenames:
|
||||
try:
|
||||
relative_path = os.path.relpath(os.path.join(dirpath, file_name), directory)
|
||||
result.append(relative_path)
|
||||
except:
|
||||
logging.warning(f"Warning: Unable to access {file_name}. Skipping this file.")
|
||||
continue
|
||||
|
||||
for d in subdirs:
|
||||
path: str = os.path.join(dirpath, d)
|
||||
try:
|
||||
dirs[path] = os.path.getmtime(path)
|
||||
except FileNotFoundError:
|
||||
logging.warning(f"Warning: Unable to access {path}. Skipping this path.")
|
||||
continue
|
||||
logging.debug("found {} files".format(len(result)))
|
||||
return result, dirs
|
||||
|
||||
def filter_files_extensions(files: Collection[str], extensions: Collection[str]) -> list[str]:
|
||||
return sorted(list(filter(lambda a: os.path.splitext(a)[-1].lower() in extensions or len(extensions) == 0, files)))
|
||||
|
||||
|
||||
|
||||
def get_full_path(folder_name: str, filename: str) -> str | None:
|
||||
"""
|
||||
Get the full path of a file in a folder, has to be a file
|
||||
"""
|
||||
global folder_names_and_paths
|
||||
folder_name = map_legacy(folder_name)
|
||||
if folder_name not in folder_names_and_paths:
|
||||
return None
|
||||
folders = folder_names_and_paths[folder_name]
|
||||
filename = os.path.relpath(os.path.join("/", filename), "/")
|
||||
for x in folders[0]:
|
||||
full_path = os.path.join(x, filename)
|
||||
if os.path.isfile(full_path):
|
||||
return full_path
|
||||
elif os.path.islink(full_path):
|
||||
logging.warning("WARNING path {} exists but doesn't link anywhere, skipping.".format(full_path))
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def get_full_path_or_raise(folder_name: str, filename: str) -> str:
|
||||
"""
|
||||
Get the full path of a file in a folder, has to be a file
|
||||
"""
|
||||
full_path = get_full_path(folder_name, filename)
|
||||
if full_path is None:
|
||||
raise FileNotFoundError(f"Model in folder '{folder_name}' with filename '{filename}' not found.")
|
||||
return full_path
|
||||
|
||||
|
||||
def get_filename_list_(folder_name: str) -> tuple[list[str], dict[str, float], float]:
|
||||
folder_name = map_legacy(folder_name)
|
||||
global folder_names_and_paths
|
||||
output_list = set()
|
||||
folders = folder_names_and_paths[folder_name]
|
||||
output_folders = {}
|
||||
for x in folders[0]:
|
||||
files, folders_all = recursive_search(x, excluded_dir_names=[".git"])
|
||||
output_list.update(filter_files_extensions(files, folders[1]))
|
||||
output_folders = {**output_folders, **folders_all}
|
||||
|
||||
return sorted(list(output_list)), output_folders, time.perf_counter()
|
||||
|
||||
def cached_filename_list_(folder_name: str) -> tuple[list[str], dict[str, float], float] | None:
|
||||
strong_cache = cache_helper.get(folder_name)
|
||||
if strong_cache is not None:
|
||||
return strong_cache
|
||||
|
||||
global filename_list_cache
|
||||
global folder_names_and_paths
|
||||
folder_name = map_legacy(folder_name)
|
||||
if folder_name not in filename_list_cache:
|
||||
return None
|
||||
out = filename_list_cache[folder_name]
|
||||
|
||||
for x in out[1]:
|
||||
time_modified = out[1][x]
|
||||
folder = x
|
||||
if os.path.getmtime(folder) != time_modified:
|
||||
return None
|
||||
|
||||
folders = folder_names_and_paths[folder_name]
|
||||
for x in folders[0]:
|
||||
if os.path.isdir(x):
|
||||
if x not in out[1]:
|
||||
return None
|
||||
|
||||
return out
|
||||
|
||||
def get_filename_list(folder_name: str) -> list[str]:
|
||||
folder_name = map_legacy(folder_name)
|
||||
out = cached_filename_list_(folder_name)
|
||||
if out is None:
|
||||
out = get_filename_list_(folder_name)
|
||||
global filename_list_cache
|
||||
filename_list_cache[folder_name] = out
|
||||
cache_helper.set(folder_name, out)
|
||||
return list(out[0])
|
||||
|
||||
def get_save_image_path(filename_prefix: str, output_dir: str, image_width=0, image_height=0) -> tuple[str, str, int, str, str]:
|
||||
def map_filename(filename: str) -> tuple[int, str]:
|
||||
prefix_len = len(os.path.basename(filename_prefix))
|
||||
prefix = filename[:prefix_len + 1]
|
||||
try:
|
||||
digits = int(filename[prefix_len + 1:].split('_')[0])
|
||||
except:
|
||||
digits = 0
|
||||
return digits, prefix
|
||||
|
||||
def compute_vars(input: str, image_width: int, image_height: int) -> str:
|
||||
input = input.replace("%width%", str(image_width))
|
||||
input = input.replace("%height%", str(image_height))
|
||||
now = time.localtime()
|
||||
input = input.replace("%year%", str(now.tm_year))
|
||||
input = input.replace("%month%", str(now.tm_mon).zfill(2))
|
||||
input = input.replace("%day%", str(now.tm_mday).zfill(2))
|
||||
input = input.replace("%hour%", str(now.tm_hour).zfill(2))
|
||||
input = input.replace("%minute%", str(now.tm_min).zfill(2))
|
||||
input = input.replace("%second%", str(now.tm_sec).zfill(2))
|
||||
return input
|
||||
|
||||
if "%" in filename_prefix:
|
||||
filename_prefix = compute_vars(filename_prefix, image_width, image_height)
|
||||
|
||||
subfolder = os.path.dirname(os.path.normpath(filename_prefix))
|
||||
filename = os.path.basename(os.path.normpath(filename_prefix))
|
||||
|
||||
full_output_folder = os.path.join(output_dir, subfolder)
|
||||
|
||||
if os.path.commonpath((output_dir, os.path.abspath(full_output_folder))) != output_dir:
|
||||
err = "**** ERROR: Saving image outside the output folder is not allowed." + \
|
||||
"\n full_output_folder: " + os.path.abspath(full_output_folder) + \
|
||||
"\n output_dir: " + output_dir + \
|
||||
"\n commonpath: " + os.path.commonpath((output_dir, os.path.abspath(full_output_folder)))
|
||||
logging.error(err)
|
||||
raise Exception(err)
|
||||
|
||||
try:
|
||||
counter = max(filter(lambda a: os.path.normcase(a[1][:-1]) == os.path.normcase(filename) and a[1][-1] == "_", map(map_filename, os.listdir(full_output_folder))))[0] + 1
|
||||
except ValueError:
|
||||
counter = 1
|
||||
except FileNotFoundError:
|
||||
os.makedirs(full_output_folder, exist_ok=True)
|
||||
counter = 1
|
||||
return full_output_folder, filename, counter, subfolder, filename_prefix
|
||||
|
||||
def get_input_subfolders() -> list[str]:
|
||||
"""Returns a list of all subfolder paths in the input directory, recursively.
|
||||
|
||||
Returns:
|
||||
List of folder paths relative to the input directory, excluding the root directory
|
||||
"""
|
||||
input_dir = get_input_directory()
|
||||
folders = []
|
||||
|
||||
try:
|
||||
if not os.path.exists(input_dir):
|
||||
return []
|
||||
|
||||
for root, dirs, _ in os.walk(input_dir):
|
||||
rel_path = os.path.relpath(root, input_dir)
|
||||
if rel_path != ".": # Only include non-root directories
|
||||
# Normalize path separators to forward slashes
|
||||
folders.append(rel_path.replace(os.sep, '/'))
|
||||
|
||||
return sorted(folders)
|
||||
except FileNotFoundError:
|
||||
return []
|
||||
@@ -0,0 +1 @@
|
||||
{"sha":"d78b780ae43fcf8c6b7c6505e6ffb4584281ceca","node_id":"C_kwDOJtwj39oAKGQ3OGI3ODBhZTQzZmNmOGM2YjdjNjUwNWU2ZmZiNDU4NDI4MWNlY2E","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/commits/d78b780ae43fcf8c6b7c6505e6ffb4584281ceca","html_url":"https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/commit/d78b780ae43fcf8c6b7c6505e6ffb4584281ceca","author":{"name":"Suzie1","email":"7.lyssa@gmail.com","date":"2024-01-24T22:44:09Z"},"committer":{"name":"Suzie1","email":"7.lyssa@gmail.com","date":"2024-01-24T22:44:09Z"},"tree":{"sha":"12c141b4c99138cd6beb2d5197574b9fe264bc74","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/12c141b4c99138cd6beb2d5197574b9fe264bc74"},"message":"version 1.76","parents":[{"sha":"efcdf631d1be8a6cdf7246698ea13eefb7dff7ea","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/commits/efcdf631d1be8a6cdf7246698ea13eefb7dff7ea","html_url":"https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/commit/efcdf631d1be8a6cdf7246698ea13eefb7dff7ea"}],"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null,"verified_at":null}}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,30 @@
|
||||
# By Suzie1 and RockOfFire
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to
|
||||
# deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
"""
|
||||
@author: Suzie1
|
||||
@title: Comfyroll Studio
|
||||
@nickname: Comfyroll Studio
|
||||
@description: 175 custom nodes for artists, designers and animators.
|
||||
"""
|
||||
|
||||
from .node_mappings import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
||||
|
||||
print("------------------------------------------")
|
||||
print("\033[34mComfyroll Studio v1.76 : \033[92m 175 Nodes Loaded\033[0m")
|
||||
print("------------------------------------------")
|
||||
print("** For changes, please see patch notes at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/Patch_Notes.md")
|
||||
print("** For help, please see the wiki at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki")
|
||||
print("------------------------------------------")
|
||||
|
||||
|
||||
@@ -0,0 +1,532 @@
|
||||
try:
|
||||
from .nodes.nodes_core import *
|
||||
from .nodes.nodes_aspect_ratio import *
|
||||
from .nodes.nodes_list import *
|
||||
from .nodes.nodes_lora import *
|
||||
from .nodes.nodes_controlnet import *
|
||||
from .nodes.nodes_pipe import *
|
||||
from .nodes.nodes_sdxl import *
|
||||
from .nodes.nodes_model_merge import *
|
||||
from .nodes.nodes_upscale import *
|
||||
from .nodes.nodes_xygrid import *
|
||||
from .nodes.nodes_legacy import *
|
||||
except ImportError:
|
||||
print("\033[34mComfyroll Studio: \033[92mFailed to load Essential nodes\033[0m")
|
||||
|
||||
try:
|
||||
from .nodes.nodes_graphics_matplot import *
|
||||
from .nodes.nodes_graphics_text import *
|
||||
from .nodes.nodes_graphics_layout import *
|
||||
from .nodes.nodes_graphics_filter import *
|
||||
from .nodes.nodes_graphics_template import *
|
||||
from .nodes.nodes_graphics_pattern import *
|
||||
except ImportError:
|
||||
print("\033[34mComfyroll Studio: \033[92mFailed to load Graphics nodes\033[0m")
|
||||
|
||||
try:
|
||||
from .nodes.nodes_animation_interpolation import *
|
||||
from .nodes.nodes_animation_io import *
|
||||
from .nodes.nodes_animation_prompt import *
|
||||
from .nodes.nodes_animation_schedulers import *
|
||||
from .nodes.nodes_animation_schedules import *
|
||||
from .nodes.nodes_animation_lists import *
|
||||
from .nodes.nodes_animation_utils import *
|
||||
from .nodes.nodes_animation_cyclers import *
|
||||
except ImportError:
|
||||
print("\033[34mComfyroll Studio: \033[92mFailed to load Animation nodes\033[0m")
|
||||
|
||||
try:
|
||||
from .nodes.nodes_utils_logic import *
|
||||
from .nodes.nodes_utils_index import *
|
||||
from .nodes.nodes_utils_conversion import *
|
||||
from .nodes.nodes_utils_random import *
|
||||
from .nodes.nodes_utils_text import *
|
||||
from .nodes.nodes_utils_other import *
|
||||
except ImportError:
|
||||
print("\033[34mComfyroll Studio: \033[92mFailed to load Utility nodes\033[0m")
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
### Core Nodes
|
||||
"CR Image Output": CR_ImageOutput,
|
||||
"CR Latent Batch Size": CR_LatentBatchSize,
|
||||
"CR Conditioning Mixer": CR_ConditioningMixer,
|
||||
"CR Select Model": CR_SelectModel,
|
||||
"CR Seed": CR_Seed,
|
||||
"CR Prompt Text": CR_PromptText,
|
||||
"CR Combine Prompt": CR_CombinePrompt,
|
||||
"CR VAE Decode": CR_VAEDecode,
|
||||
### List Nodes
|
||||
"CR Text List": CR_TextList,
|
||||
"CR Prompt List": CR_PromptList,
|
||||
"CR Simple List": CR_SimpleList,
|
||||
"CR Float Range List": CR_FloatRangeList,
|
||||
"CR Integer Range List": CR_IntegerRangeList,
|
||||
"CR Load Text List": CR_LoadTextList,
|
||||
"CR Binary To Bit List": CR_BinaryToBitList,
|
||||
"CR Text Cycler": CR_TextCycler,
|
||||
"CR Value Cycler": CR_ValueCycler,
|
||||
### List IO
|
||||
"CR Load Image List": CR_LoadImageList,
|
||||
"CR Load Image List Plus": CR_LoadImageListPlus,
|
||||
"CR Load GIF As List": CR_LoadGIFAsList,
|
||||
"CR Font File List": CR_FontFileList,
|
||||
### List Utils
|
||||
"CR Batch Images From List": CR_MakeBatchFromImageList,
|
||||
"CR Intertwine Lists" : CR_IntertwineLists,
|
||||
"CR Repeater": CR_Repeater,
|
||||
"CR XY Product": CR_XYProduct,
|
||||
"CR Text List To String": CR_TextListToString,
|
||||
### Aspect Ratio Nodes
|
||||
"CR SD1.5 Aspect Ratio": CR_AspectRatioSD15,
|
||||
"CR SDXL Aspect Ratio": CR_SDXLAspectRatio,
|
||||
"CR Aspect Ratio": CR_AspectRatio,
|
||||
"CR Aspect Ratio Banners": CR_AspectRatioBanners,
|
||||
"CR Aspect Ratio Social Media": CR_AspectRatioSocialMedia,
|
||||
"CR_Aspect Ratio For Print": CR_AspectRatioForPrint,
|
||||
### Legacy Nodes
|
||||
"CR Image Size": CR_ImageSize,
|
||||
"CR Aspect Ratio SDXL": CR_AspectRatio_SDXL,
|
||||
"CR SDXL Prompt Mixer": CR_PromptMixer,
|
||||
"CR Seed to Int": CR_SeedToInt,
|
||||
### ControlNet Nodes
|
||||
"CR Apply ControlNet": CR_ApplyControlNet,
|
||||
"CR Multi-ControlNet Stack": CR_ControlNetStack,
|
||||
"CR Apply Multi-ControlNet": CR_ApplyControlNetStack,
|
||||
### LoRA Nodes
|
||||
"CR Load LoRA": CR_LoraLoader,
|
||||
"CR LoRA Stack": CR_LoRAStack,
|
||||
"CR Random LoRA Stack": CR_RandomLoRAStack,
|
||||
"CR Random Weight LoRA": CR_RandomWeightLoRA,
|
||||
"CR Apply LoRA Stack": CR_ApplyLoRAStack,
|
||||
### Model Merge Nodes
|
||||
"CR Apply Model Merge": CR_ApplyModelMerge,
|
||||
"CR Model Merge Stack": CR_ModelMergeStack,
|
||||
### Pipe Nodes
|
||||
"CR Data Bus In":CR_DataBusIn,
|
||||
"CR Data Bus Out":CR_DataBusOut,
|
||||
"CR 8 Channel In":CR_8ChannelIn,
|
||||
"CR 8 Channel Out":CR_8ChannelOut,
|
||||
"CR Module Pipe Loader": CR_ModulePipeLoader,
|
||||
"CR Module Input": CR_ModuleInput,
|
||||
"CR Module Output": CR_ModuleOutput,
|
||||
"CR Image Pipe In": CR_ImagePipeIn,
|
||||
"CR Image Pipe Edit": CR_ImagePipeEdit,
|
||||
"CR Image Pipe Out": CR_ImagePipeOut,
|
||||
"CR Pipe Switch": CR_InputSwitchPipe,
|
||||
### SDXL Nodes
|
||||
"CR SDXL Prompt Mix Presets": CR_PromptMixPresets,
|
||||
"CR SDXL Style Text": CR_SDXLStyleText,
|
||||
"CR SDXL Base Prompt Encoder": CR_SDXLBasePromptEncoder,
|
||||
### Upscale Nodes
|
||||
"CR Multi Upscale Stack": CR_MultiUpscaleStack,
|
||||
"CR Upscale Image": CR_UpscaleImage,
|
||||
"CR Apply Multi Upscale": CR_ApplyMultiUpscale,
|
||||
### XY Grid Nodes
|
||||
"CR XY List": CR_XYList,
|
||||
"CR XY Interpolate": CR_XYInterpolate,
|
||||
"CR XY From Folder": CR_XYFromFolder,
|
||||
"CR XY Save Grid Image": CR_XYSaveGridImage,
|
||||
"CR XY Index": CR_XYIndex,
|
||||
#"CR XYZ Index": CR_XYZIndex,
|
||||
### Graphics Pattern
|
||||
"CR Halftone Grid": CR_HalftoneGrid,
|
||||
"CR Color Bars": CR_ColorBars,
|
||||
"CR Style Bars": CR_StyleBars,
|
||||
"CR Checker Pattern": CR_CheckerPattern,
|
||||
"CR Polygons": CR_Polygons,
|
||||
"CR Color Gradient": CR_ColorGradient,
|
||||
"CR Radial Gradient": CR_RadialGradient,
|
||||
"CR Starburst Lines": CR_StarburstLines,
|
||||
"CR Starburst Colors": CR_StarburstColors,
|
||||
"CR Simple Binary Pattern": CR_BinaryPatternSimple,
|
||||
"CR Binary Pattern": CR_BinaryPattern,
|
||||
### Graphics Shape
|
||||
"CR Draw Shape": CR_DrawShape,
|
||||
"CR Draw Pie": CR_DrawPie,
|
||||
"CR Random Shape Pattern": CR_RandomShapePattern,
|
||||
### Graphics Text
|
||||
"CR Overlay Text": CR_OverlayText,
|
||||
"CR Draw Text": CR_DrawText,
|
||||
"CR Mask Text": CR_MaskText,
|
||||
"CR Composite Text": CR_CompositeText,
|
||||
#"CR Arabic Text RTL": CR_ArabicTextRTL,
|
||||
"CR Simple Text Watermark": CR_SimpleTextWatermark,
|
||||
"CR Select Font": CR_SelectFont,
|
||||
### Graphics Filter
|
||||
"CR Halftone Filter": CR_HalftoneFilter,
|
||||
"CR Color Tint": CR_ColorTint,
|
||||
"CR Vignette Filter": CR_VignetteFilter,
|
||||
### Graphics Layout
|
||||
"CR Page Layout": CR_PageLayout,
|
||||
"CR Image Panel": CR_ImagePanel,
|
||||
"CR Image Grid Panel": CR_ImageGridPanel,
|
||||
"CR Image Border": CR_ImageBorder,
|
||||
"CR Feathered Border": CR_FeatheredBorder,
|
||||
"CR Simple Text Panel": CR_SimpleTextPanel,
|
||||
"CR Color Panel": CR_ColorPanel,
|
||||
"CR Overlay Transparent Image": CR_OverlayTransparentImage,
|
||||
"CR Half Drop Panel": CR_HalfDropPanel,
|
||||
"CR Diamond Panel": CR_DiamondPanel,
|
||||
#"CR Simple Titles": CR_SimpleTitles,
|
||||
### Graphics Template
|
||||
"CR Simple Meme Template": CR_SimpleMemeTemplate,
|
||||
"CR Simple Banner": CR_SimpleBanner,
|
||||
"CR Comic Panel Templates": CR_ComicPanelTemplates,
|
||||
"CR Simple Image Compare": CR_SimpleImageCompare,
|
||||
"CR Thumbnail Preview": CR_ThumbnailPreview,
|
||||
"CR Seamless Checker": CR_SeamlessChecker,
|
||||
### Utils Logic
|
||||
"CR Image Input Switch": CR_ImageInputSwitch,
|
||||
"CR Image Input Switch (4 way)": CR_ImageInputSwitch4way,
|
||||
"CR Latent Input Switch": CR_LatentInputSwitch,
|
||||
"CR Conditioning Input Switch": CR_ConditioningInputSwitch,
|
||||
"CR Clip Input Switch": CR_ClipInputSwitch,
|
||||
"CR Model Input Switch": CR_ModelInputSwitch,
|
||||
"CR ControlNet Input Switch": CR_ControlNetInputSwitch,
|
||||
"CR VAE Input Switch": CR_VAEInputSwitch,
|
||||
"CR Text Input Switch": CR_TextInputSwitch,
|
||||
"CR Text Input Switch (4 way)": CR_TextInputSwitch4way,
|
||||
"CR Switch Model and CLIP": CR_ModelAndCLIPInputSwitch,
|
||||
### Utils Process
|
||||
"CR Batch Process Switch": CR_BatchProcessSwitch,
|
||||
"CR Img2Img Process Switch": CR_Img2ImgProcessSwitch,
|
||||
"CR Hires Fix Process Switch": CR_HiResFixProcessSwitch,
|
||||
### Utils Index
|
||||
"CR Index": CR_Index,
|
||||
"CR Index Increment": CR_IncrementIndex,
|
||||
"CR Index Multiply": CR_MultiplyIndex,
|
||||
"CR Index Reset": CR_IndexReset,
|
||||
"CR Trigger": CR_Trigger,
|
||||
### Utils Conversion
|
||||
"CR String To Number": CR_StringToNumber,
|
||||
"CR String To Combo": CR_StringToCombo,
|
||||
"CR Float To String": CR_FloatToString,
|
||||
"CR Float To Integer": CR_FloatToInteger,
|
||||
"CR Integer To String": CR_IntegerToString,
|
||||
"CR String To Boolean": CR_StringToBoolean,
|
||||
### Utils Random
|
||||
"CR Random Hex Color": CR_RandomHexColor,
|
||||
"CR Random RGB": CR_RandomRGB,
|
||||
"CR Random Multiline Values": CR_RandomMultilineValues,
|
||||
"CR Random Multiline Colors": CR_RandomMultilineColors,
|
||||
"CR Random RGB Gradient": CR_RandomRGBGradient,
|
||||
"CR Random Panel Codes": CR_RandomPanelCodes,
|
||||
### Utils Text
|
||||
"CR Text": CR_Text,
|
||||
"CR Multiline Text": CR_MultilineText,
|
||||
"CR Split String": CR_SplitString,
|
||||
"CR Text Concatenate": CR_TextConcatenate,
|
||||
"CR Text Replace": CR_TextReplace,
|
||||
"CR Text Length": CR_TextLength,
|
||||
"CR Text Operation": CR_TextOperation,
|
||||
"CR Text Blacklist": CR_TextBlacklist,
|
||||
"CR Save Text To File": CR_SaveTextToFile,
|
||||
### Utils Conditional
|
||||
"CR Set Value On Boolean": CR_SetValueOnBoolean,
|
||||
"CR Set Value On Binary": CR_SetValueOnBinary,
|
||||
"CR Set Value on String": CR_SetValueOnString,
|
||||
"CR Set Switch From String": CR_SetSwitchFromString,
|
||||
### Utils Other
|
||||
"CR Value": CR_Value,
|
||||
"CR Integer Multiple": CR_IntegerMultipleOf,
|
||||
"CR Clamp Value": CR_ClampValue,
|
||||
"CR Math Operation": CR_MathOperation,
|
||||
"CR Get Parameter From Prompt": CR_GetParameterFromPrompt,
|
||||
"CR Select Resize Method": CR_SelectResizeMethod,
|
||||
"CR Select ISO Size": CR_SelectISOSize,
|
||||
### Animation Nodes
|
||||
# Schedules
|
||||
"CR Simple Schedule": CR_SimpleSchedule,
|
||||
"CR Central Schedule": CR_CentralSchedule,
|
||||
"CR Combine Schedules": CR_CombineSchedules,
|
||||
"CR Output Schedule To File": CR_OutputScheduleToFile,
|
||||
"CR Load Schedule From File": CR_LoadScheduleFromFile,
|
||||
"CR Schedule Input Switch": Comfyroll_ScheduleInputSwitch,
|
||||
"CR Bit Schedule": CR_BitSchedule,
|
||||
# Schedulers
|
||||
"CR Simple Value Scheduler": CR_SimpleValueScheduler,
|
||||
"CR Simple Text Scheduler": CR_SimpleTextScheduler,
|
||||
"CR Value Scheduler": CR_ValueScheduler,
|
||||
"CR Text Scheduler": CR_TextScheduler,
|
||||
"CR Load Scheduled Models": CR_LoadScheduledModels,
|
||||
"CR Load Scheduled LoRAs": CR_LoadScheduledLoRAs,
|
||||
"CR Prompt Scheduler": CR_PromptScheduler,
|
||||
"CR Simple Prompt Scheduler": CR_SimplePromptScheduler,
|
||||
# Prompt
|
||||
"CR Keyframe List": CR_KeyframeList,
|
||||
#"CR Load Prompt Style": CR_LoadPromptStyle,
|
||||
"CR Encode Scheduled Prompts": CR_EncodeScheduledPrompts,
|
||||
# Interpolation
|
||||
"CR Gradient Float": CR_GradientFloat,
|
||||
"CR Gradient Integer": CR_GradientInteger,
|
||||
"CR Increment Float": CR_IncrementFloat,
|
||||
"CR Increment Integer": CR_IncrementInteger,
|
||||
"CR Interpolate Latents": CR_InterpolateLatents,
|
||||
# Utils
|
||||
"CR Debatch Frames": CR_DebatchFrames,
|
||||
"CR Current Frame": CR_CurrentFrame,
|
||||
#"CR Input Text List": CR_InputTextList,
|
||||
# IO
|
||||
"CR Load Animation Frames": CR_LoadAnimationFrames,
|
||||
"CR Load Flow Frames": CR_LoadFlowFrames,
|
||||
"CR Output Flow Frames": CR_OutputFlowFrames,
|
||||
### Legacy
|
||||
# Note: CR Prompt List and CR Text List names have been reused,
|
||||
# so the old versions of these nodes are no longer available
|
||||
"CR Prompt List Keyframes": CR_PromptListKeyframes,
|
||||
"CR Simple Prompt List": CR_SimplePromptList,
|
||||
"CR Simple Prompt List Keyframes": CR_SimplePromptListKeyframes,
|
||||
"CR Cycle Models": CR_CycleModels,
|
||||
"CR Cycle LoRAs": CR_CycleLoRAs,
|
||||
"CR Cycle Text": CR_CycleText,
|
||||
"CR Cycle Text Simple": CR_CycleTextSimple,
|
||||
"CR Cycle Images": CR_CycleImages,
|
||||
"CR Cycle Images Simple": CR_CycleImagesSimple,
|
||||
"CR Model List": CR_ModelList,
|
||||
"CR LoRA List": CR_LoRAList,
|
||||
"CR Text List Simple": CR_TextListSimple,
|
||||
"CR Image List": CR_ImageList,
|
||||
"CR Image List Simple": CR_ImageListSimple,
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
### Core Nodes
|
||||
"CR Image Output": "💾 CR Image Output",
|
||||
"CR Integer Multiple": "⚙️ CR Integer Multiple",
|
||||
"CR Latent Batch Size": "⚙️ CR Latent Batch Size",
|
||||
"CR Seed": "🌱 CR Seed",
|
||||
"CR Value": "⚙️ CR Value",
|
||||
"CR Conditioning Mixer": "⚙️ CR Conditioning Mixer",
|
||||
"CR Select Model": "🔮 CR Select Model",
|
||||
"CR Prompt Text": "⚙️ CR Prompt Text",
|
||||
"CR Combine Prompt": "⚙️ CR Combine Prompt",
|
||||
"CR VAE Decode": "⚙️ CR VAE Decode",
|
||||
### List Nodes
|
||||
"CR Text List": "📜 CR Text List",
|
||||
"CR Prompt List": "📜 CR Prompt List",
|
||||
"CR Simple List": "📜 CR Simple List",
|
||||
"CR Float Range List": "📜 CR Float Range List",
|
||||
"CR Integer Range List": "📜 CR Integer Range List",
|
||||
"CR Load Value List": "📜 CR Load Value List",
|
||||
"CR Load Text List": "📜 CR Load Text List",
|
||||
"CR Binary To Bit List": "📜 CR Binary To Bit List",
|
||||
"CR Text Cycler": "📜 CR Text Cycler",
|
||||
"CR Value Cycler": "📜 CR Value Cycler",
|
||||
### List IO
|
||||
"CR Load Image List": "⌨️ CR Load Image List",
|
||||
"CR Load Image List Plus": "⌨️ CR Load Image List Plus",
|
||||
"CR Load GIF As List": "⌨️ CR Load GIF As List",
|
||||
"CR Font File List": "⌨️ CR Font File List",
|
||||
### List Utils
|
||||
"CR Batch Images From List": "🛠️ CR Batch Images From List",
|
||||
"CR Intertwine Lists" : "🛠️ CR Intertwine Lists",
|
||||
"CR Repeater": "🛠️ CR Repeater",
|
||||
"CR XY Product": "🛠️ CR XY Product",
|
||||
"CR Text List To String": "🛠️ CR Text List To String",
|
||||
### Aspect Ratio Nodes
|
||||
"CR SD1.5 Aspect Ratio": "🔳 CR SD1.5 Aspect Ratio",
|
||||
"CR SDXL Aspect Ratio": "🔳 CR SDXL Aspect Ratio",
|
||||
"CR Aspect Ratio": "🔳 CR Aspect Ratio",
|
||||
"CR Aspect Ratio Banners": "🔳 CR Aspect Ratio Banners",
|
||||
"CR Aspect Ratio Social Media": "🔳 CR Aspect Ratio Social Media",
|
||||
"CR_Aspect Ratio For Print": "🔳 CR_Aspect Ratio For Print",
|
||||
### Legacy Nodes
|
||||
"CR Image Size": "CR Image Size (Legacy)",
|
||||
"CR Aspect Ratio SDXL": "CR Aspect Ratio SDXL (Legacy)",
|
||||
"CR SDXL Prompt Mixer": "CR SDXL Prompt Mixer (Legacy)",
|
||||
"CR Seed to Int": "CR Seed to Int (Legacy)",
|
||||
### ControlNet Nodes
|
||||
"CR Apply ControlNet": "🕹️ CR Apply ControlNet",
|
||||
"CR Multi-ControlNet Stack": "🕹️ CR Multi-ControlNet Stack",
|
||||
"CR Apply Multi-ControlNet": "🕹️ CR Apply Multi-ControlNet",
|
||||
### LoRA Nodes
|
||||
"CR Load LoRA": "💊 CR Load LoRA",
|
||||
"CR LoRA Stack": "💊 CR LoRA Stack",
|
||||
"CR Random LoRA Stack": "💊 CR Random LoRA Stack",
|
||||
"CR Random Weight LoRA": "💊 CR Random Weight LoRA",
|
||||
"CR Apply LoRA Stack": "💊 CR Apply LoRA Stack",
|
||||
### Model Merge Nodes
|
||||
"CR Apply Model Merge": "⛏️ CR Apply Model Merge",
|
||||
"CR Model Merge Stack": "⛏️ CR Model Merge Stack",
|
||||
### Pipe Nodes
|
||||
"CR Data Bus In": "🚌 CR Data Bus In",
|
||||
"CR Data Bus Out": "🚌 CR Data Bus Out",
|
||||
"CR 8 Channel In": "🚌 CR 8 Channel In",
|
||||
"CR 8 Channel Out": "🚌 CR 8 Channel Out",
|
||||
"CR Module Pipe Loader": "✈️ CR Module Pipe Loader",
|
||||
"CR Module Input": "✈️ CR Module Input",
|
||||
"CR Module Output": "✈️ CR Module Output",
|
||||
"CR Image Pipe In": "🛩 CR Image Pipe In",
|
||||
"CR Image Pipe Edit": "🛩️ CR Image Pipe Edit",
|
||||
"CR Image Pipe Out": "🛩️ CR Image Pipe Out",
|
||||
"CR Pipe Switch": "🔀️ CR Pipe Switch",
|
||||
### SDXL Nodes
|
||||
"CR SDXL Prompt Mix Presets": "🌟 CR SDXL Prompt Mix Presets",
|
||||
"CR SDXL Style Text": "🌟 CR SDXL Style Text",
|
||||
"CR SDXL Base Prompt Encoder": "🌟 CR SDXL Base Prompt Encoder",
|
||||
### Upscale Nodes
|
||||
"CR Multi Upscale Stack": "🔍 CR Multi Upscale Stack",
|
||||
"CR Upscale Image": "🔍 CR Upscale Image",
|
||||
"CR Apply Multi Upscale": "🔍 CR Apply Multi Upscale",
|
||||
### XY Grid Nodes
|
||||
"CR XY List": "📉 CR XY List",
|
||||
"CR XY Interpolate": "📉 CR XY Interpolate",
|
||||
"CR XY Index": "📉 CR XY Index",
|
||||
"CR XY From Folder": "📉 CR XY From Folder",
|
||||
"CR XY Save Grid Image": "📉 CR XY Save Grid Image",
|
||||
### Graphics Pattern
|
||||
"CR Halftone Grid" : "🟫 CR Halftone Grid",
|
||||
"CR Color Bars" : "🟫 CR Color Bars",
|
||||
"CR Style Bars" : "🟪 CR Style Bars",
|
||||
"CR Checker Pattern": "🟦 CR Checker Pattern",
|
||||
"CR Polygons": "🟩 CR Polygons",
|
||||
"CR Color Gradient": "🟨 CR Color Gradient",
|
||||
"CR Radial Gradient": "🟨 CR Radial Gradient",
|
||||
"CR Starburst Lines": "🟧 CR Starburst Lines",
|
||||
"CR Starburst Colors": "🟧 CR Starburst Colors",
|
||||
"CR Simple Binary Pattern": "🟥 CR Simple Binary Pattern",
|
||||
"CR Binary Pattern": "🟥 CR Binary Pattern",
|
||||
### Graphics Shape
|
||||
"CR Draw Shape": "🟡 CR Draw Shape",
|
||||
"CR Draw Pie": "🟢 CR Draw Pie",
|
||||
"CR Random Shape Pattern": "🔵 CR Random Shape Pattern",
|
||||
### Graphics Text
|
||||
"CR Overlay Text": "🔤 CR Overlay Text",
|
||||
"CR Draw Text": "🔤️ CR Draw Text",
|
||||
"CR Mask Text": "🔤️ CR Mask Text",
|
||||
"CR Composite Text": "🔤️ CR Composite Text",
|
||||
"CR Simple Text Watermark": "🔤️ CR Simple Text Watermark",
|
||||
"CR Select Font": "🔤️ CR Select Font",
|
||||
### Graphics Filter
|
||||
"CR Halftone Filter": "🎨 Halftone Filter",
|
||||
"CR Color Tint": "🎨 CR Color Tint",
|
||||
"CR Vignette Filter": "🎨 CR Vignette Filter",
|
||||
### Graphics Layout
|
||||
"CR Image Panel": "🌁 CR Image Panel",
|
||||
"CR Image Grid Panel": "🌁 CR Image Grid Panel",
|
||||
"CR Simple Text Panel": "🌁 CR Simple Text Panel",
|
||||
"CR Color Panel": "🌁 CR Color Panel",
|
||||
"CR Half Drop Panel": "🌁 CR Half Drop Panel",
|
||||
"CR Diamond Panel": "🌁 CR Diamond Panel",
|
||||
"CR Page Layout": "🌁 CR Page Layout",
|
||||
"CR Image Border": "🌁 CR Image Border",
|
||||
"CR Feathered Border": "🌁 CR Feathered Border",
|
||||
"CR Overlay Transparent Image": "🌁 CR Overlay Transparent Image",
|
||||
### Graphics Template
|
||||
"CR Simple Meme Template": "📱 CR Simple Meme Template",
|
||||
"CR Simple Banner": "📱 CR Simple Banner",
|
||||
"CR Comic Panel Templates": "📱 CR Comic Panel Templates",
|
||||
"CR Simple Image Compare": "📱 CR Simple Image Compare",
|
||||
"CR Thumbnail Preview": "📱 CR Thumbnail Preview",
|
||||
"CR Seamless Checker": "📱 CR Seamless Checker",
|
||||
### Utils Logic
|
||||
"CR Image Input Switch": "🔀 CR Image Input Switch",
|
||||
"CR Image Input Switch (4 way)": "🔀 CR Image Input Switch (4 way)",
|
||||
"CR Latent Input Switch": "🔀 CR Latent Input Switch",
|
||||
"CR Conditioning Input Switch": "🔀 CR Conditioning Input Switch",
|
||||
"CR Clip Input Switch": "🔀 CR Clip Input Switch",
|
||||
"CR Model Input Switch": "🔀 CR Model Input Switch",
|
||||
"CR ControlNet Input Switch": "🔀 CR ControlNet Input Switch",
|
||||
"CR VAE Input Switch": "🔀 CR VAE Input Switch",
|
||||
"CR Text Input Switch": "🔀 CR Text Input Switch",
|
||||
"CR Text Input Switch (4 way)": "🔀 CR Text Input Switch (4 way)",
|
||||
"CR Switch Model and CLIP": "🔀 CR Switch Model and CLIP",
|
||||
### Utils Process
|
||||
"CR Batch Process Switch": "🔂 CR Batch Process Switch",
|
||||
"CR Img2Img Process Switch": "🔂 CR Img2Img Process Switch",
|
||||
"CR Hires Fix Process Switch": "🔂 CR Hires Fix Process Switch",
|
||||
### Utils Index
|
||||
"CR Index":"🔢 CR Index",
|
||||
"CR Index Increment": "🔢 CR Index Increment",
|
||||
"CR Index Multiply": "🔢 CR Index Multiply",
|
||||
"CR Index Reset": "🔢 CR Index Reset",
|
||||
"CR Trigger": "🔢 CR Trigger",
|
||||
### Utils Conversion
|
||||
"CR String To Number": "🔧 CR String To Number",
|
||||
"CR String To Combo": "🔧 CR String To Combo",
|
||||
"CR Float To String": "🔧 CR Float To String",
|
||||
"CR Float To Integer": "🔧 CR Float To Integer",
|
||||
"CR Integer To String": "🔧 CR Integer To String",
|
||||
"CR String To Boolean": "🔧 CR String To Boolean",
|
||||
### Utils Random
|
||||
"CR Random Hex Color": "🎲 CR Random Hex Color",
|
||||
"CR Random RGB": "🎲 CR Random RGB",
|
||||
"CR Random Multiline Values": "🎲 CR Random Multiline Values",
|
||||
"CR Random Multiline Colors": "🎲 CR Random Multiline Colors",
|
||||
"CR Random RGB Gradient": "🎲 CR Random RGB Gradient",
|
||||
"CR Random Panel Codes": "🎲 CR Random Panel Codes",
|
||||
### Utils Text
|
||||
"CR Text": "🔤 CR Text",
|
||||
"CR Multiline Text": "🔤 CR Multiline Text",
|
||||
"CR Split String": "🔤 CR Split String",
|
||||
"CR Text Concatenate": "🔤 CR Text Concatenate",
|
||||
"CR Text Replace": "🔤 CR Text Replace",
|
||||
"CR Text Blacklist": "🔤 Text Blacklist",
|
||||
"CR Text Length": "🔤 CR Text Length",
|
||||
"CR Text Operation": "🔤 CR Text Operation",
|
||||
"CR Save Text To File": "🔤 CR Save Text To File",
|
||||
### Utils Conditional
|
||||
"CR Set Value On Boolean": "⚙️ CR Set Value On Boolean",
|
||||
"CR Set Value On Binary": "⚙️ CR Set Value On Binary",
|
||||
"CR Set Value on String": "⚙️ CR Set Value on String",
|
||||
"CR Set Switch From String": "⚙️ CR Set Switch From String",
|
||||
### Utils Other
|
||||
"CR Integer Multiple": "⚙️ CR Integer Multiple",
|
||||
"CR Value": "⚙️ CR Value",
|
||||
"CR Clamp Value": "⚙️ CR Clamp Value",
|
||||
"CR Math Operation": "⚙️ CR Math Operation",
|
||||
"CR Get Parameter From Prompt": "⚙️ CR Get Parameter From Prompt",
|
||||
"CR Select Resize Method": "⚙️ CR Select Resize Method",
|
||||
"CR Select ISO Size": "⚙️ CR Select ISO Size",
|
||||
### Animation Nodes
|
||||
# Schedules
|
||||
"CR Simple Schedule": "📋 CR Simple Schedule",
|
||||
"CR Central Schedule": "📋 CR Central Schedule",
|
||||
"CR Combine Schedules": "📋 CR Combine Schedules",
|
||||
"CR Output Schedule To File": "📋 CR Output Schedule To File",
|
||||
"CR Load Schedule From File": "📋 CR Load Schedule From File",
|
||||
"CR Schedule Input Switch": "📋 CR Schedule Input Switch",
|
||||
"CR Bit Schedule": "📋 CR Bit Schedule",
|
||||
# Schedulers
|
||||
"CR Simple Value Scheduler": "📑 CR Simple Value Scheduler",
|
||||
"CR Simple Text Scheduler": "📑 CR Simple Text Scheduler",
|
||||
"CR Value Scheduler": "📑 CR Value Scheduler",
|
||||
"CR Text Scheduler": "📑 CR Text Scheduler",
|
||||
"CR Load Scheduled Models": "📑 CR Load Scheduled Models",
|
||||
"CR Load Scheduled LoRAs": "📑 CR Load Scheduled LoRAs",
|
||||
"CR Prompt Scheduler": "📑 CR Prompt Scheduler",
|
||||
"CR Simple Prompt Scheduler": "📑 CR Simple Prompt Scheduler",
|
||||
# Prompt
|
||||
"CR Keyframe List": "📝 CR Keyframe List",
|
||||
#"CR Load Prompt Style": "📝 CR Load Prompt Style",
|
||||
"CR Encode Scheduled Prompts": "📝 CR Encode Scheduled Prompts",
|
||||
# Interpolation
|
||||
"CR Gradient Float": "🔢 CR Gradient Float",
|
||||
"CR Gradient Integer": "🔢 CR Gradient Integer",
|
||||
"CR Increment Float": "🔢 CR Increment Float",
|
||||
"CR Increment Integer": "🔢 CR Increment Integer",
|
||||
"CR Interpolate Latents": "🔢 CR Interpolate Latents",
|
||||
# Utils
|
||||
"CR Debatch Frames": "🛠️ CR Debatch Frames",
|
||||
"CR Current Frame": "🛠️ CR Current Frame",
|
||||
# IO
|
||||
"CR Load Animation Frames": "⌨️ CR Load Animation Frames",
|
||||
"CR Load Flow Frames": "⌨️ CR Load Flow Frames",
|
||||
"CR Output Flow Frames": "⌨️ CR Output Flow Frames",
|
||||
### Legacy
|
||||
"CR Prompt List Keyframes": "CR Prompt List Keyframes (Legacy)",
|
||||
"CR Simple Prompt List": "CR Simple Prompt List (Legacy)",
|
||||
"CR Simple Prompt List Keyframes": "CR Simple Prompt List Keyframes (Legacy)",
|
||||
"CR Cycle Models": "CR Cycle Models (Legacy)",
|
||||
"CR Cycle LoRAs": "CR Cycle LoRAs (Legacy)",
|
||||
"CR Cycle Text": "CR Cycle Text (Legacy)",
|
||||
"CR Cycle Text Simple": "CR Cycle Text Simple (Legacy)",
|
||||
"CR Cycle Images": "CR Cycle Images (Legacy)",
|
||||
"CR Cycle Images Simple": "CR Cycle Images Simple (Legacy)",
|
||||
"CR Model List": "CR Model List (Legacy)",
|
||||
"CR LoRA List": "CR LoRA List (Legacy)",
|
||||
"CR Text List Simple": "CR Text List Simple (Legacy)",
|
||||
"CR Image List": "CR Image List (Legacy)",
|
||||
"CR Image List Simple": "CR Image List Simple (Legacy)",
|
||||
"CR Input Text List": "CR Input Text List (Legacy)",
|
||||
}
|
||||
@@ -0,0 +1,431 @@
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
# Comfyroll Studio custom nodes by RockOfFire and Akatsuzi https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes
|
||||
# for ComfyUI https://github.com/comfyanonymous/ComfyUI
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
|
||||
import torch
|
||||
import numpy as np
|
||||
import os
|
||||
import sys
|
||||
import csv
|
||||
import comfy.sd
|
||||
import json
|
||||
import folder_paths
|
||||
import typing as tg
|
||||
import datetime
|
||||
import io
|
||||
from server import PromptServer, BinaryEventTypes
|
||||
#from nodes import common_ksampler
|
||||
from PIL import Image
|
||||
from PIL.PngImagePlugin import PngInfo
|
||||
from pathlib import Path
|
||||
from ..categories import icons
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
# Core Nodes
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
class CR_ImageOutput:
|
||||
def __init__(self):
|
||||
self.output_dir = folder_paths.get_output_directory()
|
||||
self.type = "output"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
|
||||
presets = ["None", "yyyyMMdd"]
|
||||
|
||||
return {"required":
|
||||
{"images": ("IMAGE", ),
|
||||
"output_type": (["Preview", "Save", "UI (no batch)"],),
|
||||
"filename_prefix": ("STRING", {"default": "CR"}),
|
||||
"prefix_presets": (presets, ),
|
||||
"file_format": (["png", "jpg", "webp", "tif"],),
|
||||
},
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||
"optional":
|
||||
{"trigger": ("BOOLEAN", {"default": False},),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("BOOLEAN", )
|
||||
RETURN_NAMES = ("trigger", )
|
||||
FUNCTION = "save_images"
|
||||
OUTPUT_NODE = True
|
||||
CATEGORY = icons.get("Comfyroll/Essential/Core")
|
||||
|
||||
def save_images(self, images, file_format, prefix_presets, filename_prefix="CR",
|
||||
trigger=False, output_type="Preview", prompt=None, extra_pnginfo=None):
|
||||
|
||||
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-image-output"
|
||||
|
||||
def map_filename(filename):
|
||||
prefix_len = len(os.path.basename(filename_prefix))
|
||||
prefix = filename[:prefix_len + 1]
|
||||
try:
|
||||
digits = int(filename[prefix_len + 1:].split('_')[0])
|
||||
except:
|
||||
digits = 0
|
||||
return (digits, prefix)
|
||||
|
||||
if output_type == "Save":
|
||||
self.output_dir = folder_paths.get_output_directory()
|
||||
self.type = "output"
|
||||
elif output_type == "Preview":
|
||||
self.output_dir = folder_paths.get_temp_directory()
|
||||
self.type = "temp"
|
||||
|
||||
date_formats = {
|
||||
'yyyyMMdd': lambda d: '{}{:02d}{:02d}'.format(str(d.year), d.month, d.day),
|
||||
}
|
||||
|
||||
current_datetime = datetime.datetime.now()
|
||||
|
||||
for format_key, format_lambda in date_formats.items():
|
||||
preset_prefix = f"{format_lambda(current_datetime)}"
|
||||
|
||||
if prefix_presets != "None":
|
||||
filename_prefix = filename_prefix + "_" + preset_prefix
|
||||
|
||||
if filename_prefix[0] == "_":
|
||||
filename_prefix = filename_prefix[1:]
|
||||
|
||||
subfolder = os.path.dirname(os.path.normpath(filename_prefix))
|
||||
filename = os.path.basename(os.path.normpath(filename_prefix))
|
||||
|
||||
full_output_folder = os.path.join(self.output_dir, subfolder)
|
||||
|
||||
if os.path.commonpath((self.output_dir, os.path.abspath(full_output_folder))) != self.output_dir:
|
||||
return {}
|
||||
|
||||
try:
|
||||
counter = max(filter(lambda a: a[1][:-1] == filename and a[1][-1] == "_", map(map_filename, os.listdir(full_output_folder))))[0] + 1
|
||||
except ValueError:
|
||||
counter = 1
|
||||
except FileNotFoundError:
|
||||
os.makedirs(full_output_folder, exist_ok=True)
|
||||
counter = 1
|
||||
|
||||
if output_type == "UI (no batch)":
|
||||
# based on ETN_SendImageWebSocket
|
||||
results = []
|
||||
for tensor in images:
|
||||
array = 255.0 * tensor.cpu().numpy()
|
||||
image = Image.fromarray(np.clip(array, 0, 255).astype(np.uint8))
|
||||
|
||||
server = PromptServer.instance
|
||||
server.send_sync(
|
||||
BinaryEventTypes.UNENCODED_PREVIEW_IMAGE,
|
||||
["PNG", image, None],
|
||||
server.client_id,
|
||||
)
|
||||
results.append(
|
||||
{"source": "websocket", "content-type": "image/png", "type": "output"}
|
||||
)
|
||||
return {"ui": {"images": results}}
|
||||
else:
|
||||
results = list()
|
||||
for image in images:
|
||||
i = 255. * image.cpu().numpy()
|
||||
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
||||
metadata = PngInfo()
|
||||
if prompt is not None:
|
||||
metadata.add_text("prompt", json.dumps(prompt))
|
||||
if extra_pnginfo is not None:
|
||||
for x in extra_pnginfo:
|
||||
metadata.add_text(x, json.dumps(extra_pnginfo[x]))
|
||||
|
||||
file_name = f"{filename}_{counter:05}_.{file_format}"
|
||||
|
||||
img_params = {'png': {'compress_level': 4},
|
||||
'webp': {'method': 6, 'lossless': False, 'quality': 80},
|
||||
'jpg': {'format': 'JPEG'},
|
||||
'tif': {'format': 'TIFF'}
|
||||
}
|
||||
|
||||
resolved_image_path = os.path.join(full_output_folder, file_name)
|
||||
|
||||
img.save(resolved_image_path, **img_params[file_format], pnginfo=metadata)
|
||||
results.append({
|
||||
"filename": file_name,
|
||||
"subfolder": subfolder,
|
||||
"type": self.type
|
||||
})
|
||||
counter += 1
|
||||
|
||||
return { "ui": { "images": results }, "result": (trigger, show_help,) }
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
class CR_Seed:
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff})}}
|
||||
|
||||
RETURN_TYPES = ("INT", "STRING", )
|
||||
RETURN_NAMES = ("seed", "show_help", )
|
||||
FUNCTION = "seedint"
|
||||
OUTPUT_NODE = True
|
||||
CATEGORY = icons.get("Comfyroll/Essential/Core")
|
||||
|
||||
@staticmethod
|
||||
def seedint(seed):
|
||||
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-seed"
|
||||
return (seed, show_help,)
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
class CR_LatentBatchSize:
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"latent": ("LATENT", ),
|
||||
"batch_size": ("INT", {"default": 2, "min": 1, "max": 999, "step": 1}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("LATENT", )
|
||||
FUNCTION = "batchsize"
|
||||
CATEGORY = icons.get("Comfyroll/Essential/Core")
|
||||
|
||||
def batchsize(self, latent: tg.Sequence[tg.Mapping[tg.Text, torch.Tensor]], batch_size: int):
|
||||
samples = latent['samples']
|
||||
shape = samples.shape
|
||||
|
||||
sample_list = [samples] + [
|
||||
torch.clone(samples) for _ in range(batch_size - 1)
|
||||
]
|
||||
|
||||
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-latent-batch-size"
|
||||
|
||||
return ({
|
||||
'samples': torch.cat(sample_list),
|
||||
}, )
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
class CR_PromptText:
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"prompt": ("STRING", {"default": "prompt", "multiline": True})
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING", "STRING", )
|
||||
RETURN_NAMES = ("prompt", "show_help", )
|
||||
FUNCTION = "get_value"
|
||||
CATEGORY = icons.get("Comfyroll/Essential/Core")
|
||||
|
||||
def get_value(self, prompt):
|
||||
|
||||
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-prompt-text"
|
||||
|
||||
return (prompt, show_help, )
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
class CR_CombinePrompt:
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
},
|
||||
"optional": {
|
||||
"part1": ("STRING", {"default": "", "multiline": True}),
|
||||
"part2": ("STRING", {"default": "", "multiline": True}),
|
||||
"part3": ("STRING", {"default": "", "multiline": True}),
|
||||
"part4": ("STRING", {"default": "", "multiline": True}),
|
||||
"separator": ("STRING", {"default": ",", "multiline": False}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING", "STRING", )
|
||||
RETURN_NAMES = ("prompt", "show_help", )
|
||||
FUNCTION = "get_value"
|
||||
CATEGORY = icons.get("Comfyroll/Essential/Core")
|
||||
|
||||
def get_value(self, part1="", part2="", part3="", part4="", separator=""):
|
||||
|
||||
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-prompt-parts"
|
||||
|
||||
prompt = part1 + separator + part2 + separator + part3 + separator + part4
|
||||
|
||||
return (prompt, show_help, )
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
class CR_ConditioningMixer:
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
|
||||
mix_methods = ["Combine", "Average", "Concatenate"]
|
||||
|
||||
return {"required":
|
||||
{"conditioning_1": ("CONDITIONING", ),
|
||||
"conditioning_2": ("CONDITIONING", ),
|
||||
"mix_method": (mix_methods, ),
|
||||
"average_strength": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING", "STRING", )
|
||||
RETURN_NAMES = ("CONDITIONING", "show_help", )
|
||||
FUNCTION = "conditioning"
|
||||
CATEGORY = icons.get("Comfyroll/Essential/Core")
|
||||
|
||||
def conditioning(self, mix_method, conditioning_1, conditioning_2, average_strength):
|
||||
|
||||
conditioning_from = conditioning_1
|
||||
conditioning_to = conditioning_2
|
||||
conditioning_to_strength = average_strength
|
||||
|
||||
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-conditioning-mixer"
|
||||
|
||||
if mix_method == "Combine":
|
||||
return (conditioning_1 + conditioning_2, show_help, )
|
||||
|
||||
if mix_method == "Average":
|
||||
|
||||
out = []
|
||||
|
||||
if len(conditioning_from) > 1:
|
||||
print("Warning: ConditioningAverage conditioning_from contains more than 1 cond, only the first one will actually be applied to conditioning_to.")
|
||||
|
||||
cond_from = conditioning_from[0][0]
|
||||
pooled_output_from = conditioning_from[0][1].get("pooled_output", None)
|
||||
|
||||
for i in range(len(conditioning_to)):
|
||||
t1 = conditioning_to[i][0]
|
||||
pooled_output_to = conditioning_to[i][1].get("pooled_output", pooled_output_from)
|
||||
t0 = cond_from[:,:t1.shape[1]]
|
||||
if t0.shape[1] < t1.shape[1]:
|
||||
t0 = torch.cat([t0] + [torch.zeros((1, (t1.shape[1] - t0.shape[1]), t1.shape[2]))], dim=1)
|
||||
|
||||
tw = torch.mul(t1, conditioning_to_strength) + torch.mul(t0, (1.0 - conditioning_to_strength))
|
||||
t_to = conditioning_to[i][1].copy()
|
||||
if pooled_output_from is not None and pooled_output_to is not None:
|
||||
t_to["pooled_output"] = torch.mul(pooled_output_to, conditioning_to_strength) + torch.mul(pooled_output_from, (1.0 - conditioning_to_strength))
|
||||
elif pooled_output_from is not None:
|
||||
t_to["pooled_output"] = pooled_output_from
|
||||
|
||||
n = [tw, t_to]
|
||||
out.append(n)
|
||||
return (out, show_help, )
|
||||
|
||||
if mix_method == "Concatenate":
|
||||
|
||||
out = []
|
||||
|
||||
if len(conditioning_from) > 1:
|
||||
print("Warning: ConditioningConcat conditioning_from contains more than 1 cond, only the first one will actually be applied to conditioning_to.")
|
||||
|
||||
cond_from = conditioning_from[0][0]
|
||||
|
||||
for i in range(len(conditioning_to)):
|
||||
t1 = conditioning_to[i][0]
|
||||
tw = torch.cat((t1, cond_from),1)
|
||||
n = [tw, conditioning_to[i][1].copy()]
|
||||
out.append(n)
|
||||
return (out, show_help, )
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
class CR_SelectModel:
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
|
||||
checkpoint_files = ["None"] + folder_paths.get_filename_list("checkpoints")
|
||||
|
||||
return {"required": {"ckpt_name1": (checkpoint_files,),
|
||||
"ckpt_name2": (checkpoint_files,),
|
||||
"ckpt_name3": (checkpoint_files,),
|
||||
"ckpt_name4": (checkpoint_files,),
|
||||
"ckpt_name5": (checkpoint_files,),
|
||||
"select_model": ("INT", {"default": 1, "min": 1, "max": 5}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RETURN_TYPES = ("MODEL", "CLIP", "VAE", "STRING", "STRING", )
|
||||
RETURN_NAMES = ("MODEL", "CLIP", "VAE", "ckpt_name", "show_help", )
|
||||
FUNCTION = "select_model"
|
||||
CATEGORY = icons.get("Comfyroll/Essential/Core")
|
||||
|
||||
def select_model(self, ckpt_name1, ckpt_name2, ckpt_name3, ckpt_name4, ckpt_name5, select_model):
|
||||
|
||||
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-select-model"
|
||||
|
||||
# Initialise the list
|
||||
model_list = list()
|
||||
|
||||
if select_model == 1:
|
||||
model_name = ckpt_name1
|
||||
elif select_model == 2:
|
||||
model_name = ckpt_name2
|
||||
elif select_model == 3:
|
||||
model_name = ckpt_name3
|
||||
elif select_model == 4:
|
||||
model_name = ckpt_name4
|
||||
elif select_model == 5:
|
||||
model_name = ckpt_name5
|
||||
|
||||
if model_name == "None":
|
||||
print(f"CR Select Model: No model selected")
|
||||
return()
|
||||
|
||||
ckpt_path = folder_paths.get_full_path("checkpoints", model_name)
|
||||
model, clip, vae, clipvision = comfy.sd.load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True,
|
||||
embedding_directory=folder_paths.get_folder_paths("embeddings"))
|
||||
|
||||
return (model, clip, vae, model_name, show_help, )
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
# based on Jags111 CircularVAEDecode
|
||||
class CR_VAEDecode:
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
|
||||
return {"required": {
|
||||
"samples": ("LATENT", ),
|
||||
"vae": ("VAE", ),
|
||||
"tiled": ("BOOLEAN", {"default": False}),
|
||||
"circular": ("BOOLEAN", {"default": False}),
|
||||
}
|
||||
}
|
||||
RETURN_TYPES = ("IMAGE", "STRING", )
|
||||
RETURN_NAMES = ("IMAGE", "show_help", )
|
||||
FUNCTION = "vae_decode"
|
||||
CATEGORY = icons.get("Comfyroll/Essential/Core")
|
||||
|
||||
def vae_decode(self, samples, vae, circular=False, tiled=False):
|
||||
|
||||
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-vae-decode"
|
||||
|
||||
if circular == True:
|
||||
for layer in [layer for layer in vae.first_stage_model.modules() if isinstance(layer, torch.nn.Conv2d)]:
|
||||
layer.padding_mode = "circular"
|
||||
|
||||
if tiled == True:
|
||||
c = vae.decode_tiled(samples["samples"], tile_x=512, tile_y=512, )
|
||||
else:
|
||||
c = vae.decode(samples["samples"])
|
||||
|
||||
return (c, show_help, )
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
# MAPPINGS
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
# For reference only, actual mappings are in __init__.py
|
||||
'''
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
### Other
|
||||
"CR Image Output": CR_ImageOutput,
|
||||
"CR Latent Batch Size": CR_LatentBatchSize,
|
||||
"CR Seed": CR_Seed,
|
||||
"CR Prompt Text": CR_PromptText,
|
||||
"CR Combine Prompt": CR_CombinePrompt,
|
||||
"CR Conditioning Mixer": CR_ConditioningMixer,
|
||||
"CR Select Model": CR_SelectModel,
|
||||
"CR VAE Decode": CR_VAEDecode,
|
||||
}
|
||||
'''
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"sha":"0c20c6b9ac22ecc4b5525de651fca0776a382dd3","node_id":"C_kwDOQ_fZq9oAKDBjMjBjNmI5YWMyMmVjYzRiNTUyNWRlNjUxZmNhMDc3NmEzODJkZDM","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/commits/0c20c6b9ac22ecc4b5525de651fca0776a382dd3","html_url":"https://github.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/commit/0c20c6b9ac22ecc4b5525de651fca0776a382dd3","author":{"name":"AICodeTudou","email":"411011819@qq.com","date":"2026-01-25T18:30:23Z"},"committer":{"name":"AICodeTudou","email":"411011819@qq.com","date":"2026-01-25T18:30:23Z"},"tree":{"sha":"6da1640966511fb020ea54c2f3f20a5027907b14","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/6da1640966511fb020ea54c2f3f20a5027907b14"},"message":"update file","parents":[{"sha":"c513c371bd0cd3b95eb5313a29f9c3dacb84566d","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/commits/c513c371bd0cd3b95eb5313a29f9c3dacb84566d","html_url":"https://github.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/commit/c513c371bd0cd3b95eb5313a29f9c3dacb84566d"}],"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null,"verified_at":null}}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,176 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative
|
||||
Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -0,0 +1,6 @@
|
||||
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
||||
|
||||
# 声明前端资源目录,确保 js 文件被 ComfyUI 加载
|
||||
WEB_DIRECTORY = "./js"
|
||||
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS', 'WEB_DIRECTORY']
|
||||
@@ -0,0 +1,254 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
|
||||
app.registerExtension({
|
||||
name: "ComfyUI-TD-Qwen3TTS.BatchGenerateSpeaker",
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
if (nodeData.name === "TDQwen3TTSBatchGenerateSpeaker") {
|
||||
const onNodeCreated = nodeType.prototype.onNodeCreated;
|
||||
nodeType.prototype.onNodeCreated = function () {
|
||||
const r = onNodeCreated ? onNodeCreated.apply(this, arguments) : undefined;
|
||||
|
||||
// Find the speakers_config widget
|
||||
const configWidget = this.widgets.find(w => w.name === "speakers_config");
|
||||
|
||||
// Add "Manage Speakers" button
|
||||
this.addWidget("button", "Manage Speakers", "Edit", (w) => {
|
||||
showSpeakerDialog(this, configWidget);
|
||||
});
|
||||
|
||||
return r;
|
||||
};
|
||||
|
||||
// Handle execution results to get generated audio
|
||||
const onExecuted = nodeType.prototype.onExecuted;
|
||||
nodeType.prototype.onExecuted = function(message) {
|
||||
if (onExecuted) onExecuted.apply(this, arguments);
|
||||
|
||||
// message is the output object. message.batch_outputs comes from our python "ui" return
|
||||
if (message && message.batch_outputs) {
|
||||
this.batchOutputs = message.batch_outputs;
|
||||
// If the dialog is open, we could potentially refresh it,
|
||||
// but for now let's just let the user re-open or if we implement auto-refresh later.
|
||||
// A simple check:
|
||||
const dialog = document.getElementById('td-qwen3-speaker-dialog');
|
||||
if (dialog && dialog.dataset.nodeId == this.id) {
|
||||
// We can trigger a refresh if we exposed the render function
|
||||
// For now, we'll just leave it.
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function showSpeakerDialog(node, configWidget) {
|
||||
// Remove existing if any
|
||||
const existing = document.getElementById('td-qwen3-speaker-dialog');
|
||||
if (existing) document.body.removeChild(existing);
|
||||
|
||||
const dialog = document.createElement("div");
|
||||
dialog.id = 'td-qwen3-speaker-dialog';
|
||||
dialog.dataset.nodeId = node.id;
|
||||
dialog.style.cssText = `
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #222;
|
||||
color: #ddd;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 20px rgba(0,0,0,0.5);
|
||||
z-index: 10000;
|
||||
width: 900px;
|
||||
max-height: 85vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 1px solid #444;
|
||||
font-family: sans-serif;
|
||||
`;
|
||||
|
||||
const title = document.createElement("h3");
|
||||
title.innerText = "Manage Speakers (Batch Generate)";
|
||||
title.style.marginTop = "0";
|
||||
dialog.appendChild(title);
|
||||
|
||||
const contentArea = document.createElement("div");
|
||||
contentArea.style.cssText = `
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #333;
|
||||
padding: 10px;
|
||||
background: #111;
|
||||
`;
|
||||
dialog.appendChild(contentArea);
|
||||
|
||||
// Load existing config
|
||||
let speakers = [];
|
||||
try {
|
||||
if (configWidget && configWidget.value) {
|
||||
speakers = JSON.parse(configWidget.value);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Invalid JSON in speakers_config", e);
|
||||
}
|
||||
if (!Array.isArray(speakers)) speakers = [];
|
||||
|
||||
// Function to render list
|
||||
function renderList() {
|
||||
contentArea.innerHTML = "";
|
||||
if (speakers.length === 0) {
|
||||
contentArea.innerHTML = "<div style='padding:20px; text-align:center; color:#666;'>No speakers defined. Click 'Add Speaker' to start.</div>";
|
||||
return;
|
||||
}
|
||||
|
||||
speakers.forEach((spk, index) => {
|
||||
const row = document.createElement("div");
|
||||
row.style.cssText = `
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
background: #2a2a2a;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
`;
|
||||
|
||||
const topRow = document.createElement("div");
|
||||
topRow.style.cssText = "display: flex; gap: 10px; align-items: flex-start; width: 100%;";
|
||||
row.appendChild(topRow);
|
||||
|
||||
// Name
|
||||
const nameGroup = document.createElement("div");
|
||||
nameGroup.style.flex = "1";
|
||||
nameGroup.innerHTML = "<label style='display:block;font-size:12px;color:#aaa;margin-bottom:4px'>Name</label>";
|
||||
const nameInput = document.createElement("input");
|
||||
nameInput.value = spk.name || "";
|
||||
nameInput.style.cssText = "width:100%; background:#333; color:#fff; border:1px solid #555; padding:4px;";
|
||||
nameInput.onchange = (e) => { spk.name = e.target.value; };
|
||||
nameGroup.appendChild(nameInput);
|
||||
topRow.appendChild(nameGroup);
|
||||
|
||||
// Instruct
|
||||
const instructGroup = document.createElement("div");
|
||||
instructGroup.style.flex = "2";
|
||||
instructGroup.innerHTML = "<label style='display:block;font-size:12px;color:#aaa;margin-bottom:4px'>Voice Style (Instruct)</label>";
|
||||
const instructInput = document.createElement("textarea");
|
||||
instructInput.value = spk.instruct || "";
|
||||
instructInput.rows = 2;
|
||||
instructInput.style.cssText = "width:100%; background:#333; color:#fff; border:1px solid #555; padding:4px; resize:vertical;";
|
||||
instructInput.onchange = (e) => { spk.instruct = e.target.value; };
|
||||
instructGroup.appendChild(instructInput);
|
||||
topRow.appendChild(instructGroup);
|
||||
|
||||
// Text
|
||||
const textGroup = document.createElement("div");
|
||||
textGroup.style.flex = "2";
|
||||
textGroup.innerHTML = "<label style='display:block;font-size:12px;color:#aaa;margin-bottom:4px'>Sample Text</label>";
|
||||
const textInput = document.createElement("textarea");
|
||||
textInput.value = spk.text || "";
|
||||
textInput.rows = 2;
|
||||
textInput.style.cssText = "width:100%; background:#333; color:#fff; border:1px solid #555; padding:4px; resize:vertical;";
|
||||
textInput.onchange = (e) => { spk.text = e.target.value; };
|
||||
textGroup.appendChild(textInput);
|
||||
topRow.appendChild(textGroup);
|
||||
|
||||
// Delete
|
||||
const delBtn = document.createElement("button");
|
||||
delBtn.innerText = "X";
|
||||
delBtn.style.cssText = "background:#800; color:#fff; border:none; padding:5px 10px; cursor:pointer; margin-top:20px;";
|
||||
delBtn.onclick = () => {
|
||||
speakers.splice(index, 1);
|
||||
renderList();
|
||||
};
|
||||
topRow.appendChild(delBtn);
|
||||
|
||||
// Preview Area (if audio exists)
|
||||
// We look up audio from node.batchOutputs by name
|
||||
// Note: If names are duplicated, this might pick the first match.
|
||||
if (node.batchOutputs && spk.name) {
|
||||
// Find latest output for this name?
|
||||
// Or just find one.
|
||||
// Since batchOutputs might accumulate if we don't clear it?
|
||||
// Actually batchOutputs is replaced on each execution.
|
||||
const audioInfo = node.batchOutputs.find(o => o.name === spk.name);
|
||||
|
||||
if (audioInfo) {
|
||||
const audioRow = document.createElement("div");
|
||||
audioRow.style.cssText = "margin-top: 5px; background: #222; padding: 5px; border-radius: 4px; display: flex; align-items: center; gap: 10px;";
|
||||
|
||||
const label = document.createElement("span");
|
||||
label.innerText = "Last Generated Preview:";
|
||||
label.style.fontSize = "12px";
|
||||
label.style.color = "#aaa";
|
||||
audioRow.appendChild(label);
|
||||
|
||||
const audioPlayer = document.createElement("audio");
|
||||
audioPlayer.controls = true;
|
||||
audioPlayer.style.height = "30px";
|
||||
// Construct URL: /view?filename=...&type=...&subfolder=...
|
||||
const params = new URLSearchParams({
|
||||
filename: audioInfo.filename,
|
||||
type: audioInfo.type,
|
||||
subfolder: audioInfo.subfolder || ""
|
||||
});
|
||||
audioPlayer.src = "/view?" + params.toString();
|
||||
audioRow.appendChild(audioPlayer);
|
||||
|
||||
row.appendChild(audioRow);
|
||||
}
|
||||
}
|
||||
|
||||
contentArea.appendChild(row);
|
||||
});
|
||||
}
|
||||
|
||||
renderList();
|
||||
|
||||
// Buttons area
|
||||
const buttons = document.createElement("div");
|
||||
buttons.style.cssText = "display:flex; justify-content:space-between; align-items:center;";
|
||||
dialog.appendChild(buttons);
|
||||
|
||||
const leftBtns = document.createElement("div");
|
||||
buttons.appendChild(leftBtns);
|
||||
|
||||
const addBtn = document.createElement("button");
|
||||
addBtn.innerText = "+ Add Speaker";
|
||||
addBtn.style.cssText = "background:#444; color:#fff; border:none; padding:8px 16px; cursor:pointer; margin-right:10px;";
|
||||
addBtn.onclick = () => {
|
||||
speakers.push({ name: "NewSpeaker", instruct: "A clear voice", text: "Hello world" });
|
||||
renderList();
|
||||
// Scroll to bottom
|
||||
setTimeout(() => contentArea.scrollTop = contentArea.scrollHeight, 10);
|
||||
};
|
||||
leftBtns.appendChild(addBtn);
|
||||
|
||||
const rightBtns = document.createElement("div");
|
||||
buttons.appendChild(rightBtns);
|
||||
|
||||
const cancelBtn = document.createElement("button");
|
||||
cancelBtn.innerText = "Cancel";
|
||||
cancelBtn.style.cssText = "background:transparent; color:#aaa; border:1px solid #444; padding:8px 16px; cursor:pointer; margin-right:10px;";
|
||||
cancelBtn.onclick = () => {
|
||||
document.body.removeChild(dialog);
|
||||
};
|
||||
rightBtns.appendChild(cancelBtn);
|
||||
|
||||
const saveBtn = document.createElement("button");
|
||||
saveBtn.innerText = "Save";
|
||||
saveBtn.style.cssText = "background:#28a745; color:#fff; border:none; padding:8px 24px; cursor:pointer; font-weight:bold;";
|
||||
saveBtn.onclick = () => {
|
||||
if (configWidget) {
|
||||
configWidget.value = JSON.stringify(speakers, null, 2);
|
||||
// Trigger graph change
|
||||
if (node.onResize) node.onResize(node.size);
|
||||
app.graph.setDirtyCanvas(true, true);
|
||||
}
|
||||
document.body.removeChild(dialog);
|
||||
};
|
||||
rightBtns.appendChild(saveBtn);
|
||||
|
||||
document.body.appendChild(dialog);
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
|
||||
app.registerExtension({
|
||||
name: "ComfyUI-TD-Qwen3TTS.MultiDialog",
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
if (nodeData.name === "TDQwen3TTSMultiDialog") {
|
||||
const onConnectionsChange = nodeType.prototype.onConnectionsChange;
|
||||
nodeType.prototype.onConnectionsChange = function (type, index, connected, link_info, slot) {
|
||||
const r = onConnectionsChange ? onConnectionsChange.apply(this, arguments) : undefined;
|
||||
|
||||
// Ensure inputs exist
|
||||
// 确保输入存在
|
||||
if (!this.inputs) return r;
|
||||
|
||||
// 1. Identify all speaker inputs and their indices
|
||||
// 1. 识别所有 speaker 输入及其索引
|
||||
const speakerInputs = [];
|
||||
for(let i=0; i<this.inputs.length; i++) {
|
||||
if(this.inputs[i].name.startsWith("speaker_")) {
|
||||
speakerInputs.push({
|
||||
index: i,
|
||||
name: this.inputs[i].name,
|
||||
input: this.inputs[i],
|
||||
num: parseInt(this.inputs[i].name.split("_")[1])
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Find the highest numbered speaker slot that is currently connected
|
||||
// 2. 找到当前已连接的最大编号 speaker 插槽
|
||||
let maxConnectedNum = 0;
|
||||
let maxExistingNum = 0;
|
||||
|
||||
for(const item of speakerInputs) {
|
||||
if(item.num > maxExistingNum) maxExistingNum = item.num;
|
||||
if(item.input.link !== undefined && item.input.link !== null) {
|
||||
if(item.num > maxConnectedNum) maxConnectedNum = item.num;
|
||||
|
||||
// NEW LOGIC: Rename input based on upstream node name
|
||||
// 新逻辑:根据上游节点名称重命名输入
|
||||
const linkId = item.input.link;
|
||||
const link = app.graph.links[linkId];
|
||||
if (link) {
|
||||
const originNode = app.graph.getNodeById(link.origin_id);
|
||||
if (originNode && originNode.widgets) {
|
||||
// Look for 'name' widget
|
||||
// 查找 'name' 控件
|
||||
const nameWidget = originNode.widgets.find(w => w.name === "name");
|
||||
if (nameWidget && nameWidget.value) {
|
||||
const newLabel = `${nameWidget.value}`;
|
||||
// Only update if changed to avoid loop/redraw issues
|
||||
// 仅在发生变化时更新,以避免循环/重绘问题
|
||||
if (item.input.label !== newLabel) {
|
||||
item.input.label = newLabel;
|
||||
// Force redraw of this node
|
||||
// 强制重绘此节点
|
||||
if (this.setDirtyCanvas) {
|
||||
this.setDirtyCanvas(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Reset label if disconnected
|
||||
// 如果断开连接,重置标签
|
||||
if (item.input.label) {
|
||||
item.input.label = undefined; // Or null, to revert to name // 或者设为 null,以恢复为名称
|
||||
if (this.setDirtyCanvas) {
|
||||
this.setDirtyCanvas(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Determine target behavior
|
||||
// 3. 确定目标行为
|
||||
// We want to ensure that if speaker_N is connected, speaker_{N+1} exists.
|
||||
// 我们要确保如果 speaker_N 已连接,则 speaker_{N+1} 存在。
|
||||
// If nothing is connected, we want speaker_1 to exist.
|
||||
// 如果没有任何连接,我们要确保 speaker_1 存在。
|
||||
const targetNum = maxConnectedNum + 1;
|
||||
|
||||
// 4. Add if missing
|
||||
// 4. 如果缺失则添加
|
||||
if (maxExistingNum < targetNum) {
|
||||
// Add intermediate slots if for some reason we jumped (unlikely but safe)
|
||||
// 如果由于某种原因跳过了(不太可能但为了安全起见),添加中间插槽
|
||||
for (let i = maxExistingNum + 1; i <= targetNum; i++) {
|
||||
// console.log("Adding input", `speaker_${i}`);
|
||||
this.addInput(`speaker_${i}`, "SPEAKER");
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Remove if too many (trailing unconnected slots)
|
||||
// 5. 如果过多则移除(末尾未连接的插槽)
|
||||
// We only want to keep up to targetNum.
|
||||
// 我们只想保留到 targetNum。
|
||||
// Any slot > targetNum should be removed IF it is unconnected.
|
||||
// 任何 > targetNum 的插槽如果未连接都应被移除。
|
||||
// We iterate backwards to safely remove by index.
|
||||
// 我们反向迭代以按索引安全移除。
|
||||
|
||||
// Refresh inputs list as we might have added some
|
||||
// 刷新输入列表,因为我们可能添加了一些
|
||||
// Actually, let's just use the current logic:
|
||||
// 实际上,我们就使用当前的逻辑:
|
||||
// Any input named speaker_X where X > targetNum is a candidate for removal.
|
||||
// 任何名为 speaker_X 且 X > targetNum 的输入都是移除的候选对象。
|
||||
|
||||
// Note: Removing inputs changes indices, so we must be careful.
|
||||
// 注意:移除输入会改变索引,所以我们必须小心。
|
||||
// It's best to grab the current list of inputs again.
|
||||
// 最好再次获取当前的输入列表。
|
||||
|
||||
let inputsModified = false;
|
||||
|
||||
// Loop backwards
|
||||
// 反向循环
|
||||
for (let i = this.inputs.length - 1; i >= 0; i--) {
|
||||
const inp = this.inputs[i];
|
||||
if (inp.name.startsWith("speaker_")) {
|
||||
const num = parseInt(inp.name.split("_")[1]);
|
||||
if (num > targetNum) {
|
||||
// Verify it's not connected (double check)
|
||||
// 验证它未连接(再次检查)
|
||||
if (inp.link === undefined || inp.link === null) {
|
||||
// console.log("Removing input", inp.name);
|
||||
this.removeInput(i);
|
||||
inputsModified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we modified inputs, we might need to notify graph update?
|
||||
// 如果我们修改了输入,可能需要通知图形更新?
|
||||
// Usually not strictly required for inputs but good practice if visual glitches occur.
|
||||
// 通常对于输入不是严格要求的,但如果出现视觉故障,这是一个好的做法。
|
||||
|
||||
return r;
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,701 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import torch
|
||||
import torchaudio
|
||||
import random
|
||||
import string
|
||||
import numpy as np
|
||||
import folder_paths
|
||||
import zlib
|
||||
import ast
|
||||
|
||||
# 将父目录添加到路径以允许导入 qwen_tts
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# 添加本地克隆的 cc 目录到 sys.path
|
||||
qwen_repo_path = os.path.join(current_dir, "Qwen3-TTS")
|
||||
if os.path.exists(qwen_repo_path) and qwen_repo_path not in sys.path:
|
||||
sys.path.append(qwen_repo_path)
|
||||
|
||||
parent_dir = os.path.dirname(current_dir)
|
||||
if parent_dir not in sys.path:
|
||||
sys.path.append(parent_dir)
|
||||
|
||||
try:
|
||||
from qwen_tts.inference.qwen3_tts_model import Qwen3TTSModel
|
||||
except ImportError as e:
|
||||
print("\n" + "!" * 50)
|
||||
print("Warning / 警告:")
|
||||
print("Failed to import Qwen3TTS dependencies. / 无法导入 Qwen3TTS 依赖项。")
|
||||
print(f"Error details / 错误详情: {e}")
|
||||
print("\nPlease try the following steps to fix this issue / 请尝试以下步骤解决此问题:")
|
||||
print("1. Open terminal in the node directory / 在节点目录下打开终端:")
|
||||
print(f" cd {os.path.dirname(os.path.abspath(__file__))}")
|
||||
print("2. Install dependencies / 安装依赖:")
|
||||
print(" pip install -r requirements.txt")
|
||||
print("3. If using portable ComfyUI / 如果使用便携版 ComfyUI:")
|
||||
print(" path/to/python_embeded/python.exe -m pip install -r requirements.txt")
|
||||
print("!" * 50 + "\n")
|
||||
pass
|
||||
|
||||
def get_all_speakers():
|
||||
speakers = set()
|
||||
qwen_models_dir = os.path.join(folder_paths.models_dir, "Qwen3-TTS-Models")
|
||||
if os.path.exists(qwen_models_dir):
|
||||
for d in os.listdir(qwen_models_dir):
|
||||
path = os.path.join(qwen_models_dir, d)
|
||||
if os.path.isdir(path):
|
||||
config_path = os.path.join(path, "config.json")
|
||||
if os.path.exists(config_path):
|
||||
try:
|
||||
with open(config_path, "r", encoding="utf-8") as f:
|
||||
config = json.load(f)
|
||||
if "talker_config" in config and "spk_id" in config["talker_config"]:
|
||||
# Capitalize keys for better UI display (e.g. "vivian" -> "Vivian")
|
||||
# This helps match default values like "Vivian" in workflows
|
||||
keys = [k.capitalize() for k in config["talker_config"]["spk_id"].keys()]
|
||||
speakers.update(keys)
|
||||
except Exception as e:
|
||||
print(f"Failed to read config for {d}: {e}")
|
||||
|
||||
if not speakers:
|
||||
return ["Vivian", "Serena", "Ryan"] # Fallback defaults
|
||||
|
||||
return sorted(list(speakers))
|
||||
|
||||
KNOWN_MODELS = [
|
||||
"Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice",
|
||||
"Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign",
|
||||
"Qwen/Qwen3-TTS-12Hz-1.7B-Base",
|
||||
"Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice",
|
||||
"Qwen/Qwen3-TTS-12Hz-0.6B-Base",
|
||||
]
|
||||
|
||||
class TDQwen3TTSModelLoader:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
qwen_models_dir = os.path.join(folder_paths.models_dir, "Qwen3-TTS-Models")
|
||||
if not os.path.exists(qwen_models_dir):
|
||||
try:
|
||||
os.makedirs(qwen_models_dir, exist_ok=True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Get existing directories
|
||||
existing_models = []
|
||||
if os.path.exists(qwen_models_dir):
|
||||
existing_models = [d for d in os.listdir(qwen_models_dir) if os.path.isdir(os.path.join(qwen_models_dir, d))]
|
||||
|
||||
# Merge known models and existing models (deduplicate by checking if known model's basename exists)
|
||||
model_list = list(KNOWN_MODELS)
|
||||
for existing in existing_models:
|
||||
# Check if this existing folder is already covered by a known model (by basename)
|
||||
is_known = False
|
||||
for known in KNOWN_MODELS:
|
||||
if known.split("/")[-1] == existing:
|
||||
is_known = True
|
||||
break
|
||||
if not is_known:
|
||||
model_list.append(existing)
|
||||
|
||||
if not model_list:
|
||||
model_list = ["Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice"]
|
||||
|
||||
return {
|
||||
"required": {
|
||||
"model_path": (model_list, {"default": "Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice"}),
|
||||
"precision": (["bf16", "fp16", "fp32"], {"default": "bf16"}),
|
||||
"device": (["cuda", "cpu"], {"default": "cuda"}),
|
||||
"attn_implementation": (["sdpa", "flash_attention_2", "eager"], {"default": "sdpa"}),
|
||||
"auto_download": ("BOOLEAN", {"default": False, "label_on": "Enable", "label_off": "Disable"}),
|
||||
"download_source": (["ModelScope", "HuggingFace"], {"default": "ModelScope"}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("QWEN3_TTS_MODEL",)
|
||||
RETURN_NAMES = ("model",)
|
||||
FUNCTION = "load_model"
|
||||
CATEGORY = "Qwen3TTS"
|
||||
|
||||
def load_model(self, model_path, precision, device, attn_implementation, auto_download, download_source):
|
||||
dtype = torch.bfloat16 if precision == "bf16" else torch.float16 if precision == "fp16" else torch.float32
|
||||
|
||||
print(f"Loading Qwen3-TTS Model from {model_path} (Precision: {precision}, Device: {device}, Attn: {attn_implementation})...")
|
||||
|
||||
qwen_models_dir = os.path.join(folder_paths.models_dir, "Qwen3-TTS-Models")
|
||||
|
||||
# Determine local path
|
||||
if "/" in model_path:
|
||||
local_name = model_path.split("/")[-1]
|
||||
else:
|
||||
local_name = model_path
|
||||
|
||||
local_path = os.path.join(qwen_models_dir, local_name)
|
||||
|
||||
# Check if model exists
|
||||
if not os.path.exists(local_path):
|
||||
if auto_download:
|
||||
print(f"Model not found at {local_path}. Attempting to download from {download_source}...")
|
||||
try:
|
||||
self.download_model(model_path, local_path, download_source)
|
||||
except Exception as e:
|
||||
raise RuntimeError(f"Failed to download model {model_path}: {e}")
|
||||
else:
|
||||
raise FileNotFoundError(f"Model not found at {local_path} and auto_download is disabled. Please enable auto_download or manually place the model in {qwen_models_dir}.")
|
||||
|
||||
print(f"Loading model from {local_path}...")
|
||||
model = Qwen3TTSModel.from_pretrained(
|
||||
local_path,
|
||||
device_map=device,
|
||||
dtype=dtype,
|
||||
attn_implementation=attn_implementation,
|
||||
)
|
||||
return (model,)
|
||||
|
||||
def download_model(self, model_id, local_dir, source):
|
||||
# Handle cases where user selected a custom folder name that isn't a repo ID
|
||||
if "/" not in model_id:
|
||||
# If it's not a repo ID, we can't download it unless we know the mapping.
|
||||
# But our INPUT_TYPES puts Repo IDs in the list.
|
||||
# If user manually typed a folder name, we assume they know what they are doing or it exists.
|
||||
# If it doesn't exist and isn't a repo ID, we can't download.
|
||||
raise ValueError(f"Cannot download '{model_id}' because it does not look like a valid Repo ID (e.g. User/Model).")
|
||||
|
||||
if source == "ModelScope":
|
||||
try:
|
||||
from modelscope import snapshot_download
|
||||
except ImportError:
|
||||
raise ImportError("ModelScope is not installed. Please run: pip install -U modelscope")
|
||||
|
||||
print(f"Downloading {model_id} from ModelScope to {local_dir}...")
|
||||
snapshot_download(model_id, local_dir=local_dir)
|
||||
|
||||
elif source == "HuggingFace":
|
||||
try:
|
||||
from huggingface_hub import snapshot_download
|
||||
except ImportError:
|
||||
raise ImportError("HuggingFace Hub is not installed. Please run: pip install -U huggingface_hub")
|
||||
|
||||
print(f"Downloading {model_id} from HuggingFace to {local_dir}...")
|
||||
snapshot_download(repo_id=model_id, local_dir=local_dir)
|
||||
|
||||
class TDQwen3TTSCustomVoice:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
speakers = get_all_speakers()
|
||||
return {
|
||||
"required": {
|
||||
"model": ("QWEN3_TTS_MODEL",),
|
||||
"text": ("STRING", {"multiline": True, "default": "你好,我是Qwen3-TTS。"}),
|
||||
"speaker": (speakers, {"default": speakers[0] if speakers else "Vivian"}),
|
||||
"language": (["Auto", "Chinese", "English", "Japanese", "Korean", "German", "French", "Russian", "Portuguese", "Spanish", "Italian"], {"default": "Auto"}),
|
||||
},
|
||||
"optional": {
|
||||
"instruct": ("STRING", {"multiline": True, "default": ""}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
RETURN_NAMES = ("audio",)
|
||||
FUNCTION = "generate"
|
||||
CATEGORY = "Qwen3TTS"
|
||||
|
||||
def generate(self, model, text, speaker, language, instruct=""):
|
||||
if language == "Auto":
|
||||
language = None
|
||||
|
||||
print(f"正在为说话人 {speaker} 生成自定义语音...")
|
||||
wavs, sr = model.generate_custom_voice(
|
||||
text=text,
|
||||
speaker=speaker,
|
||||
language=language,
|
||||
instruct=instruct if instruct else None
|
||||
)
|
||||
|
||||
# ComfyUI 音频格式: {'waveform': tensor [batch, channels, samples], 'sample_rate': int}
|
||||
# wavs[0] 是 [samples] (单声道)
|
||||
audio_tensor = torch.from_numpy(wavs[0]).unsqueeze(0).unsqueeze(0)
|
||||
return ({"waveform": audio_tensor, "sample_rate": sr},)
|
||||
|
||||
class TDQwen3TTSDefineSpeaker:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"audio": ("AUDIO",),
|
||||
"name": ("STRING", {"default": "MySpeaker"}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("SPEAKER",)
|
||||
RETURN_NAMES = ("speaker",)
|
||||
FUNCTION = "define_speaker"
|
||||
CATEGORY = "Qwen3TTS"
|
||||
|
||||
def define_speaker(self, audio, name):
|
||||
# Remove existing with same name to avoid duplicates/allow override
|
||||
name_clean = name.strip()
|
||||
print(f"Defined speaker '{name_clean}'")
|
||||
return ({"name": name_clean, "audio": audio},)
|
||||
|
||||
class TDQwen3TTSBatchGenerateSpeaker:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"model": ("QWEN3_TTS_MODEL",),
|
||||
"speakers_config": ("STRING", {"default": "[]", "multiline": True}), # JSON string (Widget or Input)
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("SPEAKER_LIST",)
|
||||
RETURN_NAMES = ("speakers",)
|
||||
FUNCTION = "batch_generate"
|
||||
CATEGORY = "Qwen3TTS"
|
||||
|
||||
def batch_generate(self, model, speakers_config):
|
||||
config_list = []
|
||||
if isinstance(speakers_config, list):
|
||||
config_list = speakers_config
|
||||
elif isinstance(speakers_config, str):
|
||||
try:
|
||||
config_list = json.loads(speakers_config)
|
||||
except json.JSONDecodeError:
|
||||
# Try parsing as Python literal (single quotes)
|
||||
try:
|
||||
config_list = ast.literal_eval(speakers_config)
|
||||
if not isinstance(config_list, list):
|
||||
print("Error: speakers_config evaluated to non-list.")
|
||||
return ([],)
|
||||
except (ValueError, SyntaxError):
|
||||
print("Error parsing speakers config. Ensure it is valid JSON or Python List.")
|
||||
return ([],)
|
||||
else:
|
||||
print(f"Error: speakers_config must be a JSON string or a list, got {type(speakers_config)}")
|
||||
return ([],)
|
||||
|
||||
generated_speakers = []
|
||||
batch_outputs = [] # For UI preview
|
||||
|
||||
print(f"Batch generating {len(config_list)} speakers...")
|
||||
|
||||
output_dir = folder_paths.get_temp_directory()
|
||||
|
||||
for item in config_list:
|
||||
name = item.get("name", "").strip()
|
||||
instruct = item.get("instruct", "").strip()
|
||||
text = item.get("text", "").strip()
|
||||
|
||||
if not name or not instruct or not text:
|
||||
print(f"Skipping invalid speaker config: {item}")
|
||||
continue
|
||||
|
||||
print(f"Generating speaker '{name}' with instruct: '{instruct}'...")
|
||||
try:
|
||||
# Use Voice Design logic
|
||||
wavs, sr = model.generate_voice_design(
|
||||
text=text,
|
||||
instruct=instruct,
|
||||
language=None # Auto
|
||||
)
|
||||
|
||||
# Check if wavs is empty or None
|
||||
if not wavs or len(wavs) == 0:
|
||||
print(f"Warning: No audio generated for speaker '{name}'")
|
||||
continue
|
||||
|
||||
# Convert to ComfyUI AUDIO format:
|
||||
wav_data = wavs[0]
|
||||
|
||||
# Ensure it's a tensor
|
||||
if isinstance(wav_data, np.ndarray):
|
||||
wav_tensor = torch.from_numpy(wav_data)
|
||||
else:
|
||||
wav_tensor = wav_data
|
||||
|
||||
# Ensure dimensions: [batch, channels, samples]
|
||||
if wav_tensor.ndim == 1:
|
||||
wav_tensor = wav_tensor.unsqueeze(0).unsqueeze(0) # [1, 1, samples]
|
||||
elif wav_tensor.ndim == 2:
|
||||
wav_tensor = wav_tensor.unsqueeze(0) # [1, channels, samples]
|
||||
|
||||
audio_dict = {"waveform": wav_tensor, "sample_rate": sr}
|
||||
|
||||
generated_speakers.append({"name": name, "audio": audio_dict, "instruct": instruct})
|
||||
|
||||
# Save preview audio
|
||||
filename = f"Qwen3TTS_Batch_{name}_{''.join(random.choices(string.ascii_letters + string.digits, k=8))}.wav"
|
||||
filepath = os.path.join(output_dir, filename)
|
||||
|
||||
# Save using torchaudio
|
||||
# torchaudio.save expects [channels, samples]
|
||||
# wav_tensor is [1, 1, samples], so squeeze(0) -> [1, samples]
|
||||
torchaudio.save(filepath, wav_tensor.squeeze(0), sr)
|
||||
|
||||
batch_outputs.append({
|
||||
"name": name,
|
||||
"filename": filename,
|
||||
"subfolder": "",
|
||||
"type": "temp"
|
||||
})
|
||||
|
||||
print(f"Successfully generated speaker '{name}'")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Failed to generate speaker '{name}': {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
return {"ui": {"batch_outputs": batch_outputs}, "result": (generated_speakers,)}
|
||||
|
||||
class TDQwen3TTSMultiDialog:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
speakers = get_all_speakers()
|
||||
return {
|
||||
"required": {
|
||||
"model": ("QWEN3_TTS_MODEL",),
|
||||
"text": ("STRING", {"multiline": True, "default": "Vivian: 你好!\nRyan: 你好,今天天气真不错。\nRoleA: 我是自定义角色A。\nVivian: 欢迎你!"}),
|
||||
"interval": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 5.0, "step": 0.1}),
|
||||
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||
},
|
||||
"optional": {
|
||||
"speaker_list": ("SPEAKER_LIST",), # New input for batch speakers
|
||||
"speaker_1": ("SPEAKER",), # Add explicit initial slot to ensure visibility before JS loads
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
RETURN_NAMES = ("audio",)
|
||||
FUNCTION = "generate"
|
||||
CATEGORY = "Qwen3TTS"
|
||||
|
||||
def generate(self, model, text, interval=0.5, seed=0, speaker_list=None, **kwargs):
|
||||
|
||||
language = None # Auto identify from audio
|
||||
|
||||
# 构建自定义角色字典
|
||||
custom_roles = {}
|
||||
|
||||
# Add from speaker_list (batch input)
|
||||
if speaker_list:
|
||||
# Handle case where speaker_list might be a single dictionary (if connected incorrectly but passed)
|
||||
if isinstance(speaker_list, dict):
|
||||
if "name" in speaker_list:
|
||||
custom_roles[speaker_list["name"]] = speaker_list
|
||||
elif isinstance(speaker_list, list):
|
||||
for spk in speaker_list:
|
||||
if isinstance(spk, dict) and "name" in spk:
|
||||
# Store full speaker object (name, audio, instruct)
|
||||
custom_roles[spk["name"]] = spk
|
||||
|
||||
# Add from individual inputs (kwargs)
|
||||
for key, value in kwargs.items():
|
||||
if key.startswith("speaker_") and value is not None:
|
||||
custom_roles[value["name"]] = value
|
||||
|
||||
if custom_roles:
|
||||
print(f"Loaded {len(custom_roles)} custom speakers: {list(custom_roles.keys())}")
|
||||
else:
|
||||
print("No custom speakers loaded.")
|
||||
|
||||
# Create lowercase mapping for custom roles to support case-insensitive matching
|
||||
custom_roles_lower = {k.lower(): k for k in custom_roles.keys()}
|
||||
|
||||
# 1. 解析文本
|
||||
dialog_items = []
|
||||
lines = text.strip().split('\n')
|
||||
|
||||
# Default to the first custom speaker if available, otherwise "Vivian"
|
||||
if custom_roles:
|
||||
current_speaker = list(custom_roles.keys())[0]
|
||||
else:
|
||||
current_speaker = "Vivian"
|
||||
|
||||
available_speakers = get_all_speakers()
|
||||
# Create a lowercase mapping for case-insensitive lookup
|
||||
available_speakers_lower = {s.lower(): s for s in available_speakers}
|
||||
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
|
||||
# 尝试解析 "Speaker: Text" 或 "[Speaker]: Text"
|
||||
if ":" in line or ":" in line:
|
||||
# 统一冒号
|
||||
line_fixed = line.replace(":", ":")
|
||||
parts = line_fixed.split(":", 1)
|
||||
possible_speaker = parts[0].strip().replace("[", "").replace("]", "")
|
||||
content = parts[1].strip()
|
||||
|
||||
# 优先级:自定义角色 > 预设角色
|
||||
|
||||
# 1. Exact match custom
|
||||
if possible_speaker in custom_roles:
|
||||
current_speaker = possible_speaker
|
||||
dialog_items.append((current_speaker, content))
|
||||
# 2. Case-insensitive match custom
|
||||
elif possible_speaker.lower() in custom_roles_lower:
|
||||
current_speaker = custom_roles_lower[possible_speaker.lower()]
|
||||
dialog_items.append((current_speaker, content))
|
||||
# 3. Exact match preset
|
||||
elif possible_speaker in available_speakers:
|
||||
current_speaker = possible_speaker
|
||||
dialog_items.append((current_speaker, content))
|
||||
# 4. Case-insensitive match preset
|
||||
elif possible_speaker.lower() in available_speakers_lower:
|
||||
current_speaker = available_speakers_lower[possible_speaker.lower()]
|
||||
dialog_items.append((current_speaker, content))
|
||||
else:
|
||||
# 如果不是已知角色,归为当前 speaker 的延续
|
||||
print(f"Warning: Speaker '{possible_speaker}' not found in custom or preset speakers. Treating as text for '{current_speaker}'.")
|
||||
dialog_items.append((current_speaker, line))
|
||||
else:
|
||||
# 没有冒号,认为是当前角色的延续
|
||||
dialog_items.append((current_speaker, line))
|
||||
|
||||
# 2. 生成音频
|
||||
all_wavs = []
|
||||
sample_rate = None
|
||||
|
||||
print(f"开始生成多人对话,共 {len(dialog_items)} 个片段...")
|
||||
|
||||
# Detect model type
|
||||
model_type = getattr(model.model, "tts_model_type", "unknown")
|
||||
print(f"Detected model type: {model_type}")
|
||||
|
||||
for i, (speaker, content) in enumerate(dialog_items):
|
||||
if not content:
|
||||
continue
|
||||
|
||||
# Set deterministic seed based on global seed + speaker name hash
|
||||
# This ensures that the same speaker always gets the same random seed for generation
|
||||
# Use & 0xffffffff to ensure adler32 result is treated consistently
|
||||
speaker_seed = (seed + (zlib.adler32(speaker.encode('utf-8')) & 0xffffffff)) % 0xffffffffffffffff
|
||||
torch.manual_seed(speaker_seed)
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.manual_seed(speaker_seed)
|
||||
|
||||
print(f"[{i+1}/{len(dialog_items)}] 正在为 {speaker} 生成: {content[:20]}...")
|
||||
try:
|
||||
wav = None
|
||||
sr = None
|
||||
|
||||
# Check if it is a custom role
|
||||
if speaker in custom_roles:
|
||||
role_data = custom_roles[speaker]
|
||||
|
||||
if model_type == "voice_design":
|
||||
# For Voice Design model, we MUST use instruct
|
||||
instruct = role_data.get("instruct")
|
||||
if instruct:
|
||||
print(f" - 使用 Voice Design (Instruct: {instruct[:20]}...)...")
|
||||
wavs, sr = model.generate_voice_design(
|
||||
text=content,
|
||||
instruct=instruct,
|
||||
language=language
|
||||
)
|
||||
wav = wavs[0]
|
||||
else:
|
||||
print(f"Error: Speaker '{speaker}' has no 'instruct' and model is Voice Design. Skipping.")
|
||||
continue
|
||||
|
||||
elif model_type == "base":
|
||||
# For Base model, use Voice Clone (requires audio)
|
||||
if "audio" in role_data and role_data["audio"]:
|
||||
ref_audio = role_data["audio"]
|
||||
waveform = ref_audio["waveform"]
|
||||
ref_sr = ref_audio["sample_rate"]
|
||||
|
||||
# Prepare ref audio
|
||||
ref_wav_tensor = waveform[0]
|
||||
if ref_wav_tensor.shape[0] > 1:
|
||||
ref_wav_tensor = torch.mean(ref_wav_tensor, dim=0, keepdim=True)
|
||||
ref_wav_np = ref_wav_tensor.squeeze(0).numpy()
|
||||
|
||||
print(f" - 使用 Voice Clone (Base Model)...")
|
||||
wavs, sr = model.generate_voice_clone(
|
||||
text=content,
|
||||
language=language,
|
||||
ref_audio=(ref_wav_np, ref_sr),
|
||||
ref_text=None,
|
||||
x_vector_only_mode=True
|
||||
)
|
||||
wav = wavs[0]
|
||||
else:
|
||||
print(f"Error: Speaker '{speaker}' has no 'audio' and model is Base. Skipping.")
|
||||
continue
|
||||
|
||||
elif model_type == "custom_voice":
|
||||
# Try fallback to preset if name matches
|
||||
supported = model.get_supported_speakers()
|
||||
if supported and speaker.lower() in [s.lower() for s in supported]:
|
||||
print(f" - Fallback to Preset Speaker '{speaker}'...")
|
||||
wavs, sr = model.generate_custom_voice(
|
||||
text=content,
|
||||
speaker=speaker,
|
||||
language=language
|
||||
)
|
||||
wav = wavs[0]
|
||||
else:
|
||||
print(f"Error: CustomVoice model cannot generate custom speaker '{speaker}'.")
|
||||
continue
|
||||
else:
|
||||
print(f"Error: Unknown model type '{model_type}'. Cannot determine generation method.")
|
||||
continue
|
||||
|
||||
else:
|
||||
# Preset Speaker (not in custom_roles)
|
||||
if model_type == "custom_voice":
|
||||
print(f" - 使用 Custom Voice (Preset: {speaker})...")
|
||||
wavs, sr = model.generate_custom_voice(
|
||||
text=content,
|
||||
speaker=speaker,
|
||||
language=language,
|
||||
instruct=None
|
||||
)
|
||||
wav = wavs[0]
|
||||
else:
|
||||
print(f"Error: Model type '{model_type}' does not support preset speaker '{speaker}'. Please define '{speaker}' as a custom role with an 'instruct' (for Voice Design) or 'audio' (for Base).")
|
||||
continue
|
||||
|
||||
if sample_rate is None:
|
||||
sample_rate = sr
|
||||
elif sample_rate != sr:
|
||||
print(f"Warning: Sample rate mismatch {sr} vs {sample_rate}, skipping resampling for now (assuming compatible).")
|
||||
|
||||
all_wavs.append(wav)
|
||||
|
||||
# 添加间隔
|
||||
if interval > 0 and i < len(dialog_items) - 1:
|
||||
silence_samples = int(interval * sr)
|
||||
silence = np.zeros(silence_samples, dtype=np.float32)
|
||||
all_wavs.append(silence)
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error generating segment for {speaker}: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
continue
|
||||
|
||||
if not all_wavs:
|
||||
# 返回静音或报错
|
||||
print("Warning: No audio generated.")
|
||||
# 返回 1秒静音
|
||||
sr = sample_rate if sample_rate else 24000
|
||||
silence = np.zeros(sr, dtype=np.float32)
|
||||
audio_tensor = torch.from_numpy(silence).unsqueeze(0).unsqueeze(0)
|
||||
return ({"waveform": audio_tensor, "sample_rate": sr},)
|
||||
|
||||
# 3. 拼接
|
||||
final_wav = np.concatenate(all_wavs)
|
||||
|
||||
# 转换为 tensor [1, 1, samples]
|
||||
audio_tensor = torch.from_numpy(final_wav).unsqueeze(0).unsqueeze(0)
|
||||
|
||||
return ({"waveform": audio_tensor, "sample_rate": sample_rate},)
|
||||
|
||||
class TDQwen3TTSVoiceDesign:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"model": ("QWEN3_TTS_MODEL",),
|
||||
"text": ("STRING", {"multiline": True, "default": "这是一个语音设计测试。"}),
|
||||
"instruct": ("STRING", {"multiline": True, "default": "一个年轻女性的声音,语气愉快。"}),
|
||||
"language": (["Auto", "Chinese", "English", "Japanese", "Korean", "German", "French", "Russian", "Portuguese", "Spanish", "Italian"], {"default": "Auto"}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
RETURN_NAMES = ("audio",)
|
||||
FUNCTION = "generate"
|
||||
CATEGORY = "Qwen3TTS"
|
||||
|
||||
def generate(self, model, text, instruct, language):
|
||||
if language == "Auto":
|
||||
language = None
|
||||
|
||||
print(f"正在使用指令生成语音设计: {instruct}...")
|
||||
wavs, sr = model.generate_voice_design(
|
||||
text=text,
|
||||
instruct=instruct,
|
||||
language=language
|
||||
)
|
||||
|
||||
audio_tensor = torch.from_numpy(wavs[0]).unsqueeze(0).unsqueeze(0)
|
||||
return ({"waveform": audio_tensor, "sample_rate": sr},)
|
||||
|
||||
class TDQwen3TTSVoiceClone:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"model": ("QWEN3_TTS_MODEL",),
|
||||
"text": ("STRING", {"multiline": True, "default": "这是一个语音克隆测试。"}),
|
||||
"ref_audio": ("AUDIO",),
|
||||
"language": (["Auto", "Chinese", "English", "Japanese", "Korean", "German", "French", "Russian", "Portuguese", "Spanish", "Italian"], {"default": "Auto"}),
|
||||
},
|
||||
"optional": {
|
||||
"ref_text": ("STRING", {"multiline": True, "default": ""}),
|
||||
"x_vector_only_mode": ("BOOLEAN", {"default": False, "label_on": "Enable", "label_off": "Disable"}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
RETURN_NAMES = ("audio",)
|
||||
FUNCTION = "generate"
|
||||
CATEGORY = "Qwen3TTS"
|
||||
|
||||
def generate(self, model, text, ref_audio, language, ref_text="", x_vector_only_mode=False):
|
||||
if language == "Auto":
|
||||
language = None
|
||||
|
||||
waveform = ref_audio["waveform"] # [batch, channels, samples]
|
||||
sr = ref_audio["sample_rate"]
|
||||
|
||||
# 处理参考音频:取第一个批次,如果多声道则混合为单声道,最后转为 numpy
|
||||
ref_wav_tensor = waveform[0] # [channels, samples]
|
||||
if ref_wav_tensor.shape[0] > 1:
|
||||
print(f"检测到多声道音频,正在混合为单声道...")
|
||||
ref_wav_tensor = torch.mean(ref_wav_tensor, dim=0, keepdim=True)
|
||||
|
||||
ref_wav_np = ref_wav_tensor.squeeze(0).numpy() # [samples]
|
||||
|
||||
# 参考 test_model_12hz_base.py 的实现
|
||||
# 如果未启用 x_vector_only_mode,则必须提供 ref_text
|
||||
if not x_vector_only_mode and not ref_text.strip():
|
||||
raise ValueError("必须填写参考文本(ref_text),内容为参考音频的实际说话内容。如果无法提供文本,请开启 'x_vector_only_mode'。")
|
||||
|
||||
print(f"正在生成语音克隆 (x_vector_only_mode={x_vector_only_mode})...")
|
||||
wavs, out_sr = model.generate_voice_clone(
|
||||
text=text,
|
||||
language=language,
|
||||
ref_audio=(ref_wav_np, sr),
|
||||
ref_text=ref_text if ref_text else None,
|
||||
x_vector_only_mode=x_vector_only_mode
|
||||
)
|
||||
|
||||
audio_tensor = torch.from_numpy(wavs[0]).unsqueeze(0).unsqueeze(0)
|
||||
return ({"waveform": audio_tensor, "sample_rate": out_sr},)
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"TDQwen3TTSModelLoader": TDQwen3TTSModelLoader,
|
||||
"TDQwen3TTSCustomVoice": TDQwen3TTSCustomVoice,
|
||||
"TDQwen3TTSMultiDialog": TDQwen3TTSMultiDialog,
|
||||
"TDQwen3TTSDefineSpeaker": TDQwen3TTSDefineSpeaker,
|
||||
"TDQwen3TTSBatchGenerateSpeaker": TDQwen3TTSBatchGenerateSpeaker,
|
||||
"TDQwen3TTSVoiceDesign": TDQwen3TTSVoiceDesign,
|
||||
"TDQwen3TTSVoiceClone": TDQwen3TTSVoiceClone,
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"TDQwen3TTSModelLoader": "TD Qwen3 TTS Model Loader",
|
||||
"TDQwen3TTSCustomVoice": "TD Qwen3 TTS Custom Voice",
|
||||
"TDQwen3TTSMultiDialog": "TD Qwen3 TTS Multi Dialog",
|
||||
"TDQwen3TTSDefineSpeaker": "TD Qwen3 TTS Define Speaker",
|
||||
"TDQwen3TTSBatchGenerateSpeaker": "TD Qwen3 TTS Batch Generate Speaker",
|
||||
"TDQwen3TTSVoiceDesign": "TD Qwen3 TTS Voice Design",
|
||||
"TDQwen3TTSVoiceClone": "TD Qwen3 TTS Voice Clone",
|
||||
}
|
||||
@@ -0,0 +1,517 @@
|
||||
[
|
||||
{
|
||||
"path": ".github/workflows/publish.yml",
|
||||
"size": 647,
|
||||
"sha256": "0232916cbe1a18f885df5514f4b3480fd29fb8fac7c53a8a2bc92a862d61154e"
|
||||
},
|
||||
{
|
||||
"path": ".gitignore",
|
||||
"size": 122,
|
||||
"sha256": "1748bd83608a34dccd2d16c2b45ebd066e7172f1d5135b87cdd2f300e6b27697"
|
||||
},
|
||||
{
|
||||
"path": ".gitmodules",
|
||||
"size": 96,
|
||||
"sha256": "ead3e9a3279ccd0b9310f0d520ba3ca88a8e962e1451608180aa740c9c835153"
|
||||
},
|
||||
{
|
||||
"path": "LICENSE.txt",
|
||||
"size": 35149,
|
||||
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986"
|
||||
},
|
||||
{
|
||||
"path": "README.md",
|
||||
"size": 51528,
|
||||
"sha256": "052ed88a4183dcc2450f9f9275264de97520c44f0e966c032278586e295c5632"
|
||||
},
|
||||
{
|
||||
"path": "__init__.py",
|
||||
"size": 21951,
|
||||
"sha256": "c28bb39a58fff73b476f3304e26ef5d57e3d5bec7069f86b0b0f69a9528195c0"
|
||||
},
|
||||
{
|
||||
"path": "custom_wildcards/put_wildcards_here",
|
||||
"size": 0,
|
||||
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
},
|
||||
{
|
||||
"path": "docs/wildcards/README.md",
|
||||
"size": 1225,
|
||||
"sha256": "771e9555b7fae14b2019e8daad0a5411d59178747c115448282cfeb28095e87d"
|
||||
},
|
||||
{
|
||||
"path": "docs/wildcards/SUMMARY.md",
|
||||
"size": 4425,
|
||||
"sha256": "b3e5fc6343c6236a02efac5ba6e7404d74388bb13a2e01df14f63329628e4c25"
|
||||
},
|
||||
{
|
||||
"path": "docs/wildcards/WILDCARD_SYSTEM_DESIGN.md",
|
||||
"size": 24923,
|
||||
"sha256": "1642e920a75f9f14b25a121f25b64914344b2fb54c22b43c936efb3cbeedf853"
|
||||
},
|
||||
{
|
||||
"path": "docs/wildcards/WILDCARD_SYSTEM_PRD.md",
|
||||
"size": 15080,
|
||||
"sha256": "1033516c3677998bc0f76d0c0fa0faeb2d36bc13c708bac219cde77ced59077b"
|
||||
},
|
||||
{
|
||||
"path": "docs/wildcards/WILDCARD_TESTING_GUIDE.md",
|
||||
"size": 9907,
|
||||
"sha256": "fb03db6478a77a2419acf302f5b97b4c51c9f32f072a9166279081c325675980"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/1-FaceDetailer.jpg",
|
||||
"size": 64932,
|
||||
"sha256": "c1a4ed7a9079d45a01a52043d9672d2646fdd28b88eac958e51dc2b38aa438c0"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/1-FaceDetailer.json",
|
||||
"size": 21147,
|
||||
"sha256": "bce9cc29c07ba8995bf921f919392066cd4bfaba4dd33a17b035168deb7c947c"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/2-MaskDetailer.jpg",
|
||||
"size": 114261,
|
||||
"sha256": "1abd1823bed26d5e8c92707c0369d41b4f7c6a0629e70c3fa92fcc914585dc8a"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/2-MaskDetailer.json",
|
||||
"size": 11958,
|
||||
"sha256": "13c151c9f0bb7779020fee73a903819c24ca783e355e37b176e6977bddedbb3f"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/3-SEGSDetailer.jpg",
|
||||
"size": 42824,
|
||||
"sha256": "9f4aed9e96b46408fba0ed644ce1a86ffa7ca3cfd373c2849a2cc1fc5f243175"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/3-SEGSDetailer.json",
|
||||
"size": 19373,
|
||||
"sha256": "905062125d64bce059d9554e5adeb13e3ca3654109ef07a7a31ad6178c5b7b6d"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/4-MakeTileSEGS-Upscale.jpg",
|
||||
"size": 108834,
|
||||
"sha256": "b1d3d9a3563821ba82a6277610e83ec2fe20473679ebb25c70c811a252e06ecd"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/4-MakeTileSEGS-Upscale.json",
|
||||
"size": 31936,
|
||||
"sha256": "a63092b1dd1ae7d508b9818e57b141894fdd017bc15d8b94fd731bfea6fdebab"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/5-PreviewDetailerHookProvider.jpg",
|
||||
"size": 68539,
|
||||
"sha256": "f37a67d0b42e4d94950a4d27de403b022d684824571021c702196a2989bf8349"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/5-PreviewDetailerHookProvider.json",
|
||||
"size": 29902,
|
||||
"sha256": "b20ee55ffae8fb564f6d3806b6b062ff81e54a3bd1c8ebd80421b21613694163"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/5-prompt-per-tile.jpg",
|
||||
"size": 130918,
|
||||
"sha256": "232bde22503e087e47c391bb91bbcc830c9882889ac715c1ec139667ea3d2c03"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/5-prompt-per-tile.json",
|
||||
"size": 21444,
|
||||
"sha256": "501fc470c82e93c5e619e54ca16bc45e9e5c8aed4823d9c7b4884ad70f14ee6b"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/6-DetailerWildcard.jpg",
|
||||
"size": 538538,
|
||||
"sha256": "f80a2add23387329e86abfb00382d1efd818df33a8fa19c93cdf75a478a491df"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/6-DetailerWildcard.json",
|
||||
"size": 21235,
|
||||
"sha256": "1e7c57991611bd1277e9367b278a55efcc82a1e9e737ca510947fb480650757c"
|
||||
},
|
||||
{
|
||||
"path": "install.py",
|
||||
"size": 3971,
|
||||
"sha256": "9520f8f0c099b78d78e47316323e47b31597cb10de3f4017565fc986eabd1e8e"
|
||||
},
|
||||
{
|
||||
"path": "js/common.js",
|
||||
"size": 7809,
|
||||
"sha256": "0b52de41ef5d5e51add0dd1051ac708ea882aa5b8ce0a10779ae1d2cbbe7d795"
|
||||
},
|
||||
{
|
||||
"path": "js/impact-image-util.js",
|
||||
"size": 5699,
|
||||
"sha256": "6a2063c647ac7bcd1db150b9bdc4b1883721bf33990be5c1773a760d0a71fd38"
|
||||
},
|
||||
{
|
||||
"path": "js/impact-pack.js",
|
||||
"size": 28835,
|
||||
"sha256": "03d2ea39e66bd669166b8dbb5e3eb7b25ac23e6a761bce5cacde6ca979a42a71"
|
||||
},
|
||||
{
|
||||
"path": "js/impact-sam-editor.js",
|
||||
"size": 19863,
|
||||
"sha256": "fdc061010d8c00505af3a3fc95db12ae01f2ffa0bc8a2162dc05f6c17a64a7fd"
|
||||
},
|
||||
{
|
||||
"path": "js/impact-segs-picker.js",
|
||||
"size": 5725,
|
||||
"sha256": "ed1b8f380befcd21651af11ac46ac2fd9348d57ea8ef3d752634da498f6ce0c5"
|
||||
},
|
||||
{
|
||||
"path": "js/mask-rect-area-advanced.js",
|
||||
"size": 16638,
|
||||
"sha256": "19138d8e1d2c0dcc2066adc3541977837b115843e139a25b5d099d5649444f81"
|
||||
},
|
||||
{
|
||||
"path": "js/mask-rect-area.js",
|
||||
"size": 17842,
|
||||
"sha256": "279136cb6e3912f0f280cda23ad6fb8bfb8beb19e94ac288753eeb772214a5cf"
|
||||
},
|
||||
{
|
||||
"path": "latent.png",
|
||||
"size": 2814,
|
||||
"sha256": "1faf0cc926b0d65c8ab93e7485aea816283eb22fdeefe9682c206948c1de2043"
|
||||
},
|
||||
{
|
||||
"path": "locales/ko/nodeDefs.json",
|
||||
"size": 70753,
|
||||
"sha256": "40e46597d8772a53a3d5c93295aa290899bd83372fe82d37bd2d9c6eec5386fd"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/additional_dependencies.py",
|
||||
"size": 424,
|
||||
"sha256": "9aaaf0bd584f6006bd39ae04eaf240a3a76688a2a2f8f6dba4d6b2013438052e"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/animatediff_nodes.py",
|
||||
"size": 11434,
|
||||
"sha256": "d89c2c095c3ae2dc89a1aa9014d75c0b035c484a442cf3c1343638e61db31e15"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/bridge_nodes.py",
|
||||
"size": 22509,
|
||||
"sha256": "60ff69d1a707dce3d9bb52c3d3dd69b00e8855bde7795e736634577cd18234cc"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/config.py",
|
||||
"size": 3364,
|
||||
"sha256": "5d733ecc85bdf0cde27e5a25dc936736582767812486a566f412e53e691a20f5"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/core.py",
|
||||
"size": 99603,
|
||||
"sha256": "6dc6cfc3048ae222779841eb28c61c594106293e68730003c13d72dc73f01545"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/defs.py",
|
||||
"size": 1302,
|
||||
"sha256": "3245470dd01c49582ee9a4a626518c316c57d6ef236ed098f8d42b9554fd1757"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/detectors.py",
|
||||
"size": 29207,
|
||||
"sha256": "d9a8cfce4f4a4ca54025f6b35bd92fe22ff9732bfe5cf9f470140fde389a546c"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/hf_nodes.py",
|
||||
"size": 5431,
|
||||
"sha256": "51c56b535d0181f515b077f6b150b0ce778605461ce3fea988a9e59571535c9c"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/hook_nodes.py",
|
||||
"size": 4182,
|
||||
"sha256": "581769ce60b53fa017ac7e33eb6b6f2579efaf8b18d2e17947b5a06475e52204"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/hooks.py",
|
||||
"size": 21012,
|
||||
"sha256": "0fc1b9efbee36e5e8509dbc76300e4d6760bb8e95d637660a0f5051088dc2da6"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/impact_onnx.py",
|
||||
"size": 1399,
|
||||
"sha256": "8b838d1bdd173284d906dcb261d100c16edd13e0ea55566fa5856a59defd23d7"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/impact_pack.py",
|
||||
"size": 129693,
|
||||
"sha256": "16c91003f6508c33858193b763ad2a72a78dd8e9a83274a56897cbbd0fe80b5a"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/impact_sampling.py",
|
||||
"size": 16526,
|
||||
"sha256": "66ae5415e256004ed45376cc25172cd77e48d15d310b20c7e3f051b8dc842536"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/impact_server.py",
|
||||
"size": 23765,
|
||||
"sha256": "2e0bac8e1bc1596e63b1b51f9c0f4183aa72b48753fbe1dbd97413a82d14496d"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/logics.py",
|
||||
"size": 22496,
|
||||
"sha256": "354daeec00a5f18aeba1277c2366ae55f32bee433c469e44853d36ed6ccb37cb"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/pipe.py",
|
||||
"size": 17229,
|
||||
"sha256": "7462c32b156a17d41ce3ffaca6b12a6e4e347223a90f255a6f4c0e5743aa4c9b"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/segs_nodes.py",
|
||||
"size": 77516,
|
||||
"sha256": "c1d9fb7962a3a46da3e6ec94a88384a1b22ee9f9845a0aa722501f408bef65d1"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/segs_upscaler.py",
|
||||
"size": 5765,
|
||||
"sha256": "cb4d0adecb1a80db92a46af83569bb911e68b84264b626146e041f803073954b"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/special_samplers.py",
|
||||
"size": 39309,
|
||||
"sha256": "32647b60dd169f953b04ebdacf9e2a59c3870ecf442f01f3f76d96906283989c"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/util_nodes.py",
|
||||
"size": 24486,
|
||||
"sha256": "7ca6a382fd2d5e7c563a0c9ac15918a23b84c872ef7f64248bc485c26921c710"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/utils.py",
|
||||
"size": 21262,
|
||||
"sha256": "92853e548bbc77860bc6f6e1b582a93a7d7d0ecea278138c475f1cdc2f62cce7"
|
||||
},
|
||||
{
|
||||
"path": "modules/impact/wildcards.py",
|
||||
"size": 47830,
|
||||
"sha256": "8a0e2f2b4cafd05bfc431d22d0f563d0427f55cab51cd641369451217251161c"
|
||||
},
|
||||
{
|
||||
"path": "modules/thirdparty/noise_nodes.py",
|
||||
"size": 3428,
|
||||
"sha256": "f6266cf6f4a812324ab3058c6d9c04ae2153d02785f7d1cac21a32efec5f8904"
|
||||
},
|
||||
{
|
||||
"path": "node_list.json",
|
||||
"size": 147,
|
||||
"sha256": "c6476f5df53446e8801ec089740c293228cd0ac23b3a8c7134165e45e525b4f8"
|
||||
},
|
||||
{
|
||||
"path": "notebook/comfyui_colab_impact_pack.ipynb",
|
||||
"size": 5435,
|
||||
"sha256": "92c17ec345f68bc588bfe69285ff6b17af661bfa17a48f5842dc3994cf317636"
|
||||
},
|
||||
{
|
||||
"path": "pyproject.toml",
|
||||
"size": 745,
|
||||
"sha256": "3d6fa2cbd4b687d3d514ac41f601aae9e8a2f73c71f93adb548ccb09458a9094"
|
||||
},
|
||||
{
|
||||
"path": "requirements.txt",
|
||||
"size": 146,
|
||||
"sha256": "a8220b5c17eabc1edb99739679b65907cc17d8d4dd0980f73fe638989b4365a8"
|
||||
},
|
||||
{
|
||||
"path": "ruff.toml",
|
||||
"size": 68,
|
||||
"sha256": "e75bd15977c61ec29aa2b9966950fd64a95987424427618c3b6552da3b7b45e3"
|
||||
},
|
||||
{
|
||||
"path": "tests/README.md",
|
||||
"size": 4253,
|
||||
"sha256": "cce7304b4f820a624950402863a14be57540f441d7ebbdc8dbde5d118265b98c"
|
||||
},
|
||||
{
|
||||
"path": "tests/RUN_ALL_TESTS.md",
|
||||
"size": 1537,
|
||||
"sha256": "4a9752d276247d78c4bb2fd13c002e2be08c308df4ff70dffb35429d040f4905"
|
||||
},
|
||||
{
|
||||
"path": "tests/restart_test_server.sh",
|
||||
"size": 1882,
|
||||
"sha256": "92207b469c2030a83ab5e7b49c4b4458e70d09d9042014a67d50cee55ed0ef6d"
|
||||
},
|
||||
{
|
||||
"path": "tests/test_config_quotes.sh",
|
||||
"size": 4328,
|
||||
"sha256": "f9c6ad1cb862ce499fff4851d24d359ffaee2ab2ee7f7ab14342b83e0c878db2"
|
||||
},
|
||||
{
|
||||
"path": "tests/test_deep_nesting.sh",
|
||||
"size": 8167,
|
||||
"sha256": "e76f19b01ab0d3badee36f533dd46a9ac1fdedf7f2d0911d619370e1a6066fac"
|
||||
},
|
||||
{
|
||||
"path": "tests/test_dynamic_prompts_full.sh",
|
||||
"size": 7988,
|
||||
"sha256": "23a51b552fdf13daa55c789ce49530ed07817df736908178c6405d8b5ade1303"
|
||||
},
|
||||
{
|
||||
"path": "tests/test_edge_cases.sh",
|
||||
"size": 5949,
|
||||
"sha256": "2bb56022e3b95b6d45ffc0df87a7c2f4d922aa7cd85b491b2b80c707ad8d715c"
|
||||
},
|
||||
{
|
||||
"path": "tests/test_encoding.sh",
|
||||
"size": 5508,
|
||||
"sha256": "ea49b64fc533d6156beab2218f69b0330819080d6f0d67505d57d4bc7cd6edfd"
|
||||
},
|
||||
{
|
||||
"path": "tests/test_error_handling.sh",
|
||||
"size": 5526,
|
||||
"sha256": "a5623230828d03d1fda3047b437f4b5db8addf43e106de603324e2ad24383304"
|
||||
},
|
||||
{
|
||||
"path": "tests/test_ondemand_loading.sh",
|
||||
"size": 6950,
|
||||
"sha256": "273a2691a1f2b56802cd2e49cc2b38e7763399d2e594ef89a130904b7c1295c8"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/README.md",
|
||||
"size": 21263,
|
||||
"sha256": "be3939debb78c731aa9a8a86f9366317a04b377f336dbfa0460bb4b89737ab73"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/find_deep_transitive.py",
|
||||
"size": 5863,
|
||||
"sha256": "c518baa0b863cfc8f4b052755410e88d28b6de345783772c6f02aee728a58fb9"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/find_transitive_wildcards.sh",
|
||||
"size": 3781,
|
||||
"sha256": "d8ea0e9f2b29258d4ba40db523159c8640677707339cec86568ccd1ae6afa211"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/run_quick_test.sh",
|
||||
"size": 2956,
|
||||
"sha256": "e55b5743358444c332601bdd64b4f4aa68f32eb6f318afeb213bb280fbc59c52"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/samples/README.md",
|
||||
"size": 6409,
|
||||
"sha256": "74a0fd21a65ab7482425b4b481d2eea97f7f9c40c91472fa97829c04ec6e809f"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/test_lazy_load_api.sh",
|
||||
"size": 7153,
|
||||
"sha256": "b7c5b2ca8f343b864bd5b433dce1932b75d2fa033e544f4dfc3b7fda3db8077e"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/test_lazy_load_verification.py",
|
||||
"size": 7687,
|
||||
"sha256": "9d7bd05162aa52e74fd1b586ef5f869012398cdf2cd361b1eda3b3d0b4a5716b"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/test_progressive_loading.py",
|
||||
"size": 9361,
|
||||
"sha256": "3a2ac369b40fe77a52dbd04720a84bc1727977cbd2f77d3e0ef3c75210bfcf83"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/test_progressive_ondemand.sh",
|
||||
"size": 9519,
|
||||
"sha256": "2e79224bc201981765c260d8924bcaf80fc4a25e685cd4ec24a92e7ad00054f1"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/test_sequential_loading.sh",
|
||||
"size": 8785,
|
||||
"sha256": "91a8c26d307e303b22ca641629a451e21c9a956fa51b3a9afe7157746d21806b"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/test_versatile_prompts.sh",
|
||||
"size": 7713,
|
||||
"sha256": "1f9cf7048e1e1fb2b70e736771f88a468fb296b907ffc8c45df688bdbcf6eea6"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/test_wildcard_consistency.sh",
|
||||
"size": 6870,
|
||||
"sha256": "9a2cef04ebc35890f09fc8dc47eab6d388ebaf4078391acbfa0afb19469c0810"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/test_wildcard_final.py",
|
||||
"size": 4746,
|
||||
"sha256": "42798e3d7202ff683c28b2e812fc3788764e0d7998c6f060922bf1d860954a3c"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/test_wildcard_lazy_loading.py",
|
||||
"size": 6149,
|
||||
"sha256": "7d795cacf73aa8ef6b60b4a8e0b20fcb72746a6fbca6d4517551c810cec79e85"
|
||||
},
|
||||
{
|
||||
"path": "tests/wildcards/verify_ondemand_mode.sh",
|
||||
"size": 2777,
|
||||
"sha256": "4864c64ea8372aefd6a7885d7d5982b2cf87f5af13fb0f286dcf4ff15aec0ed9"
|
||||
},
|
||||
{
|
||||
"path": "tests/workflows/advanced-sampler.json",
|
||||
"size": 16207,
|
||||
"sha256": "26c6be819f803b2bb169b1a4062050aae772e91b3f3e05654a16c7b24f54cfb2"
|
||||
},
|
||||
{
|
||||
"path": "tests/workflows/detailer-pipe-test-sdxl.json",
|
||||
"size": 33006,
|
||||
"sha256": "a8119d665e35c29d63290b8c107587b490c8ba48b2f1d4cf3fe59ea4c49e3fe2"
|
||||
},
|
||||
{
|
||||
"path": "tests/workflows/detailer-pipe-test.json",
|
||||
"size": 60406,
|
||||
"sha256": "ac986ae1e8df0c2b64710800f90c429cadd77de32d591f3b92b2bede40a8aeca"
|
||||
},
|
||||
{
|
||||
"path": "tests/workflows/impactwildcardprocessor_separate_tests.json",
|
||||
"size": 23061,
|
||||
"sha256": "9ed458ba00674b02d0e479f88672b55294e3e79492b9306c8eaaf3c265ba700f"
|
||||
},
|
||||
{
|
||||
"path": "tests/workflows/impactwildcardprocessor_yaml_tests.json",
|
||||
"size": 41914,
|
||||
"sha256": "30741ef5abb771694c884f842cf2f9dfa33fa73cca828d94651ba54444c4ae8a"
|
||||
},
|
||||
{
|
||||
"path": "tests/workflows/loop-test.json",
|
||||
"size": 17958,
|
||||
"sha256": "9e487c1934798ee23e7f7dd0976797f1c488039db0f38098bb86a999d9a118da"
|
||||
},
|
||||
{
|
||||
"path": "tests/workflows/masks.json",
|
||||
"size": 9985,
|
||||
"sha256": "51a43424f8d57c7617dc6285df69d80fa7899966485e86b693f9e0ed49f9dfeb"
|
||||
},
|
||||
{
|
||||
"path": "tests/workflows/regional_prompt.json",
|
||||
"size": 28215,
|
||||
"sha256": "21af512d8f5fda65955ad821a64e066941f112f741900780038b16fe484b1330"
|
||||
},
|
||||
{
|
||||
"path": "troubleshooting/TROUBLESHOOTING.md",
|
||||
"size": 2856,
|
||||
"sha256": "2c852099dc7eb1de573708bd5f291a17c8e8d8a0a9ae7d06ad04d69a7dfb6d42"
|
||||
},
|
||||
{
|
||||
"path": "troubleshooting/black1.png",
|
||||
"size": 752880,
|
||||
"sha256": "6e32fe1606d35a26ddf08d2a3ff24c8fcd62831b9ed11eeaa76468e27a2b5f0f"
|
||||
},
|
||||
{
|
||||
"path": "troubleshooting/black2.png",
|
||||
"size": 709592,
|
||||
"sha256": "829d72c3cc1034f72bbd0945e1a2aed69e1f38060126159c0b911c4c102e2fcc"
|
||||
},
|
||||
{
|
||||
"path": "wildcards/put_wildcards_here",
|
||||
"size": 0,
|
||||
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
},
|
||||
{
|
||||
"path": "wildcards/samples/flower.txt",
|
||||
"size": 67,
|
||||
"sha256": "63ad428a02551243d1835c324236c785cca6fe64cd6cf646fe22a9a88c36350f"
|
||||
},
|
||||
{
|
||||
"path": "wildcards/samples/jewel.txt",
|
||||
"size": 70,
|
||||
"sha256": "e1c6436c087de80f9a08f49b0c815d7d7a9b500df2c4d5e26bfd6e877d18bcb5"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
{"changelog":"","createdAt":"2026-01-02T12:06:31.501557Z","dependencies":["segment-anything","scikit-image","piexif","transformers","opencv-python-headless","scipy","numpy","dill","matplotlib","sam2 @ git+https://github.com/facebookresearch/sam2"],"deprecated":false,"downloadUrl":"https://cdn.comfy.org/drltdata/comfyui-impact-pack/8.28.2/node.zip","id":"b3f817b8-e820-464e-82be-7ea3bf2c1517","node_id":"comfyui-impact-pack","status":"NodeVersionStatusActive","supported_accelerators":[],"supported_comfyui_frontend_version":"","supported_comfyui_version":"","supported_os":[],"tags":[],"version":"8.28.2"}
|
||||
Binary file not shown.
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,456 @@
|
||||
"""
|
||||
@author: Dr.Lt.Data
|
||||
@title: Impact Pack
|
||||
@nickname: Impact Pack
|
||||
@description: This extension offers various detector nodes and detailer nodes that allow you to configure a workflow that automatically enhances facial details. And provide iterative upscaler.
|
||||
"""
|
||||
|
||||
import folder_paths
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
|
||||
comfy_path = os.path.dirname(folder_paths.__file__)
|
||||
impact_path = os.path.join(os.path.dirname(__file__))
|
||||
modules_path = os.path.join(os.path.dirname(__file__), "modules")
|
||||
|
||||
sys.path.append(modules_path)
|
||||
|
||||
import impact.config
|
||||
logging.info(f"### Loading: ComfyUI-Impact-Pack ({impact.config.version})")
|
||||
|
||||
# Core
|
||||
# recheck dependencies for colab
|
||||
try:
|
||||
import folder_paths
|
||||
import torch # noqa: F401
|
||||
import cv2 # noqa: F401
|
||||
from cv2 import setNumThreads # noqa: F401
|
||||
import numpy as np # noqa: F401
|
||||
import comfy.samplers
|
||||
import comfy.sd # noqa: F401
|
||||
from PIL import Image, ImageFilter # noqa: F401
|
||||
from skimage.measure import label, regionprops # noqa: F401
|
||||
from collections import namedtuple # noqa: F401
|
||||
import piexif # noqa: F401
|
||||
import nodes
|
||||
except Exception as e:
|
||||
import logging
|
||||
logging.error("[Impact Pack] Failed to import due to several dependencies are missing!!!!")
|
||||
raise e
|
||||
|
||||
|
||||
import impact.impact_server # to load server api
|
||||
|
||||
from .modules.impact.impact_pack import * # noqa: F403
|
||||
from .modules.impact.detectors import * # noqa: F403
|
||||
from .modules.impact.pipe import * # noqa: F403
|
||||
from .modules.impact.logics import * # noqa: F403
|
||||
from .modules.impact.util_nodes import * # noqa: F403
|
||||
from .modules.impact.segs_nodes import * # noqa: F403
|
||||
from .modules.impact.special_samplers import * # noqa: F403
|
||||
from .modules.impact.hf_nodes import * # noqa: F403
|
||||
from .modules.impact.bridge_nodes import * # noqa: F403
|
||||
from .modules.impact.hook_nodes import * # noqa: F403
|
||||
from .modules.impact.animatediff_nodes import * # noqa: F403
|
||||
from .modules.impact.segs_upscaler import * # noqa: F403
|
||||
|
||||
import threading
|
||||
|
||||
|
||||
threading.Thread(target=impact.wildcards.wildcard_load).start()
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"SAMLoader": SAMLoader, # noqa: F405
|
||||
"CLIPSegDetectorProvider": CLIPSegDetectorProvider, # noqa: F405
|
||||
"ONNXDetectorProvider": ONNXDetectorProvider, # noqa: F405
|
||||
|
||||
"BitwiseAndMaskForEach": BitwiseAndMaskForEach, # noqa: F405
|
||||
"SubtractMaskForEach": SubtractMaskForEach, # noqa: F405
|
||||
|
||||
"DetailerForEach": DetailerForEach, # noqa: F405
|
||||
"DetailerForEachAutoRetry": DetailerForEachAutoRetry, # noqa: F405
|
||||
"DetailerForEachDebug": DetailerForEachTest, # noqa: F405
|
||||
"DetailerForEachPipe": DetailerForEachPipe, # noqa: F405
|
||||
"DetailerForEachDebugPipe": DetailerForEachTestPipe, # noqa: F405
|
||||
"DetailerForEachPipeForAnimateDiff": DetailerForEachPipeForAnimateDiff, # noqa: F405
|
||||
|
||||
"SAMDetectorCombined": SAMDetectorCombined, # noqa: F405
|
||||
"SAMDetectorSegmented": SAMDetectorSegmented, # noqa: F405
|
||||
|
||||
"FaceDetailer": FaceDetailer, # noqa: F405
|
||||
"FaceDetailerPipe": FaceDetailerPipe, # noqa: F405
|
||||
"MaskDetailerPipe": MaskDetailerPipe, # noqa: F405
|
||||
|
||||
"ToDetailerPipe": ToDetailerPipe, # noqa: F405
|
||||
"ToDetailerPipeSDXL": ToDetailerPipeSDXL, # noqa: F405
|
||||
"FromDetailerPipe": FromDetailerPipe, # noqa: F405
|
||||
"FromDetailerPipe_v2": FromDetailerPipe_v2, # noqa: F405
|
||||
"FromDetailerPipeSDXL": FromDetailerPipe_SDXL, # noqa: F405
|
||||
"AnyPipeToBasic": AnyPipeToBasic, # noqa: F405
|
||||
"ToBasicPipe": ToBasicPipe, # noqa: F405
|
||||
"FromBasicPipe": FromBasicPipe, # noqa: F405
|
||||
"FromBasicPipe_v2": FromBasicPipe_v2, # noqa: F405
|
||||
"BasicPipeToDetailerPipe": BasicPipeToDetailerPipe, # noqa: F405
|
||||
"BasicPipeToDetailerPipeSDXL": BasicPipeToDetailerPipeSDXL, # noqa: F405
|
||||
"DetailerPipeToBasicPipe": DetailerPipeToBasicPipe, # noqa: F405
|
||||
"EditBasicPipe": EditBasicPipe, # noqa: F405
|
||||
"EditDetailerPipe": EditDetailerPipe, # noqa: F405
|
||||
"EditDetailerPipeSDXL": EditDetailerPipeSDXL, # noqa: F405
|
||||
|
||||
"LatentPixelScale": LatentPixelScale, # noqa: F405
|
||||
"PixelKSampleUpscalerProvider": PixelKSampleUpscalerProvider, # noqa: F405
|
||||
"PixelKSampleUpscalerProviderPipe": PixelKSampleUpscalerProviderPipe, # noqa: F405
|
||||
"IterativeLatentUpscale": IterativeLatentUpscale, # noqa: F405
|
||||
"IterativeImageUpscale": IterativeImageUpscale, # noqa: F405
|
||||
"PixelTiledKSampleUpscalerProvider": PixelTiledKSampleUpscalerProvider, # noqa: F405
|
||||
"PixelTiledKSampleUpscalerProviderPipe": PixelTiledKSampleUpscalerProviderPipe, # noqa: F405
|
||||
"TwoSamplersForMaskUpscalerProvider": TwoSamplersForMaskUpscalerProvider, # noqa: F405
|
||||
"TwoSamplersForMaskUpscalerProviderPipe": TwoSamplersForMaskUpscalerProviderPipe, # noqa: F405
|
||||
|
||||
"PixelKSampleHookCombine": PixelKSampleHookCombine, # noqa: F405
|
||||
"DenoiseScheduleHookProvider": DenoiseScheduleHookProvider, # noqa: F405
|
||||
"StepsScheduleHookProvider": StepsScheduleHookProvider, # noqa: F405
|
||||
"CfgScheduleHookProvider": CfgScheduleHookProvider, # noqa: F405
|
||||
"NoiseInjectionHookProvider": NoiseInjectionHookProvider, # noqa: F405
|
||||
"UnsamplerHookProvider": UnsamplerHookProvider, # noqa: F405
|
||||
"CoreMLDetailerHookProvider": CoreMLDetailerHookProvider, # noqa: F405
|
||||
"PreviewDetailerHookProvider": PreviewDetailerHookProvider, # noqa: F405
|
||||
"BlackPatchRetryHookProvider": BlackPatchRetryHookProvider, # noqa: F405
|
||||
"CustomSamplerDetailerHookProvider": CustomSamplerDetailerHookProvider, # noqa: F405
|
||||
"LamaRemoverDetailerHookProvider": LamaRemoverDetailerHookProvider, # noqa: F405
|
||||
|
||||
"DetailerHookCombine": DetailerHookCombine, # noqa: F405
|
||||
"NoiseInjectionDetailerHookProvider": NoiseInjectionDetailerHookProvider, # noqa: F405
|
||||
"UnsamplerDetailerHookProvider": UnsamplerDetailerHookProvider, # noqa: F405
|
||||
"DenoiseSchedulerDetailerHookProvider": DenoiseSchedulerDetailerHookProvider, # noqa: F405
|
||||
"SEGSOrderedFilterDetailerHookProvider": SEGSOrderedFilterDetailerHookProvider, # noqa: F405
|
||||
"SEGSRangeFilterDetailerHookProvider": SEGSRangeFilterDetailerHookProvider, # noqa: F405
|
||||
"SEGSLabelFilterDetailerHookProvider": SEGSLabelFilterDetailerHookProvider, # noqa: F405
|
||||
"VariationNoiseDetailerHookProvider": VariationNoiseDetailerHookProvider, # noqa: F405
|
||||
# "CustomNoiseDetailerHookProvider": CustomNoiseDetailerHookProvider,
|
||||
|
||||
"BitwiseAndMask": BitwiseAndMask, # noqa: F405
|
||||
"SubtractMask": SubtractMask, # noqa: F405
|
||||
"AddMask": AddMask, # noqa: F405
|
||||
"MaskRectArea": MaskRectArea, # noqa: F405
|
||||
"MaskRectAreaAdvanced": MaskRectAreaAdvanced, # noqa: F405
|
||||
"ImpactSegsAndMask": SegsBitwiseAndMask, # noqa: F405
|
||||
"ImpactSegsAndMaskForEach": SegsBitwiseAndMaskForEach, # noqa: F405
|
||||
"EmptySegs": EmptySEGS, # noqa: F405
|
||||
"ImpactFlattenMask": FlattenMask, # noqa: F405
|
||||
|
||||
"MediaPipeFaceMeshToSEGS": MediaPipeFaceMeshToSEGS, # noqa: F405
|
||||
"MaskToSEGS": MaskToSEGS, # noqa: F405
|
||||
"MaskToSEGS_for_AnimateDiff": MaskToSEGS_for_AnimateDiff, # noqa: F405
|
||||
"ToBinaryMask": ToBinaryMask, # noqa: F405
|
||||
"MasksToMaskList": MasksToMaskList, # noqa: F405
|
||||
"MaskListToMaskBatch": MaskListToMaskBatch, # noqa: F405
|
||||
"ImageListToImageBatch": ImageListToImageBatch, # noqa: F405
|
||||
"SetDefaultImageForSEGS": DefaultImageForSEGS, # noqa: F405
|
||||
"RemoveImageFromSEGS": RemoveImageFromSEGS, # noqa: F405
|
||||
|
||||
"BboxDetectorSEGS": BboxDetectorForEach, # noqa: F405
|
||||
"SegmDetectorSEGS": SegmDetectorForEach, # noqa: F405
|
||||
"ONNXDetectorSEGS": BboxDetectorForEach, # noqa: F405
|
||||
"ImpactSimpleDetectorSEGS_for_AD": SimpleDetectorForAnimateDiff, # noqa: F405
|
||||
"ImpactSAM2VideoDetectorSEGS": SAM2VideoDetectorSEGS, # noqa: F405
|
||||
"ImpactSimpleDetectorSEGS": SimpleDetectorForEach, # noqa: F405
|
||||
"ImpactSimpleDetectorSEGSPipe": SimpleDetectorForEachPipe, # noqa: F405
|
||||
"ImpactControlNetApplySEGS": ControlNetApplySEGS, # noqa: F405
|
||||
"ImpactControlNetApplyAdvancedSEGS": ControlNetApplyAdvancedSEGS, # noqa: F405
|
||||
"ImpactControlNetClearSEGS": ControlNetClearSEGS, # noqa: F405
|
||||
"ImpactIPAdapterApplySEGS": IPAdapterApplySEGS, # noqa: F405
|
||||
|
||||
"ImpactDecomposeSEGS": DecomposeSEGS, # noqa: F405
|
||||
"ImpactAssembleSEGS": AssembleSEGS, # noqa: F405
|
||||
"ImpactFrom_SEG_ELT": From_SEG_ELT, # noqa: F405
|
||||
"ImpactEdit_SEG_ELT": Edit_SEG_ELT, # noqa: F405
|
||||
"ImpactDilate_Mask_SEG_ELT": Dilate_SEG_ELT, # noqa: F405
|
||||
"ImpactDilateMask": DilateMask, # noqa: F405
|
||||
"ImpactGaussianBlurMask": GaussianBlurMask, # noqa: F405
|
||||
"ImpactDilateMaskInSEGS": DilateMaskInSEGS, # noqa: F405
|
||||
"ImpactGaussianBlurMaskInSEGS": GaussianBlurMaskInSEGS, # noqa: F405
|
||||
"ImpactScaleBy_BBOX_SEG_ELT": SEG_ELT_BBOX_ScaleBy, # noqa: F405
|
||||
"ImpactFrom_SEG_ELT_bbox": From_SEG_ELT_bbox, # noqa: F405
|
||||
"ImpactFrom_SEG_ELT_crop_region": From_SEG_ELT_crop_region, # noqa: F405
|
||||
"ImpactCount_Elts_in_SEGS": Count_Elts_in_SEGS, # noqa: F405
|
||||
|
||||
"BboxDetectorCombined_v2": BboxDetectorCombined, # noqa: F405
|
||||
"SegmDetectorCombined_v2": SegmDetectorCombined, # noqa: F405
|
||||
"SegsToCombinedMask": SegsToCombinedMask, # noqa: F405
|
||||
|
||||
"KSamplerProvider": KSamplerProvider, # noqa: F405
|
||||
"TwoSamplersForMask": TwoSamplersForMask, # noqa: F405
|
||||
"TiledKSamplerProvider": TiledKSamplerProvider, # noqa: F405
|
||||
|
||||
"KSamplerAdvancedProvider": KSamplerAdvancedProvider, # noqa: F405
|
||||
"TwoAdvancedSamplersForMask": TwoAdvancedSamplersForMask, # noqa: F405
|
||||
|
||||
"ImpactNegativeConditioningPlaceholder": NegativeConditioningPlaceholder, # noqa: F405
|
||||
|
||||
"PreviewBridge": PreviewBridge, # noqa: F405
|
||||
"PreviewBridgeLatent": PreviewBridgeLatent, # noqa: F405
|
||||
"ImageSender": ImageSender, # noqa: F405
|
||||
"ImageReceiver": ImageReceiver, # noqa: F405
|
||||
"LatentSender": LatentSender, # noqa: F405
|
||||
"LatentReceiver": LatentReceiver, # noqa: F405
|
||||
"ImageMaskSwitch": ImageMaskSwitch, # noqa: F405
|
||||
"LatentSwitch": GeneralSwitch, # noqa: F405
|
||||
"SEGSSwitch": GeneralSwitch, # noqa: F405
|
||||
"ImpactSwitch": GeneralSwitch, # noqa: F405
|
||||
"ImpactInversedSwitch": GeneralInversedSwitch, # noqa: F405
|
||||
|
||||
"ImpactWildcardProcessor": ImpactWildcardProcessor, # noqa: F405
|
||||
"ImpactWildcardEncode": ImpactWildcardEncode, # noqa: F405
|
||||
|
||||
"SEGSUpscaler": SEGSUpscaler, # noqa: F405
|
||||
"SEGSUpscalerPipe": SEGSUpscalerPipe, # noqa: F405
|
||||
"SEGSDetailer": SEGSDetailer, # noqa: F405
|
||||
"SEGSPaste": SEGSPaste, # noqa: F405
|
||||
"SEGSPreview": SEGSPreview, # noqa: F405
|
||||
"SEGSPreviewCNet": SEGSPreviewCNet, # noqa: F405
|
||||
"SEGSToImageList": SEGSToImageList, # noqa: F405
|
||||
"ImpactSEGSToMaskList": SEGSToMaskList, # noqa: F405
|
||||
"ImpactSEGSToMaskBatch": SEGSToMaskBatch, # noqa: F405
|
||||
"ImpactSEGSConcat": SEGSConcat, # noqa: F405
|
||||
"ImpactSEGSPicker": SEGSPicker, # noqa: F405
|
||||
"ImpactMakeTileSEGS": MakeTileSEGS, # noqa: F405
|
||||
"ImpactSEGSMerge": SEGSMerge, # noqa: F405
|
||||
|
||||
"SEGSDetailerForAnimateDiff": SEGSDetailerForAnimateDiff, # noqa: F405
|
||||
|
||||
"ImpactKSamplerBasicPipe": KSamplerBasicPipe, # noqa: F405
|
||||
"ImpactKSamplerAdvancedBasicPipe": KSamplerAdvancedBasicPipe, # noqa: F405
|
||||
|
||||
"ReencodeLatent": ReencodeLatent, # noqa: F405
|
||||
"ReencodeLatentPipe": ReencodeLatentPipe, # noqa: F405
|
||||
|
||||
"ImpactImageBatchToImageList": ImageBatchToImageList, # noqa: F405
|
||||
"ImpactMakeImageList": MakeImageList, # noqa: F405
|
||||
"ImpactMakeImageBatch": MakeImageBatch, # noqa: F405
|
||||
"ImpactMakeAnyList": MakeAnyList, # noqa: F405
|
||||
"ImpactMakeMaskList": MakeMaskList, # noqa: F405
|
||||
"ImpactMakeMaskBatch": MakeMaskBatch, # noqa: F405
|
||||
"ImpactSelectNthItemOfAnyList": NthItemOfAnyList, # noqa: F405
|
||||
|
||||
"RegionalSampler": RegionalSampler, # noqa: F405
|
||||
"RegionalSamplerAdvanced": RegionalSamplerAdvanced, # noqa: F405
|
||||
"CombineRegionalPrompts": CombineRegionalPrompts, # noqa: F405
|
||||
"RegionalPrompt": RegionalPrompt, # noqa: F405
|
||||
|
||||
"ImpactCombineConditionings": CombineConditionings, # noqa: F405
|
||||
"ImpactConcatConditionings": ConcatConditionings, # noqa: F405
|
||||
|
||||
"ImpactSEGSLabelAssign": SEGSLabelAssign, # noqa: F405
|
||||
"ImpactSEGSLabelFilter": SEGSLabelFilter, # noqa: F405
|
||||
"ImpactSEGSRangeFilter": SEGSRangeFilter, # noqa: F405
|
||||
"ImpactSEGSOrderedFilter": SEGSOrderedFilter, # noqa: F405
|
||||
"ImpactSEGSIntersectionFilter": SEGSIntersectionFilter, # noqa: F405
|
||||
"ImpactSEGSNMSFilter": SEGSNMSFilter, # noqa: F405
|
||||
|
||||
"ImpactCompare": ImpactCompare, # noqa: F405
|
||||
"ImpactConditionalBranch": ImpactConditionalBranch, # noqa: F405
|
||||
"ImpactConditionalBranchSelMode": ImpactConditionalBranchSelMode, # noqa: F405
|
||||
"ImpactIfNone": ImpactIfNone, # noqa: F405
|
||||
"ImpactConvertDataType": ImpactConvertDataType, # noqa: F405
|
||||
"ImpactLogicalOperators": ImpactLogicalOperators, # noqa: F405
|
||||
"ImpactInt": ImpactInt, # noqa: F405
|
||||
"ImpactFloat": ImpactFloat, # noqa: F405
|
||||
"ImpactBoolean": ImpactBoolean, # noqa: F405
|
||||
"ImpactValueSender": ImpactValueSender, # noqa: F405
|
||||
"ImpactValueReceiver": ImpactValueReceiver, # noqa: F405
|
||||
"ImpactImageInfo": ImpactImageInfo, # noqa: F405
|
||||
"ImpactLatentInfo": ImpactLatentInfo, # noqa: F405
|
||||
"ImpactMinMax": ImpactMinMax, # noqa: F405
|
||||
"ImpactNeg": ImpactNeg, # noqa: F405
|
||||
"ImpactConditionalStopIteration": ImpactConditionalStopIteration, # noqa: F405
|
||||
"ImpactStringSelector": StringSelector, # noqa: F405
|
||||
"StringListToString": StringListToString, # noqa: F405
|
||||
"WildcardPromptFromString": WildcardPromptFromString, # noqa: F405
|
||||
"ImpactExecutionOrderController": ImpactExecutionOrderController, # noqa: F405
|
||||
"ImpactListBridge": ImpactListBridge, # noqa: F405
|
||||
|
||||
"RemoveNoiseMask": RemoveNoiseMask, # noqa: F405
|
||||
|
||||
"ImpactLogger": ImpactLogger, # noqa: F405
|
||||
"ImpactDummyInput": ImpactDummyInput, # noqa: F405
|
||||
|
||||
"ImpactQueueTrigger": ImpactQueueTrigger, # noqa: F405
|
||||
"ImpactQueueTriggerCountdown": ImpactQueueTriggerCountdown, # noqa: F405
|
||||
"ImpactSetWidgetValue": ImpactSetWidgetValue, # noqa: F405
|
||||
"ImpactNodeSetMuteState": ImpactNodeSetMuteState, # noqa: F405
|
||||
"ImpactControlBridge": ImpactControlBridge, # noqa: F405
|
||||
"ImpactIsNotEmptySEGS": ImpactNotEmptySEGS, # noqa: F405
|
||||
"ImpactSleep": ImpactSleep, # noqa: F405
|
||||
"ImpactRemoteBoolean": ImpactRemoteBoolean, # noqa: F405
|
||||
"ImpactRemoteInt": ImpactRemoteInt, # noqa: F405
|
||||
|
||||
"ImpactHFTransformersClassifierProvider": HF_TransformersClassifierProvider, # noqa: F405
|
||||
"ImpactSEGSClassify": SEGS_Classify, # noqa: F405
|
||||
|
||||
"ImpactSchedulerAdapter": ImpactSchedulerAdapter, # noqa: F405
|
||||
"GITSSchedulerFuncProvider": GITSSchedulerFuncProvider # noqa: F405
|
||||
}
|
||||
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"SAMLoader": "SAMLoader (Impact)",
|
||||
|
||||
"BboxDetectorSEGS": "BBOX Detector (SEGS)",
|
||||
"SegmDetectorSEGS": "SEGM Detector (SEGS)",
|
||||
"ONNXDetectorSEGS": "ONNX Detector (SEGS/legacy) - use BBOXDetector",
|
||||
"ImpactSimpleDetectorSEGS_for_AD": "Simple Detector for Video (SEGS)",
|
||||
"ImpactSAM2VideoDetectorSEGS": "SAM2 Video Detector (SEGS)",
|
||||
"ImpactSimpleDetectorSEGS": "Simple Detector (SEGS)",
|
||||
"ImpactSimpleDetectorSEGSPipe": "Simple Detector (SEGS/pipe)",
|
||||
"ImpactControlNetApplySEGS": "ControlNetApply (SEGS) - DEPRECATED",
|
||||
"ImpactControlNetApplyAdvancedSEGS": "ControlNetApply (SEGS)",
|
||||
"ImpactIPAdapterApplySEGS": "IPAdapterApply (SEGS)",
|
||||
|
||||
"BboxDetectorCombined_v2": "BBOX Detector (combined)",
|
||||
"SegmDetectorCombined_v2": "SEGM Detector (combined)",
|
||||
"SegsToCombinedMask": "SEGS to MASK (combined)",
|
||||
"MediaPipeFaceMeshToSEGS": "MediaPipe FaceMesh to SEGS",
|
||||
"MaskToSEGS": "MASK to SEGS",
|
||||
"MaskToSEGS_for_AnimateDiff": "MASK to SEGS for Video",
|
||||
"BitwiseAndMaskForEach": "Pixelwise(SEGS & SEGS)",
|
||||
"SubtractMaskForEach": "Pixelwise(SEGS - SEGS)",
|
||||
"ImpactSegsAndMask": "Pixelwise(SEGS & MASK)",
|
||||
"ImpactSegsAndMaskForEach": "Pixelwise(SEGS & MASKS ForEach)",
|
||||
"BitwiseAndMask": "Pixelwise(MASK & MASK)",
|
||||
"SubtractMask": "Pixelwise(MASK - MASK)",
|
||||
"AddMask": "Pixelwise(MASK + MASK)",
|
||||
"MaskRectArea": "Mask Rect Area",
|
||||
"MaskRectAreaAdvanced": "Mask Rect Area (Advanced)",
|
||||
"ImpactFlattenMask": "Flatten Mask Batch",
|
||||
"DetailerForEach": "Detailer (SEGS)",
|
||||
"DetailerForEachAutoRetry": "Detailer (SEGS) with auto retry",
|
||||
"DetailerForEachPipe": "Detailer (SEGS/pipe)",
|
||||
"DetailerForEachDebug": "DetailerDebug (SEGS)",
|
||||
"DetailerForEachDebugPipe": "DetailerDebug (SEGS/pipe)",
|
||||
"SEGSDetailerForAnimateDiff": "SEGSDetailer For Video (SEGS/pipe)",
|
||||
"DetailerForEachPipeForAnimateDiff": "Detailer For Video (SEGS/pipe)",
|
||||
"SEGSUpscaler": "Upscaler (SEGS)",
|
||||
"SEGSUpscalerPipe": "Upscaler (SEGS/pipe)",
|
||||
|
||||
"SAMDetectorCombined": "SAMDetector (combined)",
|
||||
"SAMDetectorSegmented": "SAMDetector (segmented)",
|
||||
"FaceDetailerPipe": "FaceDetailer (pipe)",
|
||||
"MaskDetailerPipe": "MaskDetailer (pipe)",
|
||||
|
||||
"FromDetailerPipeSDXL": "FromDetailer (SDXL/pipe)",
|
||||
"BasicPipeToDetailerPipeSDXL": "BasicPipe -> DetailerPipe (SDXL)",
|
||||
"EditDetailerPipeSDXL": "Edit DetailerPipe (SDXL)",
|
||||
|
||||
"BasicPipeToDetailerPipe": "BasicPipe -> DetailerPipe",
|
||||
"DetailerPipeToBasicPipe": "DetailerPipe -> BasicPipe",
|
||||
"EditBasicPipe": "Edit BasicPipe",
|
||||
"EditDetailerPipe": "Edit DetailerPipe",
|
||||
"AnyPipeToBasic": "Any PIPE -> BasicPipe",
|
||||
|
||||
"LatentPixelScale": "Latent Scale (on Pixel Space)",
|
||||
"IterativeLatentUpscale": "Iterative Upscale (Latent/on Pixel Space)",
|
||||
"IterativeImageUpscale": "Iterative Upscale (Image)",
|
||||
|
||||
"TwoSamplersForMaskUpscalerProvider": "TwoSamplersForMask Upscaler Provider",
|
||||
"TwoSamplersForMaskUpscalerProviderPipe": "TwoSamplersForMask Upscaler Provider (pipe)",
|
||||
|
||||
"ReencodeLatent": "Reencode Latent",
|
||||
"ReencodeLatentPipe": "Reencode Latent (pipe)",
|
||||
|
||||
"ImpactKSamplerBasicPipe": "KSampler (pipe)",
|
||||
"ImpactKSamplerAdvancedBasicPipe": "KSampler (Advanced/pipe)",
|
||||
"ImpactSEGSLabelAssign": "SEGS Assign (label)",
|
||||
"ImpactSEGSLabelFilter": "SEGS Filter (label)",
|
||||
"ImpactSEGSRangeFilter": "SEGS Filter (range)",
|
||||
"ImpactSEGSOrderedFilter": "SEGS Filter (ordered)",
|
||||
"ImpactSEGSIntersectionFilter": "SEGS Filter (intersection)",
|
||||
"ImpactSEGSNMSFilter": "SEGS Filter (non max suppression)",
|
||||
"ImpactSEGSConcat": "SEGS Concat",
|
||||
"ImpactSEGSToMaskList": "SEGS to Mask List",
|
||||
"ImpactSEGSToMaskBatch": "SEGS to Mask Batch",
|
||||
"ImpactSEGSPicker": "Picker (SEGS)",
|
||||
"ImpactMakeTileSEGS": "Make Tile SEGS",
|
||||
"ImpactSEGSMerge": "SEGS Merge",
|
||||
|
||||
"ImpactDecomposeSEGS": "Decompose (SEGS)",
|
||||
"ImpactAssembleSEGS": "Assemble (SEGS)",
|
||||
"ImpactFrom_SEG_ELT": "From SEG_ELT",
|
||||
"ImpactEdit_SEG_ELT": "Edit SEG_ELT",
|
||||
"ImpactFrom_SEG_ELT_bbox": "From SEG_ELT bbox",
|
||||
"ImpactFrom_SEG_ELT_crop_region": "From SEG_ELT crop_region",
|
||||
"ImpactDilate_Mask_SEG_ELT": "Dilate Mask (SEG_ELT)",
|
||||
"ImpactScaleBy_BBOX_SEG_ELT": "ScaleBy BBOX (SEG_ELT)",
|
||||
"ImpactCount_Elts_in_SEGS": "Count Elts in SEGS",
|
||||
"ImpactDilateMask": "Dilate Mask",
|
||||
"ImpactGaussianBlurMask": "Gaussian Blur Mask",
|
||||
"ImpactDilateMaskInSEGS": "Dilate Mask (SEGS)",
|
||||
"ImpactGaussianBlurMaskInSEGS": "Gaussian Blur Mask (SEGS)",
|
||||
|
||||
"PreviewBridge": "Preview Bridge (Image)",
|
||||
"PreviewBridgeLatent": "Preview Bridge (Latent)",
|
||||
"ImageSender": "Image Sender",
|
||||
"ImageReceiver": "Image Receiver",
|
||||
"ImageMaskSwitch": "Switch (images, mask)",
|
||||
"ImpactSwitch": "Switch (Any)",
|
||||
"ImpactInversedSwitch": "Inversed Switch (Any)",
|
||||
"ImpactExecutionOrderController": "Execution Order Controller",
|
||||
"ImpactListBridge": "List Bridge",
|
||||
|
||||
"MasksToMaskList": "Mask Batch to Mask List",
|
||||
"MaskListToMaskBatch": "Mask List to Mask Batch",
|
||||
"ImpactImageBatchToImageList": "Image Batch to Image List",
|
||||
"ImageListToImageBatch": "Image List to Image Batch",
|
||||
|
||||
"ImpactMakeImageList": "Make Image List",
|
||||
"ImpactMakeImageBatch": "Make Image Batch",
|
||||
"ImpactMakeMaskList": "Make Mask List",
|
||||
"ImpactMakeMaskBatch": "Make Mask Batch",
|
||||
"ImpactMakeAnyList": "Make List (Any)",
|
||||
"ImpactSelectNthItemOfAnyList": "Select Nth Item (Any list)",
|
||||
|
||||
"ImpactStringSelector": "String Selector",
|
||||
"StringListToString": "String List to String",
|
||||
"WildcardPromptFromString": "Wildcard Prompt from String",
|
||||
"ImpactIsNotEmptySEGS": "SEGS isn't Empty",
|
||||
"SetDefaultImageForSEGS": "Set Default Image for SEGS",
|
||||
"RemoveImageFromSEGS": "Remove Image from SEGS",
|
||||
|
||||
"RemoveNoiseMask": "Remove Noise Mask",
|
||||
|
||||
"ImpactCombineConditionings": "Combine Conditionings",
|
||||
"ImpactConcatConditionings": "Concat Conditionings",
|
||||
|
||||
"ImpactQueueTrigger": "Queue Trigger",
|
||||
"ImpactQueueTriggerCountdown": "Queue Trigger (Countdown)",
|
||||
"ImpactSetWidgetValue": "Set Widget Value",
|
||||
"ImpactNodeSetMuteState": "Set Mute State",
|
||||
"ImpactControlBridge": "Control Bridge",
|
||||
"ImpactSleep": "Sleep",
|
||||
"ImpactRemoteBoolean": "Remote Boolean (on prompt)",
|
||||
"ImpactRemoteInt": "Remote Int (on prompt)",
|
||||
|
||||
"ImpactHFTransformersClassifierProvider": "HF Transformers Classifier Provider",
|
||||
"ImpactSEGSClassify": "SEGS Classify",
|
||||
|
||||
"LatentSwitch": "Switch (latent/legacy)",
|
||||
"SEGSSwitch": "Switch (SEGS/legacy)",
|
||||
|
||||
"SEGSPreviewCNet": "SEGSPreview (CNET Image)",
|
||||
|
||||
"ImpactSchedulerAdapter": "Impact Scheduler Adapter",
|
||||
"GITSSchedulerFuncProvider": "GITSScheduler Func Provider",
|
||||
"ImpactNegativeConditioningPlaceholder": "Negative Cond Placeholder"
|
||||
}
|
||||
|
||||
|
||||
# NOTE: Inject directly into EXTENSION_WEB_DIRS instead of WEB_DIRECTORY
|
||||
# Provide the js path fixed as ComfyUI-Impact-Pack instead of the path name, making it available for external use
|
||||
|
||||
# WEB_DIRECTORY = "js" -- deprecated method
|
||||
nodes.EXTENSION_WEB_DIRS["ComfyUI-Impact-Pack"] = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'js')
|
||||
|
||||
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,779 @@
|
||||
import sys
|
||||
import time
|
||||
|
||||
import execution
|
||||
import impact.impact_server
|
||||
from server import PromptServer
|
||||
from impact.utils import any_typ
|
||||
import impact.core as core
|
||||
import re
|
||||
import nodes
|
||||
import logging
|
||||
|
||||
|
||||
class ImpactCompare:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"cmp": (['a = b', 'a <> b', 'a > b', 'a < b', 'a >= b', 'a <= b', 'tt', 'ff'],),
|
||||
"a": (any_typ, ),
|
||||
"b": (any_typ, ),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = ("BOOLEAN", )
|
||||
|
||||
def doit(self, cmp, a, b):
|
||||
if cmp == "a = b":
|
||||
return (a == b, )
|
||||
elif cmp == "a <> b":
|
||||
return (a != b, )
|
||||
elif cmp == "a > b":
|
||||
return (a > b, )
|
||||
elif cmp == "a < b":
|
||||
return (a < b, )
|
||||
elif cmp == "a >= b":
|
||||
return (a >= b, )
|
||||
elif cmp == "a <= b":
|
||||
return (a <= b, )
|
||||
elif cmp == 'tt':
|
||||
return (True, )
|
||||
else:
|
||||
return (False, )
|
||||
|
||||
|
||||
class ImpactNotEmptySEGS:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {"segs": ("SEGS",)}}
|
||||
|
||||
FUNCTION = "doit"
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = ("BOOLEAN", )
|
||||
|
||||
def doit(self, segs):
|
||||
return (segs[1] != [], )
|
||||
|
||||
|
||||
class ImpactConditionalBranch:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"cond": ("BOOLEAN",),
|
||||
"tt_value": (any_typ,{"lazy": True}),
|
||||
"ff_value": (any_typ,{"lazy": True}),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = (any_typ, )
|
||||
|
||||
def check_lazy_status(self, cond, tt_value=None, ff_value=None):
|
||||
if cond and tt_value is None:
|
||||
return ["tt_value"]
|
||||
if not cond and ff_value is None:
|
||||
return ["ff_value"]
|
||||
|
||||
def doit(self, cond, tt_value=None, ff_value=None):
|
||||
if cond:
|
||||
return (tt_value,)
|
||||
else:
|
||||
return (ff_value,)
|
||||
|
||||
|
||||
class ImpactConditionalBranchSelMode:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
if not core.is_execution_model_version_supported():
|
||||
required_inputs = {
|
||||
"cond": ("BOOLEAN",),
|
||||
"sel_mode": ("BOOLEAN", {"default": True, "label_on": "select_on_prompt", "label_off": "select_on_execution"}),
|
||||
}
|
||||
else:
|
||||
required_inputs = {
|
||||
"cond": ("BOOLEAN",),
|
||||
}
|
||||
|
||||
return {
|
||||
"required": required_inputs,
|
||||
"optional": {
|
||||
"tt_value": (any_typ,),
|
||||
"ff_value": (any_typ,),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = (any_typ, )
|
||||
|
||||
def doit(self, cond, tt_value=None, ff_value=None, **kwargs):
|
||||
if cond:
|
||||
return (tt_value,)
|
||||
else:
|
||||
return (ff_value,)
|
||||
|
||||
|
||||
class ImpactConvertDataType:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {"value": (any_typ,)}}
|
||||
|
||||
RETURN_TYPES = ("STRING", "FLOAT", "INT", "BOOLEAN")
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
@staticmethod
|
||||
def is_number(string):
|
||||
pattern = re.compile(r'^[-+]?[0-9]*\.?[0-9]+$')
|
||||
return bool(pattern.match(string))
|
||||
|
||||
def doit(self, value):
|
||||
if self.is_number(str(value)):
|
||||
num = value
|
||||
else:
|
||||
if str.lower(str(value)) != "false":
|
||||
num = 1
|
||||
else:
|
||||
num = 0
|
||||
return (str(value), float(num), int(float(num)), bool(float(num)), )
|
||||
|
||||
|
||||
class ImpactIfNone:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {},
|
||||
"optional": {"signal": (any_typ,), "any_input": (any_typ,), }
|
||||
}
|
||||
|
||||
RETURN_TYPES = (any_typ, "BOOLEAN")
|
||||
RETURN_NAMES = ("signal_opt", "bool")
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
def doit(self, signal=None, any_input=None):
|
||||
if any_input is None:
|
||||
return (signal, False, )
|
||||
else:
|
||||
return (signal, True, )
|
||||
|
||||
|
||||
class ImpactLogicalOperators:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"operator": (['and', 'or', 'xor'],),
|
||||
"bool_a": ("BOOLEAN", {"forceInput": True}),
|
||||
"bool_b": ("BOOLEAN", {"forceInput": True}),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = ("BOOLEAN", )
|
||||
|
||||
def doit(self, operator, bool_a, bool_b):
|
||||
if operator == "and":
|
||||
return (bool_a and bool_b, )
|
||||
elif operator == "or":
|
||||
return (bool_a or bool_b, )
|
||||
else:
|
||||
return (bool_a != bool_b, )
|
||||
|
||||
|
||||
class ImpactConditionalStopIteration:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": { "cond": ("BOOLEAN", {"forceInput": True}), },
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = ()
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def doit(self, cond):
|
||||
if cond:
|
||||
PromptServer.instance.send_sync("stop-iteration", {})
|
||||
return {}
|
||||
|
||||
|
||||
class ImpactNeg:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": { "value": ("BOOLEAN", {"forceInput": True}), },
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = ("BOOLEAN", )
|
||||
|
||||
def doit(self, value):
|
||||
return (not value, )
|
||||
|
||||
|
||||
class ImpactInt:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"value": ("INT", {"default": 0, "min": 0, "max": sys.maxsize, "step": 1}),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = ("INT", )
|
||||
|
||||
def doit(self, value):
|
||||
return (value, )
|
||||
|
||||
|
||||
class ImpactFloat:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"value": ("FLOAT", {"default": 1.0, "min": -3.402823466e+38, "max": 3.402823466e+38}),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = ("FLOAT", )
|
||||
|
||||
def doit(self, value):
|
||||
return (value, )
|
||||
|
||||
|
||||
class ImpactBoolean:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"value": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = ("BOOLEAN", )
|
||||
|
||||
def doit(self, value):
|
||||
return (value, )
|
||||
|
||||
|
||||
class ImpactValueSender:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"value": (any_typ, ),
|
||||
"link_id": ("INT", {"default": 0, "min": 0, "max": sys.maxsize, "step": 1}),
|
||||
},
|
||||
"optional": {
|
||||
"signal_opt": (any_typ,),
|
||||
}
|
||||
}
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = (any_typ, )
|
||||
RETURN_NAMES = ("signal", )
|
||||
|
||||
def doit(self, value, link_id=0, signal_opt=None):
|
||||
PromptServer.instance.send_sync("value-send", {"link_id": link_id, "value": value})
|
||||
return (signal_opt, )
|
||||
|
||||
|
||||
class ImpactIntConstSender:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"signal": (any_typ, ),
|
||||
"value": ("INT", {"default": 0, "min": 0, "max": sys.maxsize, "step": 1}),
|
||||
"link_id": ("INT", {"default": 0, "min": 0, "max": sys.maxsize, "step": 1}),
|
||||
},
|
||||
}
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = ()
|
||||
|
||||
def doit(self, signal, value, link_id=0):
|
||||
PromptServer.instance.send_sync("value-send", {"link_id": link_id, "value": value})
|
||||
return {}
|
||||
|
||||
|
||||
class ImpactValueReceiver:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"typ": (["STRING", "INT", "FLOAT", "BOOLEAN"], ),
|
||||
"value": ("STRING", {"default": ""}),
|
||||
"link_id": ("INT", {"default": 0, "min": 0, "max": sys.maxsize, "step": 1}),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
|
||||
RETURN_TYPES = (any_typ, )
|
||||
|
||||
def doit(self, typ, value, link_id=0):
|
||||
if typ == "INT":
|
||||
return (int(value), )
|
||||
elif typ == "FLOAT":
|
||||
return (float(value), )
|
||||
elif typ == "BOOLEAN":
|
||||
return (value.lower() == "true", )
|
||||
else:
|
||||
return (value, )
|
||||
|
||||
|
||||
class ImpactImageInfo:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"value": ("IMAGE", ),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic/_for_test"
|
||||
|
||||
RETURN_TYPES = ("INT", "INT", "INT", "INT")
|
||||
RETURN_NAMES = ("batch", "height", "width", "channel")
|
||||
|
||||
def doit(self, value):
|
||||
return (value.shape[0], value.shape[1], value.shape[2], value.shape[3])
|
||||
|
||||
|
||||
class ImpactLatentInfo:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"value": ("LATENT", ),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic/_for_test"
|
||||
|
||||
RETURN_TYPES = ("INT", "INT", "INT", "INT")
|
||||
RETURN_NAMES = ("batch", "height", "width", "channel")
|
||||
|
||||
def doit(self, value):
|
||||
shape = value['samples'].shape
|
||||
return (shape[0], shape[2] * 8, shape[3] * 8, shape[1])
|
||||
|
||||
|
||||
class ImpactMinMax:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"mode": ("BOOLEAN", {"default": True, "label_on": "max", "label_off": "min"}),
|
||||
"a": (any_typ,),
|
||||
"b": (any_typ,),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic/_for_test"
|
||||
|
||||
RETURN_TYPES = ("INT", )
|
||||
|
||||
def doit(self, mode, a, b):
|
||||
if mode:
|
||||
return (max(a, b), )
|
||||
else:
|
||||
return (min(a, b),)
|
||||
|
||||
|
||||
class ImpactQueueTrigger:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"signal": (any_typ,),
|
||||
"mode": ("BOOLEAN", {"default": True, "label_on": "Trigger", "label_off": "Don't trigger"}),
|
||||
}
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic/_for_test"
|
||||
RETURN_TYPES = (any_typ,)
|
||||
RETURN_NAMES = ("signal_opt",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def doit(self, signal, mode):
|
||||
if(mode):
|
||||
PromptServer.instance.send_sync("impact-add-queue", {})
|
||||
|
||||
return (signal,)
|
||||
|
||||
|
||||
class ImpactQueueTriggerCountdown:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"count": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||
"total": ("INT", {"default": 10, "min": 1, "max": 0xffffffffffffffff}),
|
||||
"mode": ("BOOLEAN", {"default": True, "label_on": "Trigger", "label_off": "Don't trigger"}),
|
||||
},
|
||||
"optional": {"signal": (any_typ,),},
|
||||
"hidden": {"unique_id": "UNIQUE_ID"}
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic/_for_test"
|
||||
RETURN_TYPES = (any_typ, "INT", "INT")
|
||||
RETURN_NAMES = ("signal_opt", "count", "total")
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def doit(self, count, total, mode, unique_id, signal=None):
|
||||
if (mode):
|
||||
if count < total - 1:
|
||||
PromptServer.instance.send_sync("impact-node-feedback",
|
||||
{"node_id": unique_id, "widget_name": "count", "type": "int", "value": count+1})
|
||||
PromptServer.instance.send_sync("impact-add-queue", {})
|
||||
if count >= total - 1:
|
||||
PromptServer.instance.send_sync("impact-node-feedback",
|
||||
{"node_id": unique_id, "widget_name": "count", "type": "int", "value": 0})
|
||||
|
||||
return (signal, count, total)
|
||||
|
||||
|
||||
|
||||
class ImpactSetWidgetValue:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"signal": (any_typ,),
|
||||
"node_id": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||
"widget_name": ("STRING", {"multiline": False}),
|
||||
},
|
||||
"optional": {
|
||||
"boolean_value": ("BOOLEAN", {"forceInput": True}),
|
||||
"int_value": ("INT", {"forceInput": True}),
|
||||
"float_value": ("FLOAT", {"forceInput": True}),
|
||||
"string_value": ("STRING", {"forceInput": True}),
|
||||
}
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic/_for_test"
|
||||
RETURN_TYPES = (any_typ,)
|
||||
RETURN_NAMES = ("signal_opt",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def doit(self, signal, node_id, widget_name, boolean_value=None, int_value=None, float_value=None, string_value=None, ):
|
||||
kind = None
|
||||
if boolean_value is not None:
|
||||
value = boolean_value
|
||||
kind = "BOOLEAN"
|
||||
elif int_value is not None:
|
||||
value = int_value
|
||||
kind = "INT"
|
||||
elif float_value is not None:
|
||||
value = float_value
|
||||
kind = "FLOAT"
|
||||
elif string_value is not None:
|
||||
value = string_value
|
||||
kind = "STRING"
|
||||
else:
|
||||
value = None
|
||||
|
||||
if value is not None:
|
||||
PromptServer.instance.send_sync("impact-node-feedback",
|
||||
{"node_id": node_id, "widget_name": widget_name, "type": kind, "value": value})
|
||||
|
||||
return (signal,)
|
||||
|
||||
|
||||
class ImpactNodeSetMuteState:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"signal": (any_typ,),
|
||||
"node_id": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||
"set_state": ("BOOLEAN", {"default": True, "label_on": "active", "label_off": "mute"}),
|
||||
}
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic/_for_test"
|
||||
RETURN_TYPES = (any_typ,)
|
||||
RETURN_NAMES = ("signal_opt",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def doit(self, signal, node_id, set_state):
|
||||
PromptServer.instance.send_sync("impact-node-mute-state", {"node_id": node_id, "is_active": set_state})
|
||||
return (signal,)
|
||||
|
||||
|
||||
class ImpactSleep:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"signal": (any_typ,),
|
||||
"seconds": ("FLOAT", {"default": 0.5, "min": 0, "max": 3600}),
|
||||
}
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic/_for_test"
|
||||
RETURN_TYPES = (any_typ,)
|
||||
RETURN_NAMES = ("signal_opt",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def doit(self, signal, seconds):
|
||||
time.sleep(seconds)
|
||||
return (signal,)
|
||||
|
||||
|
||||
def workflow_to_map(workflow):
|
||||
nodes = {}
|
||||
links = {}
|
||||
for link in workflow['links']:
|
||||
links[link[0]] = link[1:]
|
||||
for node in workflow['nodes']:
|
||||
nodes[str(node['id'])] = node
|
||||
|
||||
return nodes, links
|
||||
|
||||
|
||||
class ImpactRemoteBoolean:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"node_id": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||
"widget_name": ("STRING", {"multiline": False}),
|
||||
"value": ("BOOLEAN", {"default": True, "label_on": "True", "label_off": "False"}),
|
||||
}}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic/_for_test"
|
||||
RETURN_TYPES = ()
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def doit(self, **kwargs):
|
||||
return {}
|
||||
|
||||
|
||||
class ImpactRemoteInt:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"node_id": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||
"widget_name": ("STRING", {"multiline": False}),
|
||||
"value": ("INT", {"default": 0, "min": -0xffffffffffffffff, "max": 0xffffffffffffffff}),
|
||||
}}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic/_for_test"
|
||||
RETURN_TYPES = ()
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def doit(self, **kwargs):
|
||||
return {}
|
||||
|
||||
class ImpactControlBridge:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"value": (any_typ,),
|
||||
"mode": ("BOOLEAN", {"default": True, "label_on": "Active", "label_off": "Stop/Mute/Bypass"}),
|
||||
"behavior": (["Stop", "Mute", "Bypass"], ),
|
||||
},
|
||||
"hidden": {"unique_id": "UNIQUE_ID", "prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"}
|
||||
}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Logic"
|
||||
RETURN_TYPES = (any_typ,)
|
||||
RETURN_NAMES = ("value",)
|
||||
OUTPUT_NODE = True
|
||||
|
||||
DESCRIPTION = ("When behavior is Stop and mode is active, the input value is passed directly to the output.\n"
|
||||
"When behavior is Mute/Bypass and mode is active, the node connected to the output is changed to active state.\n"
|
||||
"When behavior is Stop and mode is Stop/Mute/Bypass, the workflow execution of the current node is halted.\n"
|
||||
"When behavior is Mute/Bypass and mode is Stop/Mute/Bypass, the node connected to the output is changed to Mute/Bypass state.")
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(self, value, mode, behavior="Stop", unique_id=None, prompt=None, extra_pnginfo=None):
|
||||
if behavior == "Stop":
|
||||
return value, mode, behavior
|
||||
else:
|
||||
# NOTE: extra_pnginfo is not populated for IS_CHANGED.
|
||||
# so extra_pnginfo is useless in here
|
||||
try:
|
||||
workflow = core.current_prompt['extra_data']['extra_pnginfo']['workflow']
|
||||
except Exception:
|
||||
logging.info("[Impact Pack] core.current_prompt['extra_data']['extra_pnginfo']['workflow']")
|
||||
return 0
|
||||
|
||||
nodes, links = workflow_to_map(workflow)
|
||||
next_nodes = []
|
||||
|
||||
for link in nodes[unique_id]['outputs'][0]['links']:
|
||||
node_id = str(links[link][2])
|
||||
impact.utils.collect_non_reroute_nodes(nodes, links, next_nodes, node_id)
|
||||
|
||||
return next_nodes
|
||||
|
||||
def doit(self, value, mode, behavior="Stop", unique_id=None, prompt=None, extra_pnginfo=None):
|
||||
global error_skip_flag
|
||||
|
||||
if core.is_execution_model_version_supported():
|
||||
from comfy_execution.graph import ExecutionBlocker
|
||||
else:
|
||||
logging.info("[Impact Pack] ImpactControlBridge: ComfyUI is outdated. The 'Stop' behavior cannot function properly.")
|
||||
|
||||
if behavior == "Stop":
|
||||
if mode:
|
||||
return (value, )
|
||||
else:
|
||||
return (ExecutionBlocker(None), )
|
||||
elif extra_pnginfo is None:
|
||||
logging.warning(f"[Impact Pack] limitation: '{behavior}' behavior cannot be used in API execution.")
|
||||
return (value,)
|
||||
else:
|
||||
workflow_nodes, links = workflow_to_map(extra_pnginfo['workflow'])
|
||||
|
||||
active_nodes = []
|
||||
mute_nodes = []
|
||||
bypass_nodes = []
|
||||
|
||||
for link in workflow_nodes[unique_id]['outputs'][0]['links']:
|
||||
node_id = str(links[link][2])
|
||||
|
||||
next_nodes = []
|
||||
impact.utils.collect_non_reroute_nodes(workflow_nodes, links, next_nodes, node_id)
|
||||
|
||||
for next_node_id in next_nodes:
|
||||
node_mode = workflow_nodes[next_node_id]['mode']
|
||||
|
||||
if node_mode == 0:
|
||||
active_nodes.append(next_node_id)
|
||||
elif node_mode == 2:
|
||||
mute_nodes.append(next_node_id)
|
||||
elif node_mode == 4:
|
||||
bypass_nodes.append(next_node_id)
|
||||
|
||||
if mode:
|
||||
# active
|
||||
should_be_active_nodes = mute_nodes + bypass_nodes
|
||||
if len(should_be_active_nodes) > 0:
|
||||
PromptServer.instance.send_sync("impact-bridge-continue", {"node_id": unique_id, 'actives': list(should_be_active_nodes)})
|
||||
nodes.interrupt_processing()
|
||||
|
||||
elif behavior == "Mute" or behavior == True: # noqa: E712
|
||||
# mute
|
||||
should_be_mute_nodes = active_nodes + bypass_nodes
|
||||
if len(should_be_mute_nodes) > 0:
|
||||
PromptServer.instance.send_sync("impact-bridge-continue", {"node_id": unique_id, 'mutes': list(should_be_mute_nodes)})
|
||||
nodes.interrupt_processing()
|
||||
|
||||
else:
|
||||
# bypass
|
||||
should_be_bypass_nodes = active_nodes + mute_nodes
|
||||
if len(should_be_bypass_nodes) > 0:
|
||||
PromptServer.instance.send_sync("impact-bridge-continue", {"node_id": unique_id, 'bypasses': list(should_be_bypass_nodes)})
|
||||
nodes.interrupt_processing()
|
||||
|
||||
return (value, )
|
||||
|
||||
|
||||
class ImpactExecutionOrderController:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"signal": (any_typ,),
|
||||
"value": (any_typ,),
|
||||
}}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
RETURN_TYPES = (any_typ, any_typ)
|
||||
RETURN_NAMES = ("signal", "value")
|
||||
|
||||
def doit(self, signal, value):
|
||||
return signal, value
|
||||
|
||||
|
||||
class ImpactListBridge:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"list_input": (any_typ,),
|
||||
}}
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
DESCRIPTION = "When passing the list output through this node, it collects and organizes the data before forwarding it, which ensures that the previous stage's sub-workflow has been completed."
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
RETURN_TYPES = (any_typ, )
|
||||
RETURN_NAMES = ("list_output", )
|
||||
|
||||
INPUT_IS_LIST = True
|
||||
OUTPUT_IS_LIST = (True, )
|
||||
|
||||
@staticmethod
|
||||
def doit(list_input):
|
||||
return (list_input,)
|
||||
|
||||
|
||||
original_handle_execution = execution.PromptExecutor.handle_execution_error
|
||||
|
||||
|
||||
def handle_execution_error(**kwargs):
|
||||
execution.PromptExecutor.handle_execution_error(**kwargs)
|
||||
|
||||
@@ -0,0 +1,775 @@
|
||||
from impact.utils import any_typ, ByPassTypeTuple, make_3d_mask
|
||||
import comfy_extras.nodes_mask
|
||||
from nodes import MAX_RESOLUTION
|
||||
import torch
|
||||
import comfy
|
||||
import sys
|
||||
import nodes
|
||||
import re
|
||||
import impact.core as core
|
||||
from server import PromptServer
|
||||
import inspect
|
||||
import logging
|
||||
|
||||
|
||||
class GeneralSwitch:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
dyn_inputs = {"input1": (any_typ, {"lazy": True, "tooltip": "Any input. When connected, one more input slot is added."}), }
|
||||
if core.is_execution_model_version_supported():
|
||||
stack = inspect.stack()
|
||||
if stack[2].function == 'get_input_info':
|
||||
# bypass validation
|
||||
class AllContainer:
|
||||
def __contains__(self, item):
|
||||
return True
|
||||
|
||||
def __getitem__(self, key):
|
||||
return any_typ, {"lazy": True}
|
||||
|
||||
dyn_inputs = AllContainer()
|
||||
|
||||
inputs = {"required": {
|
||||
"select": ("INT", {"default": 1, "min": 1, "max": 999999, "step": 1, "tooltip": "The input number you want to output among the inputs"}),
|
||||
"sel_mode": ("BOOLEAN", {"default": False, "label_on": "select_on_prompt", "label_off": "select_on_execution", "forceInput": False,
|
||||
"tooltip": "In the case of 'select_on_execution', the selection is dynamically determined at the time of workflow execution. 'select_on_prompt' is an option that exists for older versions of ComfyUI, and it makes the decision before the workflow execution."}),
|
||||
},
|
||||
"optional": dyn_inputs,
|
||||
"hidden": {"unique_id": "UNIQUE_ID", "extra_pnginfo": "EXTRA_PNGINFO"}
|
||||
}
|
||||
|
||||
return inputs
|
||||
|
||||
RETURN_TYPES = (any_typ, "STRING", "INT")
|
||||
RETURN_NAMES = ("selected_value", "selected_label", "selected_index")
|
||||
OUTPUT_TOOLTIPS = ("Output is generated only from the input chosen by the 'select' value.", "Slot label of the selected input slot", "Outputs the select value as is")
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def check_lazy_status(self, *args, **kwargs):
|
||||
selected_index = int(kwargs['select'])
|
||||
input_name = f"input{selected_index}"
|
||||
|
||||
logging.info(f"SELECTED: {input_name}")
|
||||
|
||||
if input_name in kwargs:
|
||||
return [input_name]
|
||||
else:
|
||||
return []
|
||||
|
||||
@staticmethod
|
||||
def doit(*args, **kwargs):
|
||||
selected_index = int(kwargs['select'])
|
||||
input_name = f"input{selected_index}"
|
||||
|
||||
selected_label = input_name
|
||||
node_id = kwargs['unique_id']
|
||||
|
||||
if 'extra_pnginfo' in kwargs and kwargs['extra_pnginfo'] is not None:
|
||||
nodelist = kwargs['extra_pnginfo']['workflow']['nodes']
|
||||
for node in nodelist:
|
||||
if str(node['id']) == node_id:
|
||||
inputs = node['inputs']
|
||||
|
||||
for slot in inputs:
|
||||
if slot['name'] == input_name and 'label' in slot:
|
||||
selected_label = slot['label']
|
||||
|
||||
break
|
||||
else:
|
||||
logging.info("[Impact-Pack] The switch node does not guarantee proper functioning in API mode.")
|
||||
|
||||
if input_name in kwargs:
|
||||
return kwargs[input_name], selected_label, selected_index
|
||||
else:
|
||||
logging.info("ImpactSwitch: invalid select index (ignored)")
|
||||
return None, "", selected_index
|
||||
|
||||
class LatentSwitch:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"select": ("INT", {"default": 1, "min": 1, "max": 99999, "step": 1}),
|
||||
"latent1": ("LATENT",),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("LATENT", )
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, *args, **kwargs):
|
||||
input_name = f"latent{int(kwargs['select'])}"
|
||||
|
||||
if input_name in kwargs:
|
||||
return (kwargs[input_name],)
|
||||
else:
|
||||
logging.info("LatentSwitch: invalid select index ('latent1' is selected)")
|
||||
return (kwargs['latent1'],)
|
||||
|
||||
|
||||
class ImageMaskSwitch:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"select": ("INT", {"default": 1, "min": 1, "max": 4, "step": 1}),
|
||||
"images1": ("IMAGE",),
|
||||
},
|
||||
|
||||
"optional": {
|
||||
"mask1_opt": ("MASK",),
|
||||
"images2_opt": ("IMAGE",),
|
||||
"mask2_opt": ("MASK",),
|
||||
"images3_opt": ("IMAGE",),
|
||||
"mask3_opt": ("MASK",),
|
||||
"images4_opt": ("IMAGE",),
|
||||
"mask4_opt": ("MASK",),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("IMAGE", "MASK",)
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, select, images1, mask1_opt=None, images2_opt=None, mask2_opt=None, images3_opt=None, mask3_opt=None,
|
||||
images4_opt=None, mask4_opt=None):
|
||||
if select == 1:
|
||||
return images1, mask1_opt,
|
||||
elif select == 2:
|
||||
return images2_opt, mask2_opt,
|
||||
elif select == 3:
|
||||
return images3_opt, mask3_opt,
|
||||
else:
|
||||
return images4_opt, mask4_opt,
|
||||
|
||||
|
||||
class GeneralInversedSwitch:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"select": ("INT", {"default": 1, "min": 1, "max": 999999, "step": 1, "tooltip": "The output number you want to send from the input"}),
|
||||
"input": (any_typ, {"tooltip": "Any input. When connected, one more input slot is added."}),
|
||||
|
||||
},
|
||||
"optional": {
|
||||
"sel_mode": ("BOOLEAN", {"default": False, "label_on": "select_on_prompt", "label_off": "select_on_execution", "forceInput": False,
|
||||
"tooltip": "In the case of 'select_on_execution', the selection is dynamically determined at the time of workflow execution. 'select_on_prompt' is an option that exists for older versions of ComfyUI, and it makes the decision before the workflow execution."}),
|
||||
},
|
||||
"hidden": {"prompt": "PROMPT", "unique_id": "UNIQUE_ID"},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ByPassTypeTuple((any_typ, ))
|
||||
OUTPUT_TOOLTIPS = ("Output occurs only from the output selected by the 'select' value.\nWhen slots are connected, additional slots are created.", )
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, select, prompt, unique_id, input, **kwargs):
|
||||
if core.is_execution_model_version_supported():
|
||||
from comfy_execution.graph import ExecutionBlocker
|
||||
else:
|
||||
logging.warning("[Impact Pack] InversedSwitch: ComfyUI is outdated. The 'select_on_execution' mode cannot function properly.")
|
||||
|
||||
res = []
|
||||
|
||||
# search max output count in prompt
|
||||
cnt = 0
|
||||
for x in prompt.values():
|
||||
for y in x.get('inputs', {}).values():
|
||||
if isinstance(y, list) and len(y) == 2:
|
||||
if y[0] == unique_id:
|
||||
cnt = max(cnt, y[1])
|
||||
|
||||
for i in range(0, cnt + 1):
|
||||
if select == i+1:
|
||||
res.append(input)
|
||||
elif core.is_execution_model_version_supported():
|
||||
res.append(ExecutionBlocker(None))
|
||||
else:
|
||||
res.append(None)
|
||||
|
||||
return res
|
||||
|
||||
|
||||
class RemoveNoiseMask:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"samples": ("LATENT",)}}
|
||||
|
||||
RETURN_TYPES = ("LATENT",)
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, samples):
|
||||
res = {key: value for key, value in samples.items() if key != 'noise_mask'}
|
||||
return (res, )
|
||||
|
||||
|
||||
class ImagePasteMasked:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"destination": ("IMAGE",),
|
||||
"source": ("IMAGE",),
|
||||
"x": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 1}),
|
||||
"y": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 1}),
|
||||
"resize_source": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"optional": {
|
||||
"mask": ("MASK",),
|
||||
}
|
||||
}
|
||||
RETURN_TYPES = ("IMAGE",)
|
||||
FUNCTION = "composite"
|
||||
|
||||
CATEGORY = "image"
|
||||
|
||||
def composite(self, destination, source, x, y, resize_source, mask = None):
|
||||
destination = destination.clone().movedim(-1, 1)
|
||||
output = comfy_extras.nodes_mask.composite(destination, source.movedim(-1, 1), x, y, mask, 1, resize_source).movedim(1, -1)
|
||||
return (output,)
|
||||
|
||||
|
||||
from impact.utils import any_typ
|
||||
|
||||
class ImpactLogger:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"data": (any_typ,),
|
||||
"text": ("STRING", {"multiline": True}),
|
||||
},
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO", "unique_id": "UNIQUE_ID"},
|
||||
}
|
||||
|
||||
CATEGORY = "ImpactPack/Debug"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
RETURN_TYPES = ()
|
||||
FUNCTION = "doit"
|
||||
|
||||
def doit(self, data, text, prompt, extra_pnginfo, unique_id):
|
||||
shape = ""
|
||||
if hasattr(data, "shape"):
|
||||
shape = f"{data.shape} / "
|
||||
|
||||
logging.info(f"[IMPACT LOGGER]: {shape}{data}")
|
||||
|
||||
logging.info(f" PROMPT: {prompt}")
|
||||
|
||||
# for x in prompt:
|
||||
# if 'inputs' in x and 'populated_text' in x['inputs']:
|
||||
# print(f"PROMPT: {x['10']['inputs']['populated_text']}")
|
||||
#
|
||||
# for x in extra_pnginfo['workflow']['nodes']:
|
||||
# if x['type'] == 'ImpactWildcardProcessor':
|
||||
# print(f" WV : {x['widgets_values'][1]}\n")
|
||||
|
||||
PromptServer.instance.send_sync("impact-node-feedback", {"node_id": unique_id, "widget_name": "text", "type": "TEXT", "value": f"{data}"})
|
||||
return {}
|
||||
|
||||
|
||||
class ImpactDummyInput:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {}}
|
||||
|
||||
CATEGORY = "ImpactPack/Debug"
|
||||
|
||||
RETURN_TYPES = (any_typ,)
|
||||
FUNCTION = "doit"
|
||||
|
||||
def doit(self):
|
||||
return ("DUMMY",)
|
||||
|
||||
|
||||
class MasksToMaskList:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"optional": {
|
||||
"masks": ("MASK", ),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MASK", )
|
||||
OUTPUT_IS_LIST = (True, )
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Operation"
|
||||
|
||||
def doit(self, masks):
|
||||
if masks is None:
|
||||
empty_mask = torch.zeros((64, 64), dtype=torch.float32, device="cpu")
|
||||
return ([empty_mask], )
|
||||
|
||||
res = []
|
||||
|
||||
for mask in masks:
|
||||
res.append(mask)
|
||||
|
||||
res = [make_3d_mask(x) for x in res]
|
||||
|
||||
return (res, )
|
||||
|
||||
|
||||
class MaskListToMaskBatch:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"mask": ("MASK", ),
|
||||
}
|
||||
}
|
||||
|
||||
INPUT_IS_LIST = True
|
||||
|
||||
RETURN_TYPES = ("MASK", )
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Operation"
|
||||
|
||||
def doit(self, mask):
|
||||
if len(mask) == 0:
|
||||
empty_mask = torch.zeros((1, 64, 64), dtype=torch.float32, device="cpu").unsqueeze(0)
|
||||
return (empty_mask,)
|
||||
|
||||
masks_3d = [make_3d_mask(m) for m in mask]
|
||||
target_shape = masks_3d[0].shape[1:]
|
||||
upscaled_masks = []
|
||||
for m in masks_3d:
|
||||
if m.shape[1:] != target_shape:
|
||||
m = m.unsqueeze(1).repeat(1, 3, 1, 1)
|
||||
m = comfy.utils.common_upscale(m, target_shape[1], target_shape[0], "lanczos", "center")
|
||||
m = m[:, 0, :, :]
|
||||
|
||||
upscaled_masks.append(m)
|
||||
# Concatenate all at once
|
||||
result = torch.cat(upscaled_masks, dim=0)
|
||||
return (result,)
|
||||
|
||||
|
||||
class ImageListToImageBatch:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"images": ("IMAGE", ),
|
||||
}
|
||||
}
|
||||
|
||||
INPUT_IS_LIST = True
|
||||
|
||||
RETURN_TYPES = ("IMAGE", )
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Operation"
|
||||
|
||||
def doit(self, images):
|
||||
if len(images) == 0:
|
||||
return ()
|
||||
if len(images) == 1:
|
||||
img = images[0]
|
||||
if img.ndim == 3: # add batch dim if missing
|
||||
img = img.unsqueeze(0)
|
||||
return (img,)
|
||||
|
||||
# Start with the first image
|
||||
image1 = images[0]
|
||||
if image1.ndim == 3:
|
||||
image1 = image1.unsqueeze(0)
|
||||
|
||||
for image2 in images[1:]:
|
||||
# Ensure batch dim
|
||||
if image2.ndim == 3:
|
||||
image2 = image2.unsqueeze(0)
|
||||
|
||||
# Ensure same device
|
||||
if image2.device != image1.device:
|
||||
image2 = image2.to(image1.device)
|
||||
|
||||
# Ensure HxW match exactly
|
||||
H, W = image1.shape[1], image1.shape[2]
|
||||
if image2.shape[1] != H or image2.shape[2] != W:
|
||||
image2 = comfy.utils.common_upscale(
|
||||
image2.movedim(-1, 1), # move channels first
|
||||
W, # width
|
||||
H, # height
|
||||
"lanczos",
|
||||
"center"
|
||||
).movedim(1, -1) # move channels back last
|
||||
|
||||
# Ensure channels match
|
||||
if image2.shape[3] != image1.shape[3]:
|
||||
# simple fix: truncate or pad channels
|
||||
min_C = min(image1.shape[3], image2.shape[3])
|
||||
image1 = image1[:, :, :, :min_C]
|
||||
image2 = image2[:, :, :, :min_C]
|
||||
|
||||
# Concatenate along batch dimension
|
||||
image1 = torch.cat((image1, image2), dim=0)
|
||||
|
||||
return (image1,)
|
||||
|
||||
|
||||
class ImageBatchToImageList:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"image": ("IMAGE",), }}
|
||||
|
||||
RETURN_TYPES = ("IMAGE",)
|
||||
OUTPUT_IS_LIST = (True,)
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, image):
|
||||
images = [image[i:i + 1, ...] for i in range(image.shape[0])]
|
||||
return (images, )
|
||||
|
||||
|
||||
class MakeAnyList:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {},
|
||||
"optional": {"value1": (any_typ,), }
|
||||
}
|
||||
|
||||
RETURN_TYPES = (any_typ,)
|
||||
OUTPUT_IS_LIST = (True,)
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, **kwargs):
|
||||
values = []
|
||||
|
||||
for k, v in kwargs.items():
|
||||
if v is not None:
|
||||
values.append(v)
|
||||
|
||||
return (values, )
|
||||
|
||||
|
||||
class MakeMaskList:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"mask1": ("MASK",), }}
|
||||
|
||||
RETURN_TYPES = ("MASK",)
|
||||
OUTPUT_IS_LIST = (True,)
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, **kwargs):
|
||||
masks = []
|
||||
|
||||
for k, v in kwargs.items():
|
||||
masks.append(v)
|
||||
|
||||
return (masks, )
|
||||
|
||||
|
||||
class NthItemOfAnyList:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"any_list": (any_typ,),
|
||||
"index": ("INT", {"default": 0, "min": -sys.maxsize, "max": sys.maxsize, "step": 1, "tooltip": "The index of the item you want to select from the list. Use negative values to select from the end (e.g., -1 for last item, -2 for second to last)."}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = (any_typ,)
|
||||
INPUT_IS_LIST = True
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
DESCRIPTION = "Selects the Nth item from a list. If the index is out of range, it returns the last item in the list."
|
||||
|
||||
def doit(self, any_list, index):
|
||||
i = index[0]
|
||||
list_len = len(any_list)
|
||||
if i >= list_len or i < -list_len:
|
||||
return (any_list[-1],)
|
||||
else:
|
||||
return (any_list[i],)
|
||||
|
||||
|
||||
class MakeImageList:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"optional": {"image1": ("IMAGE",), }}
|
||||
|
||||
RETURN_TYPES = ("IMAGE",)
|
||||
OUTPUT_IS_LIST = (True,)
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, **kwargs):
|
||||
images = []
|
||||
|
||||
for k, v in kwargs.items():
|
||||
images.append(v)
|
||||
|
||||
return (images, )
|
||||
|
||||
|
||||
class MakeImageBatch:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"optional": {"image1": ("IMAGE",), }}
|
||||
|
||||
RETURN_TYPES = ("IMAGE",)
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, **kwargs):
|
||||
images = [value for value in kwargs.values()]
|
||||
|
||||
if len(images) == 1:
|
||||
return (images[0],)
|
||||
else:
|
||||
image1 = images[0]
|
||||
for image2 in images[1:]:
|
||||
if image1.shape[1:] != image2.shape[1:]:
|
||||
image2 = comfy.utils.common_upscale(image2.movedim(-1, 1), image1.shape[2], image1.shape[1], "lanczos", "center").movedim(1, -1)
|
||||
image1 = torch.cat((image1, image2), dim=0)
|
||||
return (image1,)
|
||||
|
||||
|
||||
class MakeMaskBatch:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"optional": {"mask1": ("MASK",), }}
|
||||
|
||||
RETURN_TYPES = ("MASK",)
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, **kwargs):
|
||||
masks = [make_3d_mask(value) for value in kwargs.values()]
|
||||
|
||||
if len(masks) == 1:
|
||||
return (masks[0],)
|
||||
else:
|
||||
mask1 = masks[0]
|
||||
for mask2 in masks[1:]:
|
||||
if mask1.shape[1:] != mask2.shape[1:]:
|
||||
mask2 = comfy.utils.common_upscale(mask2.movedim(-1, 1), mask1.shape[2], mask1.shape[1], "lanczos", "center").movedim(1, -1)
|
||||
mask1 = torch.cat((mask1, mask2), dim=0)
|
||||
return (mask1,)
|
||||
|
||||
|
||||
class ReencodeLatent:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"samples": ("LATENT", ),
|
||||
"tile_mode": (["None", "Both", "Decode(input) only", "Encode(output) only"],),
|
||||
"input_vae": ("VAE", ),
|
||||
"output_vae": ("VAE", ),
|
||||
"tile_size": ("INT", {"default": 512, "min": 320, "max": 4096, "step": 64}),
|
||||
},
|
||||
"optional": {
|
||||
"overlap": ("INT", {"default": 64, "min": 0, "max": 4096, "step": 32, "tooltip": "This setting applies when 'tile_mode' is enabled."}),
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
RETURN_TYPES = ("LATENT", )
|
||||
FUNCTION = "doit"
|
||||
|
||||
def doit(self, samples, tile_mode, input_vae, output_vae, tile_size=512, overlap=64):
|
||||
if tile_mode in ["Both", "Decode(input) only"]:
|
||||
decoder = nodes.VAEDecodeTiled()
|
||||
if 'overlap' in inspect.signature(decoder.decode).parameters:
|
||||
pixels = decoder.decode(input_vae, samples, tile_size, overlap=overlap)[0]
|
||||
else:
|
||||
pixels = decoder.decode(input_vae, samples, tile_size, overlap=overlap)[0]
|
||||
else:
|
||||
pixels = nodes.VAEDecode().decode(input_vae, samples)[0]
|
||||
|
||||
if tile_mode in ["Both", "Encode(output) only"]:
|
||||
encoder = nodes.VAEEncodeTiled()
|
||||
if 'overlap' in inspect.signature(encoder.encode).parameters:
|
||||
return encoder.encode(output_vae, pixels, tile_size, overlap=overlap)
|
||||
else:
|
||||
return encoder.encode(output_vae, pixels, tile_size)
|
||||
else:
|
||||
return nodes.VAEEncode().encode(output_vae, pixels)
|
||||
|
||||
|
||||
class ReencodeLatentPipe:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"samples": ("LATENT", ),
|
||||
"tile_mode": (["None", "Both", "Decode(input) only", "Encode(output) only"],),
|
||||
"input_basic_pipe": ("BASIC_PIPE", ),
|
||||
"output_basic_pipe": ("BASIC_PIPE", ),
|
||||
},
|
||||
}
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
RETURN_TYPES = ("LATENT", )
|
||||
FUNCTION = "doit"
|
||||
|
||||
def doit(self, samples, tile_mode, input_basic_pipe, output_basic_pipe):
|
||||
_, _, input_vae, _, _ = input_basic_pipe
|
||||
_, _, output_vae, _, _ = output_basic_pipe
|
||||
return ReencodeLatent().doit(samples, tile_mode, input_vae, output_vae)
|
||||
|
||||
|
||||
class StringSelector:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"strings": ("STRING", {"multiline": True}),
|
||||
"multiline": ("BOOLEAN", {"default": False, "label_on": "enabled", "label_off": "disabled"}),
|
||||
"select": ("INT", {"min": 0, "max": sys.maxsize, "step": 1, "default": 0}),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, strings, multiline, select):
|
||||
lines = strings.split('\n')
|
||||
|
||||
if multiline:
|
||||
result = []
|
||||
current_string = ""
|
||||
|
||||
for line in lines:
|
||||
if line.startswith("#"):
|
||||
if current_string:
|
||||
result.append(current_string.strip())
|
||||
current_string = ""
|
||||
current_string += line + "\n"
|
||||
|
||||
if current_string:
|
||||
result.append(current_string.strip())
|
||||
|
||||
if len(result) == 0:
|
||||
selected = strings
|
||||
else:
|
||||
selected = result[select % len(result)]
|
||||
|
||||
if selected.startswith('#'):
|
||||
selected = selected[1:]
|
||||
else:
|
||||
if len(lines) == 0:
|
||||
selected = strings
|
||||
else:
|
||||
selected = lines[select % len(lines)]
|
||||
|
||||
return (selected, )
|
||||
|
||||
|
||||
class StringListToString:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"join_with": ("STRING", {"default": "\\n"}),
|
||||
"string_list": ("STRING", {"forceInput": True}),
|
||||
}
|
||||
}
|
||||
|
||||
INPUT_IS_LIST = True
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, join_with, string_list):
|
||||
# convert \\n to newline character
|
||||
if join_with[0] == "\\n":
|
||||
join_with[0] = "\n"
|
||||
|
||||
joined_text = join_with[0].join(string_list)
|
||||
|
||||
return (joined_text,)
|
||||
|
||||
|
||||
class WildcardPromptFromString:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"string": ("STRING", {"forceInput": True}),
|
||||
"delimiter": ("STRING", {"multiline": False, "default": "\\n" }),
|
||||
"prefix_all": ("STRING", {"multiline": False}),
|
||||
"postfix_all": ("STRING", {"multiline": False}),
|
||||
"restrict_to_tags": ("STRING", {"multiline": False}),
|
||||
"exclude_tags": ("STRING", {"multiline": False})
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING", "STRING",)
|
||||
RETURN_NAMES = ("wildcard", "segs_labels",)
|
||||
FUNCTION = "doit"
|
||||
|
||||
CATEGORY = "ImpactPack/Util"
|
||||
|
||||
def doit(self, string, delimiter, prefix_all, postfix_all, restrict_to_tags, exclude_tags):
|
||||
# convert \\n to newline character
|
||||
if delimiter == "\\n":
|
||||
delimiter = "\n"
|
||||
|
||||
# some sanity checks and normalization for later processing
|
||||
if prefix_all is None:
|
||||
prefix_all = ""
|
||||
if postfix_all is None:
|
||||
postfix_all = ""
|
||||
if restrict_to_tags is None:
|
||||
restrict_to_tags = ""
|
||||
if exclude_tags is None:
|
||||
exclude_tags = ""
|
||||
|
||||
restrict_to_tags = restrict_to_tags.split(", ")
|
||||
exclude_tags = exclude_tags.split(", ")
|
||||
|
||||
# build the wildcard prompt per list entry
|
||||
output = ["[LAB]"]
|
||||
labels = []
|
||||
for x in string.split(delimiter):
|
||||
label = str(len(labels) + 1)
|
||||
labels.append(label)
|
||||
x = x.split(", ")
|
||||
# restrict to tags
|
||||
if restrict_to_tags != [""]:
|
||||
x = list(set(x) & set(restrict_to_tags))
|
||||
# remove tags
|
||||
if exclude_tags != [""]:
|
||||
x = list(set(x) - set(exclude_tags))
|
||||
# next row: <LABEL> <PREFIX> <TAGS> <POSTFIX>
|
||||
prompt_for_seg = f'[{label}] {prefix_all} {", ".join(x)} {postfix_all}'.strip()
|
||||
output.append(prompt_for_seg)
|
||||
output = "\n".join(output)
|
||||
|
||||
# clean string: fixup double spaces, commas etc.
|
||||
output = re.sub(r' ,', ',', output)
|
||||
output = re.sub(r' +', ' ', output)
|
||||
output = re.sub(r',,+', ',', output)
|
||||
output = re.sub(r'\n, ', '\n', output)
|
||||
|
||||
return output, ", ".join(labels)
|
||||
@@ -0,0 +1,26 @@
|
||||
[project]
|
||||
name = "comfyui-impact-pack"
|
||||
description = "This node pack offers various detector nodes and detailer nodes that allow you to configure a workflow that automatically enhances facial details. And provide iterative upscaler."
|
||||
version = "8.28.2"
|
||||
license = { file = "LICENSE.txt" }
|
||||
dependencies = [
|
||||
"segment-anything",
|
||||
"scikit-image",
|
||||
"piexif",
|
||||
"transformers",
|
||||
"opencv-python-headless",
|
||||
"scipy",
|
||||
"numpy",
|
||||
"dill",
|
||||
"matplotlib",
|
||||
"sam2 @ git+https://github.com/facebookresearch/sam2"
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/ltdrdata/ComfyUI-Impact-Pack"
|
||||
# Used by Comfy Registry https://comfyregistry.org
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "drltdata"
|
||||
DisplayName = "ComfyUI Impact Pack"
|
||||
Icon = ""
|
||||
@@ -0,0 +1 @@
|
||||
{"sha":"d94bef1ee5ed3656f5ff1bb2830a4ffd94f40935","node_id":"C_kwDOLGBTQ9oAKGQ5NGJlZjFlZTVlZDM2NTZmNWZmMWJiMjgzMGE0ZmZkOTRmNDA5MzU","url":"https://api.github.com/repos/chflame163/ComfyUI_LayerStyle/git/commits/d94bef1ee5ed3656f5ff1bb2830a4ffd94f40935","html_url":"https://github.com/chflame163/ComfyUI_LayerStyle/commit/d94bef1ee5ed3656f5ff1bb2830a4ffd94f40935","author":{"name":"chflame163","email":"chflame@163.com","date":"2026-01-30T06:31:45Z"},"committer":{"name":"chflame163","email":"chflame@163.com","date":"2026-01-30T06:31:45Z"},"tree":{"sha":"71e802f4590393aed7d1c49e0b95177dd1b1e7a9","url":"https://api.github.com/repos/chflame163/ComfyUI_LayerStyle/git/trees/71e802f4590393aed7d1c49e0b95177dd1b1e7a9"},"message":"Ultra nodes support vitmatte-base-composition-1k","parents":[{"sha":"3d53de09d8c1fb904d5cb0a137b9bc75e9d77108","url":"https://api.github.com/repos/chflame163/ComfyUI_LayerStyle/git/commits/3d53de09d8c1fb904d5cb0a137b9bc75e9d77108","html_url":"https://github.com/chflame163/ComfyUI_LayerStyle/commit/3d53de09d8c1fb904d5cb0a137b9bc75e9d77108"}],"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null,"verified_at":null}}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 chflame163
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,48 @@
|
||||
import importlib.util
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
|
||||
NODE_CLASS_MAPPINGS = {}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {}
|
||||
|
||||
python = sys.executable
|
||||
|
||||
def get_ext_dir(subpath=None, mkdir=False):
|
||||
dir = os.path.dirname(__file__)
|
||||
if subpath is not None:
|
||||
dir = os.path.join(dir, subpath)
|
||||
|
||||
dir = os.path.abspath(dir)
|
||||
|
||||
if mkdir and not os.path.exists(dir):
|
||||
os.makedirs(dir)
|
||||
return dir
|
||||
|
||||
def serialize(obj):
|
||||
if isinstance(obj, (str, int, float, bool, list, dict, type(None))):
|
||||
return obj
|
||||
return str(obj) # 转为字符串
|
||||
|
||||
|
||||
py = get_ext_dir("py")
|
||||
files = os.listdir(py)
|
||||
all_nodes = {}
|
||||
for file in files:
|
||||
if not file.endswith(".py"):
|
||||
continue
|
||||
name = os.path.splitext(file)[0]
|
||||
imported_module = importlib.import_module(".py.{}".format(name), __name__)
|
||||
try:
|
||||
NODE_CLASS_MAPPINGS = {**NODE_CLASS_MAPPINGS, **imported_module.NODE_CLASS_MAPPINGS}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {**NODE_DISPLAY_NAME_MAPPINGS, **imported_module.NODE_DISPLAY_NAME_MAPPINGS}
|
||||
serialized_CLASS_MAPPINGS = {k: serialize(v) for k, v in imported_module.NODE_CLASS_MAPPINGS.items()}
|
||||
serialized_DISPLAY_NAME_MAPPINGS = {k: serialize(v) for k, v in imported_module.NODE_DISPLAY_NAME_MAPPINGS.items()}
|
||||
all_nodes[file]={"NODE_CLASS_MAPPINGS": serialized_CLASS_MAPPINGS, "NODE_DISPLAY_NAME_MAPPINGS": serialized_DISPLAY_NAME_MAPPINGS}
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
WEB_DIRECTORY = "./js"
|
||||
|
||||
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,80 @@
|
||||
import torch.cuda
|
||||
import gc
|
||||
import comfy.model_management
|
||||
from .imagefunc import AnyType, clear_memory
|
||||
|
||||
any = AnyType("*")
|
||||
|
||||
class PurgeVRAM:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"anything": (any, {}),
|
||||
"purge_cache": ("BOOLEAN", {"default": True}),
|
||||
"purge_models": ("BOOLEAN", {"default": True}),
|
||||
},
|
||||
"optional": {
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ()
|
||||
FUNCTION = "purge_vram"
|
||||
CATEGORY = '😺dzNodes/LayerUtility/SystemIO'
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def purge_vram(self, anything, purge_cache, purge_models):
|
||||
import torch.cuda
|
||||
import gc
|
||||
import comfy.model_management
|
||||
clear_memory()
|
||||
if purge_models:
|
||||
comfy.model_management.unload_all_models()
|
||||
comfy.model_management.soft_empty_cache()
|
||||
return (None,)
|
||||
|
||||
class PurgeVRAM_V2:
|
||||
|
||||
def __init__(self):
|
||||
self.NODE_NAME = 'PurgeVRAM V2'
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"anything": (any, {}),
|
||||
"purge_cache": ("BOOLEAN", {"default": True}),
|
||||
"purge_models": ("BOOLEAN", {"default": True}),
|
||||
},
|
||||
"optional": {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RETURN_TYPES = (any,)
|
||||
RETURN_NAMES = ("any",)
|
||||
FUNCTION = "purge_vram_v2"
|
||||
CATEGORY = '😺dzNodes/LayerUtility/SystemIO'
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def purge_vram_v2(self, anything, purge_cache, purge_models):
|
||||
clear_memory()
|
||||
if purge_models:
|
||||
comfy.model_management.unload_all_models()
|
||||
comfy.model_management.soft_empty_cache()
|
||||
return (anything,)
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"LayerUtility: PurgeVRAM": PurgeVRAM,
|
||||
"LayerUtility: PurgeVRAM V2": PurgeVRAM_V2,
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"LayerUtility: PurgeVRAM": "LayerUtility: Purge VRAM",
|
||||
"LayerUtility: PurgeVRAM V2": "LayerUtility: Purge VRAM V2",
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"sha":"90b117502f237dd008c541372b72935d93ae894c","node_id":"C_kwDOQ_fZq9oAKDkwYjExNzUwMmYyMzdkZDAwOGM1NDEzNzJiNzI5MzVkOTNhZTg5NGM","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/commits/90b117502f237dd008c541372b72935d93ae894c","html_url":"https://github.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/commit/90b117502f237dd008c541372b72935d93ae894c","author":{"name":"AICodeTudou","email":"411011819@qq.com","date":"2026-01-24T04:58:38Z"},"committer":{"name":"AICodeTudou","email":"411011819@qq.com","date":"2026-01-24T04:58:38Z"},"tree":{"sha":"8fa976b4a50452d4313c63287548451ed8b0b668","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/8fa976b4a50452d4313c63287548451ed8b0b668"},"message":"增加try catch为安装qwen3ttsmodel警告信息","parents":[{"sha":"887fc88f03d2d9ff387709b4e0aad93cd459d3b4","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/commits/887fc88f03d2d9ff387709b4e0aad93cd459d3b4","html_url":"https://github.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/commit/887fc88f03d2d9ff387709b4e0aad93cd459d3b4"}],"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null,"verified_at":null}}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,176 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative
|
||||
Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -0,0 +1,3 @@
|
||||
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
||||
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
@@ -0,0 +1,309 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import torch
|
||||
import numpy as np
|
||||
import folder_paths
|
||||
|
||||
# 将父目录添加到路径以允许导入 qwen_tts
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# 添加本地克隆的 cc 目录到 sys.path
|
||||
qwen_repo_path = os.path.join(current_dir, "Qwen3-TTS")
|
||||
if os.path.exists(qwen_repo_path) and qwen_repo_path not in sys.path:
|
||||
sys.path.append(qwen_repo_path)
|
||||
|
||||
parent_dir = os.path.dirname(current_dir)
|
||||
if parent_dir not in sys.path:
|
||||
sys.path.append(parent_dir)
|
||||
|
||||
try:
|
||||
from qwen_tts.inference.qwen3_tts_model import Qwen3TTSModel
|
||||
except ImportError as e:
|
||||
print("\n" + "!" * 50)
|
||||
print("Warning / 警告:")
|
||||
print("Failed to import Qwen3TTS dependencies. / 无法导入 Qwen3TTS 依赖项。")
|
||||
print(f"Error details / 错误详情: {e}")
|
||||
print("\nPlease try the following steps to fix this issue / 请尝试以下步骤解决此问题:")
|
||||
print("1. Open terminal in the node directory / 在节点目录下打开终端:")
|
||||
print(f" cd {os.path.dirname(os.path.abspath(__file__))}")
|
||||
print("2. Install dependencies / 安装依赖:")
|
||||
print(" pip install -r requirements.txt")
|
||||
print("3. If using portable ComfyUI / 如果使用便携版 ComfyUI:")
|
||||
print(" path/to/python_embeded/python.exe -m pip install -r requirements.txt")
|
||||
print("!" * 50 + "\n")
|
||||
pass
|
||||
|
||||
def get_all_speakers():
|
||||
speakers = set()
|
||||
qwen_models_dir = os.path.join(folder_paths.models_dir, "Qwen3-TTS-Models")
|
||||
if os.path.exists(qwen_models_dir):
|
||||
for d in os.listdir(qwen_models_dir):
|
||||
path = os.path.join(qwen_models_dir, d)
|
||||
if os.path.isdir(path):
|
||||
config_path = os.path.join(path, "config.json")
|
||||
if os.path.exists(config_path):
|
||||
try:
|
||||
with open(config_path, "r", encoding="utf-8") as f:
|
||||
config = json.load(f)
|
||||
if "talker_config" in config and "spk_id" in config["talker_config"]:
|
||||
speakers.update(config["talker_config"]["spk_id"].keys())
|
||||
except Exception as e:
|
||||
print(f"Failed to read config for {d}: {e}")
|
||||
|
||||
if not speakers:
|
||||
return ["Vivian", "Serena", "Ryan"] # Fallback defaults
|
||||
|
||||
return sorted(list(speakers))
|
||||
|
||||
KNOWN_MODELS = [
|
||||
"Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice",
|
||||
"Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign",
|
||||
"Qwen/Qwen3-TTS-12Hz-1.7B-Base",
|
||||
"Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice",
|
||||
"Qwen/Qwen3-TTS-12Hz-0.6B-Base",
|
||||
]
|
||||
|
||||
class TDQwen3TTSModelLoader:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
qwen_models_dir = os.path.join(folder_paths.models_dir, "Qwen3-TTS-Models")
|
||||
if not os.path.exists(qwen_models_dir):
|
||||
try:
|
||||
os.makedirs(qwen_models_dir, exist_ok=True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Get existing directories
|
||||
existing_models = []
|
||||
if os.path.exists(qwen_models_dir):
|
||||
existing_models = [d for d in os.listdir(qwen_models_dir) if os.path.isdir(os.path.join(qwen_models_dir, d))]
|
||||
|
||||
# Merge known models and existing models (deduplicate by checking if known model's basename exists)
|
||||
model_list = list(KNOWN_MODELS)
|
||||
for existing in existing_models:
|
||||
# Check if this existing folder is already covered by a known model (by basename)
|
||||
is_known = False
|
||||
for known in KNOWN_MODELS:
|
||||
if known.split("/")[-1] == existing:
|
||||
is_known = True
|
||||
break
|
||||
if not is_known:
|
||||
model_list.append(existing)
|
||||
|
||||
if not model_list:
|
||||
model_list = ["Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice"]
|
||||
|
||||
return {
|
||||
"required": {
|
||||
"model_path": (model_list, {"default": "Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice"}),
|
||||
"precision": (["bf16", "fp16", "fp32"], {"default": "bf16"}),
|
||||
"device": (["cuda", "cpu"], {"default": "cuda"}),
|
||||
"attn_implementation": (["sdpa", "flash_attention_2", "eager"], {"default": "sdpa"}),
|
||||
"auto_download": ("BOOLEAN", {"default": False, "label_on": "Enable", "label_off": "Disable"}),
|
||||
"download_source": (["ModelScope", "HuggingFace"], {"default": "ModelScope"}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("QWEN3_TTS_MODEL",)
|
||||
RETURN_NAMES = ("model",)
|
||||
FUNCTION = "load_model"
|
||||
CATEGORY = "Qwen3TTS"
|
||||
|
||||
def load_model(self, model_path, precision, device, attn_implementation, auto_download, download_source):
|
||||
dtype = torch.bfloat16 if precision == "bf16" else torch.float16 if precision == "fp16" else torch.float32
|
||||
|
||||
print(f"Loading Qwen3-TTS Model from {model_path} (Precision: {precision}, Device: {device}, Attn: {attn_implementation})...")
|
||||
|
||||
qwen_models_dir = os.path.join(folder_paths.models_dir, "Qwen3-TTS-Models")
|
||||
|
||||
# Determine local path
|
||||
if "/" in model_path:
|
||||
local_name = model_path.split("/")[-1]
|
||||
else:
|
||||
local_name = model_path
|
||||
|
||||
local_path = os.path.join(qwen_models_dir, local_name)
|
||||
|
||||
# Check if model exists
|
||||
if not os.path.exists(local_path):
|
||||
if auto_download:
|
||||
print(f"Model not found at {local_path}. Attempting to download from {download_source}...")
|
||||
try:
|
||||
self.download_model(model_path, local_path, download_source)
|
||||
except Exception as e:
|
||||
raise RuntimeError(f"Failed to download model {model_path}: {e}")
|
||||
else:
|
||||
raise FileNotFoundError(f"Model not found at {local_path} and auto_download is disabled. Please enable auto_download or manually place the model in {qwen_models_dir}.")
|
||||
|
||||
print(f"Loading model from {local_path}...")
|
||||
model = Qwen3TTSModel.from_pretrained(
|
||||
local_path,
|
||||
device_map=device,
|
||||
dtype=dtype,
|
||||
attn_implementation=attn_implementation,
|
||||
)
|
||||
return (model,)
|
||||
|
||||
def download_model(self, model_id, local_dir, source):
|
||||
# Handle cases where user selected a custom folder name that isn't a repo ID
|
||||
if "/" not in model_id:
|
||||
# If it's not a repo ID, we can't download it unless we know the mapping.
|
||||
# But our INPUT_TYPES puts Repo IDs in the list.
|
||||
# If user manually typed a folder name, we assume they know what they are doing or it exists.
|
||||
# If it doesn't exist and isn't a repo ID, we can't download.
|
||||
raise ValueError(f"Cannot download '{model_id}' because it does not look like a valid Repo ID (e.g. User/Model).")
|
||||
|
||||
if source == "ModelScope":
|
||||
try:
|
||||
from modelscope import snapshot_download
|
||||
except ImportError:
|
||||
raise ImportError("ModelScope is not installed. Please run: pip install -U modelscope")
|
||||
|
||||
print(f"Downloading {model_id} from ModelScope to {local_dir}...")
|
||||
snapshot_download(model_id, local_dir=local_dir)
|
||||
|
||||
elif source == "HuggingFace":
|
||||
try:
|
||||
from huggingface_hub import snapshot_download
|
||||
except ImportError:
|
||||
raise ImportError("HuggingFace Hub is not installed. Please run: pip install -U huggingface_hub")
|
||||
|
||||
print(f"Downloading {model_id} from HuggingFace to {local_dir}...")
|
||||
snapshot_download(repo_id=model_id, local_dir=local_dir)
|
||||
|
||||
class TDQwen3TTSCustomVoice:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
speakers = get_all_speakers()
|
||||
return {
|
||||
"required": {
|
||||
"model": ("QWEN3_TTS_MODEL",),
|
||||
"text": ("STRING", {"multiline": True, "default": "你好,我是Qwen3-TTS。"}),
|
||||
"speaker": (speakers, {"default": speakers[0] if speakers else "Vivian"}),
|
||||
"language": (["Auto", "Chinese", "English", "Japanese", "Korean", "German", "French", "Russian", "Portuguese", "Spanish", "Italian"], {"default": "Auto"}),
|
||||
},
|
||||
"optional": {
|
||||
"instruct": ("STRING", {"multiline": True, "default": ""}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
RETURN_NAMES = ("audio",)
|
||||
FUNCTION = "generate"
|
||||
CATEGORY = "Qwen3TTS"
|
||||
|
||||
def generate(self, model, text, speaker, language, instruct=""):
|
||||
if language == "Auto":
|
||||
language = None
|
||||
|
||||
print(f"正在为说话人 {speaker} 生成自定义语音...")
|
||||
wavs, sr = model.generate_custom_voice(
|
||||
text=text,
|
||||
speaker=speaker,
|
||||
language=language,
|
||||
instruct=instruct if instruct else None
|
||||
)
|
||||
|
||||
# ComfyUI 音频格式: {'waveform': tensor [batch, channels, samples], 'sample_rate': int}
|
||||
# wavs[0] 是 [samples] (单声道)
|
||||
audio_tensor = torch.from_numpy(wavs[0]).unsqueeze(0).unsqueeze(0) # [1, 1, samples]
|
||||
|
||||
return ({"waveform": audio_tensor, "sample_rate": sr},)
|
||||
|
||||
class TDQwen3TTSVoiceDesign:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"model": ("QWEN3_TTS_MODEL",),
|
||||
"text": ("STRING", {"multiline": True, "default": "这是一个语音设计测试。"}),
|
||||
"instruct": ("STRING", {"multiline": True, "default": "一个年轻女性的声音,语气愉快。"}),
|
||||
"language": (["Auto", "Chinese", "English", "Japanese", "Korean", "German", "French", "Russian", "Portuguese", "Spanish", "Italian"], {"default": "Auto"}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
RETURN_NAMES = ("audio",)
|
||||
FUNCTION = "generate"
|
||||
CATEGORY = "Qwen3TTS"
|
||||
|
||||
def generate(self, model, text, instruct, language):
|
||||
if language == "Auto":
|
||||
language = None
|
||||
|
||||
print(f"正在使用指令生成语音设计: {instruct}...")
|
||||
wavs, sr = model.generate_voice_design(
|
||||
text=text,
|
||||
instruct=instruct,
|
||||
language=language
|
||||
)
|
||||
|
||||
audio_tensor = torch.from_numpy(wavs[0]).unsqueeze(0).unsqueeze(0)
|
||||
return ({"waveform": audio_tensor, "sample_rate": sr},)
|
||||
|
||||
class TDQwen3TTSVoiceClone:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"model": ("QWEN3_TTS_MODEL",),
|
||||
"text": ("STRING", {"multiline": True, "default": "这是一个语音克隆测试。"}),
|
||||
"ref_audio": ("AUDIO",),
|
||||
"language": (["Auto", "Chinese", "English", "Japanese", "Korean", "German", "French", "Russian", "Portuguese", "Spanish", "Italian"], {"default": "Auto"}),
|
||||
},
|
||||
"optional": {
|
||||
"ref_text": ("STRING", {"multiline": True, "default": ""}),
|
||||
"x_vector_only_mode": ("BOOLEAN", {"default": False, "label_on": "Enable", "label_off": "Disable"}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
RETURN_NAMES = ("audio",)
|
||||
FUNCTION = "generate"
|
||||
CATEGORY = "Qwen3TTS"
|
||||
|
||||
def generate(self, model, text, ref_audio, language, ref_text="", x_vector_only_mode=False):
|
||||
if language == "Auto":
|
||||
language = None
|
||||
|
||||
waveform = ref_audio["waveform"] # [batch, channels, samples]
|
||||
sr = ref_audio["sample_rate"]
|
||||
|
||||
# 处理参考音频:取第一个批次,如果多声道则混合为单声道,最后转为 numpy
|
||||
ref_wav_tensor = waveform[0] # [channels, samples]
|
||||
if ref_wav_tensor.shape[0] > 1:
|
||||
print(f"检测到多声道音频,正在混合为单声道...")
|
||||
ref_wav_tensor = torch.mean(ref_wav_tensor, dim=0, keepdim=True)
|
||||
|
||||
ref_wav_np = ref_wav_tensor.squeeze(0).numpy() # [samples]
|
||||
|
||||
# 参考 test_model_12hz_base.py 的实现
|
||||
# 如果未启用 x_vector_only_mode,则必须提供 ref_text
|
||||
if not x_vector_only_mode and not ref_text.strip():
|
||||
raise ValueError("必须填写参考文本(ref_text),内容为参考音频的实际说话内容。如果无法提供文本,请开启 'x_vector_only_mode'。")
|
||||
|
||||
print(f"正在生成语音克隆 (x_vector_only_mode={x_vector_only_mode})...")
|
||||
wavs, out_sr = model.generate_voice_clone(
|
||||
text=text,
|
||||
language=language,
|
||||
ref_audio=(ref_wav_np, sr),
|
||||
ref_text=ref_text if ref_text else None,
|
||||
x_vector_only_mode=x_vector_only_mode
|
||||
)
|
||||
|
||||
audio_tensor = torch.from_numpy(wavs[0]).unsqueeze(0).unsqueeze(0)
|
||||
return ({"waveform": audio_tensor, "sample_rate": out_sr},)
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"TDQwen3TTSModelLoader": TDQwen3TTSModelLoader,
|
||||
"TDQwen3TTSCustomVoice": TDQwen3TTSCustomVoice,
|
||||
"TDQwen3TTSVoiceDesign": TDQwen3TTSVoiceDesign,
|
||||
"TDQwen3TTSVoiceClone": TDQwen3TTSVoiceClone,
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"TDQwen3TTSModelLoader": "TD Qwen3 TTS Model Loader",
|
||||
"TDQwen3TTSCustomVoice": "TD Qwen3 TTS Custom Voice",
|
||||
"TDQwen3TTSVoiceDesign": "TD Qwen3 TTS Voice Design",
|
||||
"TDQwen3TTSVoiceClone": "TD Qwen3 TTS Voice Clone",
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
{
|
||||
"sources": [
|
||||
{
|
||||
"id": "core",
|
||||
"repo": "Comfy-Org/ComfyUI",
|
||||
"file": "comfy_extras/nodes_audio.py",
|
||||
"local_file": "core__comfy_extras__nodes_audio.py",
|
||||
"commit": "b874bd2b8c324d58cfc37bff0754dd16815a8f3c",
|
||||
"tree": "7b8179ffb38c06974fcd9f5c127b3e943893c6f5",
|
||||
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/b874bd2b8c324d58cfc37bff0754dd16815a8f3c/comfy_extras/nodes_audio.py",
|
||||
"sha256": "3b126494a63be63fb90707aea819d2f492dbdcb06e1dc4f964a3036aead394ed",
|
||||
"git_blob_sha1": "43df0512f290f47584fe91f718f0e6a4e4c8b9f7",
|
||||
"fetched_at": "2026-10-30T19:32:32.813149+00:00",
|
||||
"license_file": "core__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "core",
|
||||
"repo": "Comfy-Org/ComfyUI",
|
||||
"file": "comfy_extras/nodes_preview_any.py",
|
||||
"local_file": "core__comfy_extras__nodes_preview_any.py",
|
||||
"commit": "b874bd2b8c324d58cfc37bff0754dd16815a8f3c",
|
||||
"tree": "7b8179ffb38c06974fcd9f5c127b3e943893c6f5",
|
||||
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/b874bd2b8c324d58cfc37bff0754dd16815a8f3c/comfy_extras/nodes_preview_any.py",
|
||||
"sha256": "f8c526dbc4ec512f88a067524865f59eb24db636858f37d601e848885b2d0751",
|
||||
"git_blob_sha1": "b0a6f279dfc0788a527fe2e83fb54e637ecf952f",
|
||||
"fetched_at": "2026-10-30T19:32:33.121021+00:00",
|
||||
"license_file": "core__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "core",
|
||||
"repo": "Comfy-Org/ComfyUI",
|
||||
"file": "LICENSE",
|
||||
"local_file": "core__LICENSE",
|
||||
"commit": "b874bd2b8c324d58cfc37bff0754dd16815a8f3c",
|
||||
"tree": "7b8179ffb38c06974fcd9f5c127b3e943893c6f5",
|
||||
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/b874bd2b8c324d58cfc37bff0754dd16815a8f3c/LICENSE",
|
||||
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
|
||||
"git_blob_sha1": "f288702d2fa16d3cdf0035b15a9fcbc552cd88e7",
|
||||
"fetched_at": "2026-10-30T19:32:33.531738+00:00",
|
||||
"license_file": "core__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "core",
|
||||
"repo": "Comfy-Org/ComfyUI",
|
||||
"file": "folder_paths.py",
|
||||
"local_file": "core__folder_paths.py",
|
||||
"commit": "b874bd2b8c324d58cfc37bff0754dd16815a8f3c",
|
||||
"tree": "7b8179ffb38c06974fcd9f5c127b3e943893c6f5",
|
||||
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/b874bd2b8c324d58cfc37bff0754dd16815a8f3c/folder_paths.py",
|
||||
"sha256": "da62dbe3cc99c8d2bce4dd1df01c5a0ca149f9ed8522cc477e661629052ce112",
|
||||
"git_blob_sha1": "9c96540e3dd90626e9a6d4c1e3e00b80fffb2df8",
|
||||
"fetched_at": "2026-10-30T19:32:33.883076+00:00",
|
||||
"license_file": "core__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "cr",
|
||||
"repo": "Suzie1/ComfyUI_Comfyroll_CustomNodes",
|
||||
"file": "__init__.py",
|
||||
"local_file": "cr____init__.py",
|
||||
"commit": "d78b780ae43fcf8c6b7c6505e6ffb4584281ceca",
|
||||
"tree": "12c141b4c99138cd6beb2d5197574b9fe264bc74",
|
||||
"url": "https://raw.githubusercontent.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/d78b780ae43fcf8c6b7c6505e6ffb4584281ceca/__init__.py",
|
||||
"sha256": "f5648f54dad6044763ac2f5f75bb26ec7f24bb43a8c4a6f6be62e523efee2ff6",
|
||||
"git_blob_sha1": "e5af18356e8765423954ea7c7d22b4f32fcdd9c0",
|
||||
"fetched_at": "2026-10-30T19:32:30.321658+00:00",
|
||||
"license_file": "原Git树无LICENSE,许可文本未知",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "cr",
|
||||
"repo": "Suzie1/ComfyUI_Comfyroll_CustomNodes",
|
||||
"file": "node_mappings.py",
|
||||
"local_file": "cr__node_mappings.py",
|
||||
"commit": "d78b780ae43fcf8c6b7c6505e6ffb4584281ceca",
|
||||
"tree": "12c141b4c99138cd6beb2d5197574b9fe264bc74",
|
||||
"url": "https://raw.githubusercontent.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/d78b780ae43fcf8c6b7c6505e6ffb4584281ceca/node_mappings.py",
|
||||
"sha256": "9ae8fbedc4941f5bd1f58dd46898bb3dff20ef76ed65b27eb35d70df98b6e633",
|
||||
"git_blob_sha1": "a4a1bc4ff001961a64e24bcfa59de528fbc8a6ea",
|
||||
"fetched_at": "2026-10-30T19:32:30.790448+00:00",
|
||||
"license_file": "原Git树无LICENSE,许可文本未知",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "cr",
|
||||
"repo": "Suzie1/ComfyUI_Comfyroll_CustomNodes",
|
||||
"file": "nodes/nodes_core.py",
|
||||
"local_file": "cr__nodes__nodes_core.py",
|
||||
"commit": "d78b780ae43fcf8c6b7c6505e6ffb4584281ceca",
|
||||
"tree": "12c141b4c99138cd6beb2d5197574b9fe264bc74",
|
||||
"url": "https://raw.githubusercontent.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/d78b780ae43fcf8c6b7c6505e6ffb4584281ceca/nodes/nodes_core.py",
|
||||
"sha256": "cece30b4134527ee0b9e7b083de0d3cc389124c02d5f1785284c023ba6756ece",
|
||||
"git_blob_sha1": "02af795eace2b04226fcecd2df0c85db544caa37",
|
||||
"fetched_at": "2026-10-30T19:32:31.227674+00:00",
|
||||
"license_file": "原Git树无LICENSE,许可文本未知",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "loader",
|
||||
"repo": "AICoderTudou/ComfyUI-TD-Qwen3TTS",
|
||||
"file": "__init__.py",
|
||||
"local_file": "loader____init__.py",
|
||||
"commit": "90b117502f237dd008c541372b72935d93ae894c",
|
||||
"tree": "8fa976b4a50452d4313c63287548451ed8b0b668",
|
||||
"url": "https://raw.githubusercontent.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/90b117502f237dd008c541372b72935d93ae894c/__init__.py",
|
||||
"sha256": "7d1c52e999d89ba5cc77619c179d5917cedb8ba6f6445f5b27f765d2107a6f65",
|
||||
"git_blob_sha1": "3d998eae307a57377b852fc3fe321f91c8cd61d0",
|
||||
"fetched_at": "2026-10-30T19:32:30.118057+00:00",
|
||||
"license_file": "loader__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "loader",
|
||||
"repo": "AICoderTudou/ComfyUI-TD-Qwen3TTS",
|
||||
"file": "nodes.py",
|
||||
"local_file": "loader__nodes.py",
|
||||
"commit": "90b117502f237dd008c541372b72935d93ae894c",
|
||||
"tree": "8fa976b4a50452d4313c63287548451ed8b0b668",
|
||||
"url": "https://raw.githubusercontent.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/90b117502f237dd008c541372b72935d93ae894c/nodes.py",
|
||||
"sha256": "856bae79b336675bcaa027226e36375d9f948883c8971bfb4d4715dd56f95c2c",
|
||||
"git_blob_sha1": "05bee6030b166338d2a5de2dc87607bc2ccad003",
|
||||
"fetched_at": "2026-10-30T19:32:30.456569+00:00",
|
||||
"license_file": "loader__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "loader",
|
||||
"repo": "AICoderTudou/ComfyUI-TD-Qwen3TTS",
|
||||
"file": "LICENSE",
|
||||
"local_file": "loader__LICENSE",
|
||||
"commit": "90b117502f237dd008c541372b72935d93ae894c",
|
||||
"tree": "8fa976b4a50452d4313c63287548451ed8b0b668",
|
||||
"url": "https://raw.githubusercontent.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/90b117502f237dd008c541372b72935d93ae894c/LICENSE",
|
||||
"sha256": "c4a2cd14eb3abe621891b235bbe2cfd65f1f71afcfcd5c9b691bb016387dfe88",
|
||||
"git_blob_sha1": "377b1cfa01684d2d02891c9f149d32b44bded68f",
|
||||
"fetched_at": "2026-10-30T19:32:30.760403+00:00",
|
||||
"license_file": "loader__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "dialog",
|
||||
"repo": "AICoderTudou/ComfyUI-TD-Qwen3TTS",
|
||||
"file": "__init__.py",
|
||||
"local_file": "dialog____init__.py",
|
||||
"commit": "0c20c6b9ac22ecc4b5525de651fca0776a382dd3",
|
||||
"tree": "6da1640966511fb020ea54c2f3f20a5027907b14",
|
||||
"url": "https://raw.githubusercontent.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/0c20c6b9ac22ecc4b5525de651fca0776a382dd3/__init__.py",
|
||||
"sha256": "a246ff77bc33dc055d04310ed11d69d72917462c57637eab055bae5d51b9747b",
|
||||
"git_blob_sha1": "6ad7029884eb7ff2c491ebd8d0ad10834f79bfe6",
|
||||
"fetched_at": "2026-10-30T19:32:31.655206+00:00",
|
||||
"license_file": "dialog__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "dialog",
|
||||
"repo": "AICoderTudou/ComfyUI-TD-Qwen3TTS",
|
||||
"file": "nodes.py",
|
||||
"local_file": "dialog__nodes.py",
|
||||
"commit": "0c20c6b9ac22ecc4b5525de651fca0776a382dd3",
|
||||
"tree": "6da1640966511fb020ea54c2f3f20a5027907b14",
|
||||
"url": "https://raw.githubusercontent.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/0c20c6b9ac22ecc4b5525de651fca0776a382dd3/nodes.py",
|
||||
"sha256": "45b01b04a1237ec33a1d980b4b949967730d4535ce3362c058886a88a2867eff",
|
||||
"git_blob_sha1": "4861124c730b522857bc2b2eed08f8e1017911e2",
|
||||
"fetched_at": "2026-10-30T19:32:32.146196+00:00",
|
||||
"license_file": "dialog__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "dialog",
|
||||
"repo": "AICoderTudou/ComfyUI-TD-Qwen3TTS",
|
||||
"file": "LICENSE",
|
||||
"local_file": "dialog__LICENSE",
|
||||
"commit": "0c20c6b9ac22ecc4b5525de651fca0776a382dd3",
|
||||
"tree": "6da1640966511fb020ea54c2f3f20a5027907b14",
|
||||
"url": "https://raw.githubusercontent.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/0c20c6b9ac22ecc4b5525de651fca0776a382dd3/LICENSE",
|
||||
"sha256": "c4a2cd14eb3abe621891b235bbe2cfd65f1f71afcfcd5c9b691bb016387dfe88",
|
||||
"git_blob_sha1": "377b1cfa01684d2d02891c9f149d32b44bded68f",
|
||||
"fetched_at": "2026-10-30T19:32:32.456771+00:00",
|
||||
"license_file": "dialog__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "dialog",
|
||||
"repo": "AICoderTudou/ComfyUI-TD-Qwen3TTS",
|
||||
"file": "js/batch_speaker.js",
|
||||
"local_file": "dialog__js__batch_speaker.js",
|
||||
"commit": "0c20c6b9ac22ecc4b5525de651fca0776a382dd3",
|
||||
"tree": "6da1640966511fb020ea54c2f3f20a5027907b14",
|
||||
"url": "https://raw.githubusercontent.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/0c20c6b9ac22ecc4b5525de651fca0776a382dd3/js/batch_speaker.js",
|
||||
"sha256": "2011f9f3666a8e70c3ff3701f1abdbc3275eacfce4ed8c959a6fe1aafe1800ae",
|
||||
"git_blob_sha1": "71e5f8da1047f0e606b4a0a458f76661329d9939",
|
||||
"fetched_at": "2026-10-30T19:32:32.781149+00:00",
|
||||
"license_file": "dialog__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "dialog",
|
||||
"repo": "AICoderTudou/ComfyUI-TD-Qwen3TTS",
|
||||
"file": "js/multi_dialog.js",
|
||||
"local_file": "dialog__js__multi_dialog.js",
|
||||
"commit": "0c20c6b9ac22ecc4b5525de651fca0776a382dd3",
|
||||
"tree": "6da1640966511fb020ea54c2f3f20a5027907b14",
|
||||
"url": "https://raw.githubusercontent.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/0c20c6b9ac22ecc4b5525de651fca0776a382dd3/js/multi_dialog.js",
|
||||
"sha256": "05fbf6e01d4733870b6711f1cb9015156fcdbcd648b0349c45ed989f04c39e3a",
|
||||
"git_blob_sha1": "c60324a1faa88c5bd3b182197c73e8bdd34664fa",
|
||||
"fetched_at": "2026-10-30T19:32:33.376338+00:00",
|
||||
"license_file": "dialog__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "layer",
|
||||
"repo": "chflame163/ComfyUI_LayerStyle",
|
||||
"file": "__init__.py",
|
||||
"local_file": "layer____init__.py",
|
||||
"commit": "d94bef1ee5ed3656f5ff1bb2830a4ffd94f40935",
|
||||
"tree": "71e802f4590393aed7d1c49e0b95177dd1b1e7a9",
|
||||
"url": "https://raw.githubusercontent.com/chflame163/ComfyUI_LayerStyle/d94bef1ee5ed3656f5ff1bb2830a4ffd94f40935/__init__.py",
|
||||
"sha256": "952d1d20b52a8d9d544c12adad99a7ab633bd7dc9db4a352972eb127e10eb4a0",
|
||||
"git_blob_sha1": "fd50801f4dfafb2049c6755b14d5474f19cefa7a",
|
||||
"fetched_at": "2026-10-30T19:32:33.263863+00:00",
|
||||
"license_file": "layer__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "layer",
|
||||
"repo": "chflame163/ComfyUI_LayerStyle",
|
||||
"file": "py/purge_vram.py",
|
||||
"local_file": "layer__py__purge_vram.py",
|
||||
"commit": "d94bef1ee5ed3656f5ff1bb2830a4ffd94f40935",
|
||||
"tree": "71e802f4590393aed7d1c49e0b95177dd1b1e7a9",
|
||||
"url": "https://raw.githubusercontent.com/chflame163/ComfyUI_LayerStyle/d94bef1ee5ed3656f5ff1bb2830a4ffd94f40935/py/purge_vram.py",
|
||||
"sha256": "52a910b44f5a63f3e41bc6d4b756977b5b47d2591198fd1b200c2058807dd215",
|
||||
"git_blob_sha1": "2777233ea435d3d32da7db12eda83700cae71365",
|
||||
"fetched_at": "2026-10-30T19:32:33.614700+00:00",
|
||||
"license_file": "layer__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "layer",
|
||||
"repo": "chflame163/ComfyUI_LayerStyle",
|
||||
"file": "py/imagefunc.py",
|
||||
"local_file": "layer__py__imagefunc.py",
|
||||
"commit": "d94bef1ee5ed3656f5ff1bb2830a4ffd94f40935",
|
||||
"tree": "71e802f4590393aed7d1c49e0b95177dd1b1e7a9",
|
||||
"url": "https://raw.githubusercontent.com/chflame163/ComfyUI_LayerStyle/d94bef1ee5ed3656f5ff1bb2830a4ffd94f40935/py/imagefunc.py",
|
||||
"sha256": "8b86d33e06617cef208bdcb7fcd91585866d4b701eeede6033417463accddcdc",
|
||||
"git_blob_sha1": "9a4b2c46234a41d070b3a7fa8275b4b92279c24b",
|
||||
"fetched_at": "2026-10-30T19:32:34.439107+00:00",
|
||||
"license_file": "layer__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "layer",
|
||||
"repo": "chflame163/ComfyUI_LayerStyle",
|
||||
"file": "LICENSE",
|
||||
"local_file": "layer__LICENSE",
|
||||
"commit": "d94bef1ee5ed3656f5ff1bb2830a4ffd94f40935",
|
||||
"tree": "71e802f4590393aed7d1c49e0b95177dd1b1e7a9",
|
||||
"url": "https://raw.githubusercontent.com/chflame163/ComfyUI_LayerStyle/d94bef1ee5ed3656f5ff1bb2830a4ffd94f40935/LICENSE",
|
||||
"sha256": "5db9f53ef698ae099810ef003ef0668f644ebf4ffc041d5a2fffdaafc81569b0",
|
||||
"git_blob_sha1": "e2568121d079845a006a2935286b89d1721e9559",
|
||||
"fetched_at": "2026-10-30T19:32:34.683664+00:00",
|
||||
"license_file": "layer__LICENSE",
|
||||
"applicability": "源声明准确提交;发布包/目标安装绑定未知",
|
||||
"transport": "GitHub pinned raw text; blob verified"
|
||||
},
|
||||
{
|
||||
"id": "impact",
|
||||
"repo": "ltdrdata/ComfyUI-Impact-Pack",
|
||||
"file": "__init__.py",
|
||||
"local_file": "impact____init__.py",
|
||||
"url": "https://cdn.comfy.org/drltdata/comfyui-impact-pack/8.28.2/node.zip",
|
||||
"commit": "发布包SHA256:f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"package_sha256": "f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"git_commit_binding": "unknown",
|
||||
"sha256": "c28bb39a58fff73b476f3304e26ef5d57e3d5bec7069f86b0b0f69a9528195c0",
|
||||
"fetched_at": "2026-10-30T19:32:43.830335+00:00",
|
||||
"license_file": "impact__LICENSE.txt",
|
||||
"tag": "8.28.2",
|
||||
"applicability": "准确发布8.28.2;Git提交及目标绑定未知"
|
||||
},
|
||||
{
|
||||
"id": "impact",
|
||||
"repo": "ltdrdata/ComfyUI-Impact-Pack",
|
||||
"file": "modules/impact/logics.py",
|
||||
"local_file": "impact__modules__impact__logics.py",
|
||||
"url": "https://cdn.comfy.org/drltdata/comfyui-impact-pack/8.28.2/node.zip",
|
||||
"commit": "发布包SHA256:f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"package_sha256": "f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"git_commit_binding": "unknown",
|
||||
"sha256": "354daeec00a5f18aeba1277c2366ae55f32bee433c469e44853d36ed6ccb37cb",
|
||||
"fetched_at": "2026-10-30T19:32:43.830453+00:00",
|
||||
"license_file": "impact__LICENSE.txt",
|
||||
"tag": "8.28.2",
|
||||
"applicability": "准确发布8.28.2;Git提交及目标绑定未知"
|
||||
},
|
||||
{
|
||||
"id": "impact",
|
||||
"repo": "ltdrdata/ComfyUI-Impact-Pack",
|
||||
"file": "LICENSE.txt",
|
||||
"local_file": "impact__LICENSE.txt",
|
||||
"url": "https://cdn.comfy.org/drltdata/comfyui-impact-pack/8.28.2/node.zip",
|
||||
"commit": "发布包SHA256:f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"package_sha256": "f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"git_commit_binding": "unknown",
|
||||
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
|
||||
"fetched_at": "2026-10-30T19:32:43.830635+00:00",
|
||||
"license_file": "impact__LICENSE.txt",
|
||||
"tag": "8.28.2",
|
||||
"applicability": "准确发布8.28.2;Git提交及目标绑定未知"
|
||||
},
|
||||
{
|
||||
"id": "impact",
|
||||
"repo": "ltdrdata/ComfyUI-Impact-Pack",
|
||||
"file": "pyproject.toml",
|
||||
"local_file": "impact__pyproject.toml",
|
||||
"url": "https://cdn.comfy.org/drltdata/comfyui-impact-pack/8.28.2/node.zip",
|
||||
"commit": "发布包SHA256:f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"package_sha256": "f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"git_commit_binding": "unknown",
|
||||
"sha256": "3d6fa2cbd4b687d3d514ac41f601aae9e8a2f73c71f93adb548ccb09458a9094",
|
||||
"fetched_at": "2026-10-30T19:32:43.830671+00:00",
|
||||
"license_file": "impact__LICENSE.txt",
|
||||
"tag": "8.28.2",
|
||||
"applicability": "准确发布8.28.2;Git提交及目标绑定未知"
|
||||
},
|
||||
{
|
||||
"id": "core",
|
||||
"repo": "Comfy-Org/ComfyUI",
|
||||
"file": "comfy_api/latest/_ui.py",
|
||||
"local_file": "core__comfy_api__latest___ui.py",
|
||||
"commit": "b874bd2b8c324d58cfc37bff0754dd16815a8f3c",
|
||||
"tag": "v0.15.0",
|
||||
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/b874bd2b8c324d58cfc37bff0754dd16815a8f3c/comfy_api/latest/_ui.py",
|
||||
"sha256": "c3ff901299ffb58e3aceb6ab672254d21e2e9822e346786c0ed3bba56b93d67f",
|
||||
"git_blob_sha1": "e238cdf3ce3cd4475deda2f59bc43823558d14aa",
|
||||
"fetched_at": "2026-10-30T19:32:56.399023+00:00",
|
||||
"license_file": "core__LICENSE",
|
||||
"applicability": "源准确core0.15.0;目标安装未知"
|
||||
},
|
||||
{
|
||||
"id": "impact",
|
||||
"repo": "ltdrdata/ComfyUI-Impact-Pack",
|
||||
"file": "modules/impact/util_nodes.py",
|
||||
"local_file": "impact__modules__impact__util_nodes.py",
|
||||
"url": "https://cdn.comfy.org/drltdata/comfyui-impact-pack/8.28.2/node.zip",
|
||||
"commit": "发布包SHA256:f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"package_sha256": "f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"git_commit_binding": "unknown",
|
||||
"sha256": "7ca6a382fd2d5e7c563a0c9ac15918a23b84c872ef7f64248bc485c26921c710",
|
||||
"fetched_at": "2026-10-30T19:32:43.830335+00:00",
|
||||
"license_file": "impact__LICENSE.txt",
|
||||
"tag": "8.28.2",
|
||||
"applicability": "准确发布8.28.2;Git提交及目标绑定未知"
|
||||
},
|
||||
{
|
||||
"id": "impact",
|
||||
"repo": "ltdrdata/ComfyUI-Impact-Pack",
|
||||
"file": "modules/impact/core.py",
|
||||
"local_file": "impact__modules__impact__core.py",
|
||||
"url": "https://cdn.comfy.org/drltdata/comfyui-impact-pack/8.28.2/node.zip",
|
||||
"commit": "发布包SHA256:f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"package_sha256": "f907b19880b3847d3ada2f86949cc5b4bc72f9e7b0ba5fea8beaa6dad718d28e",
|
||||
"git_commit_binding": "unknown",
|
||||
"sha256": "6dc6cfc3048ae222779841eb28c61c594106293e68730003c13d72dc73f01545",
|
||||
"fetched_at": "2026-10-30T19:32:43.830335+00:00",
|
||||
"license_file": "impact__LICENSE.txt",
|
||||
"tag": "8.28.2",
|
||||
"applicability": "准确发布8.28.2;Git提交及目标绑定未知"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user