Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom SaveImage nodes when registering SaveImageExtraOutput #2219

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

HaydenReeve
Copy link

@HaydenReeve HaydenReeve commented Jan 10, 2025

Updated the conditional logic to use includes for matching SaveImage node variants. This ensures broader compatibility with nodes sharing similar naming conventions while maintaining functionality for SaveAnimatedWEBP.

Resolves #2218


This PR seeks to extend some support for custom SaveImage nodes so that they may also make use of the rather bespoke functionality surrounding the native SaveImage and SaveAnimatedWEBP nodes.

I've chosen to suggest an extremely lite implementation here, as I suspect we may be expecting some more broadly encompassing work later down the track.

The additional guard included is to make sure that we don't throw a tantrum if we find a match but that match doesn't yet have a filename_prefix associated with it.

┆Issue is synchronized with this Notion page by Unito

Updated the conditional logic to use `includes` for matching `SaveImage` node variants. This ensures broader compatibility with nodes sharing similar naming conventions while maintaining functionality for `SaveAnimatedWEBP`.
Ensure that widget existence is verified before assigning `serializeValue`. This prevents potential runtime errors when the widget is undefined.

This guards against any custom nodes that name match but don't have the provided field from throwing an error.
@HaydenReeve HaydenReeve requested a review from a team as a code owner January 10, 2025 15:42
@HaydenReeve

This comment was marked as outdated.

@@ -7,7 +7,7 @@ import { applyTextReplacements } from '../../scripts/utils'
app.registerExtension({
name: 'Comfy.SaveImageExtraOutput',
async beforeRegisterNodeDef(nodeType, nodeData, app) {
if (nodeData.name === 'SaveImage' || nodeData.name === 'SaveAnimatedWEBP') {
if (nodeData.name.includes('SaveImage') || nodeData.name === 'SaveAnimatedWEBP') {
Copy link
Author

@HaydenReeve HaydenReeve Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like me to fix the prettier issue while I'm here?

I believe the change is

Suggested change
if (nodeData.name.includes('SaveImage') || nodeData.name === 'SaveAnimatedWEBP') {
if (
nodeData.name.includes('SaveImage') ||
nodeData.name === 'SaveAnimatedWEBP'
) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend Support for custom SaveImage nodes within SaveImageExtraOutput
2 participants