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

The "GlobalSeed" node doesn't work with grouped nodes #80

Open
GalaxyTimeMachine opened this issue Mar 1, 2024 · 4 comments
Open

The "GlobalSeed" node doesn't work with grouped nodes #80

GalaxyTimeMachine opened this issue Mar 1, 2024 · 4 comments

Comments

@GalaxyTimeMachine
Copy link

As per the title, it has no effect on grouped nodes. Stage B in the image is a grouped node...
image

@muunkky
Copy link

muunkky commented May 18, 2024

I'm having this problem too, but not with a grouped node. I think it's a logic error in the global seed handler.

Take a look at the current version below. It iterates through all nodes and collects the values from the GlobalSeed node when it encounters it, but that means ignoring all the nodes that it passes until then because w will be undefined.

Most straightforward approach is to find the values from the global seed widget first and then iterate through the nodes

import { api } from "../../scripts/api.js";

function globalSeedHandler(event) {
	let nodes = app.graph._nodes_by_id;

	for(let i in nodes) {
		let node = nodes[i];

		if(node.type == 'GlobalSeed //Inspire') {
			if(node.widgets) {
				const w = node.widgets.find((w) => w.name == 'value');
				const last_w = node.widgets.find((w) => w.name == 'last_seed');
				last_w.value = w.value;
				if(event.detail.value != null)
					w.value = event.detail.value;
			}
		}
		else
			if(node.widgets) {
				const w = node.widgets.find((w) => (w.name == 'seed' || w.name == 'noise_seed') && w.type == 'number');
				if(w && event.detail.seed_map[node.id] != undefined) {
					w.value = event.detail.seed_map[node.id];
				}
			}
	}
}

api.addEventListener("inspire-global-seed", globalSeedHandler);

@ltdrdata
Copy link
Owner

I'm having this problem too, but not with a grouped node. I think it's a logic error in the global seed handler.

Take a look at the current version below. It iterates through all nodes and collects the values from the GlobalSeed node when it encounters it, but that means ignoring all the nodes that it passes until then because w will be undefined.

Most straightforward approach is to find the values from the global seed widget first and then iterate through the nodes

That part is simply about reflecting the workflow update information received from the backend into the workflow. The update information includes details on how to update each widget of the nodes, so the order doesn't matter.

The actual update of the seed occurs when the prompt is sent to the backend and before the prompt is executed.

def prompt_seed_update(json_data):

@ltdrdata
Copy link
Owner

Group nodes are dynamically generated and executed in the form of virtual nodes, which is a special structure. Currently, the functions processed right before the prompt execution (global seed, onprompt, ...) do not take group nodes into account.

@muunkky
Copy link

muunkky commented May 21, 2024

thanks @ltdrdata. I wasn't using a group node. I'll try to replicate it and see what I find

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

No branches or pull requests

3 participants