TinyTerra / ComfyUI_tinyterraNodes

A selection of nodes for Stable Diffusion ComfyUI
GNU General Public License v3.0
332 stars 39 forks source link

xyPlot and ranges #102

Open rjgoif opened 2 months ago

rjgoif commented 2 months ago

I absolutely love the idea that an xyPlot node can take any node value from anywhere and iterate across it. This cements ttn as my go to for basically everything in comfy now.

One small issue I have with the new xyPlot is how you can't easily iterate across a range by step size or number of steps with endpoints.

I made a custom node group that does this, but it's extremely clunky and adds nearly 30 nodes to the workflow (all just to process a range, then convert it into the new xyPlot programatic format).

I can post my nodes later if anyone is interested. Until then, is there an easy way to do this? Any plans to build in a range/step option?

Pic of my janky workflow: image

TinyTerra commented 2 months ago

I'm considering adding some kind of node based parsing to xyPlot string. Although I'd much rather keep the node mess to a minimum, which is difficult when considering all the variability. If you have ideas of how it could look to be most useful let me know. I'll see what i can come up with over the next few days

rjgoif commented 2 months ago

You could do another node, or you could do what A1111 does and have special syntax that's recognized as a range iterator.

You could use something like A1111 like "x-y[3]" for 3 steps spanning x to y, or "x-y(z)" for x, x+z, x+2z, x+3z... until x+nz exceeds y.

Another option would be a built in function in the node, like rangesteps(x,y,n,TRUE,TRUE) where the TRUE TRUE is a boolean for including the first and 2nd endpoint. Also rangeinterval(x,y,z,TRUE,TRUE) with the same idea.

I think it might be a bit easier to implement if you tweaked the syntax of the xpplot node, which is very customizable (good thing) but clunky to use in its current state (bad thing). Maybe this was easier to code, though. I don't know what's under the hood.

rjgoif commented 2 months ago

I cleaned up my custom node template. using regex is a lot more node efficient than a bunch of piecewise concats.

image

TinyTerra commented 2 months ago

working on a node that ouputs a plot_string with similar functionality to this, but want to flesh it out properly before pushing it

rjgoif commented 2 months ago

Excellent! I think it will push you way ahead of other all-in-one packages.

Oh, and your "buy me a coffee" link is broken on the main page of this repo. I found you manually anyway but now I'm stuck on the captcha for some reason, endlessly spinning on the verification... I'll try back in a little bit.

image

TinyTerra commented 2 months ago

Thanks for the heads up, I've updated the link. And thanks a lot for the support! It means a lot :)

TinyTerra commented 2 months ago

I've added an initial version of 'advPlot range' (b62fe51e2be9853bba5bdd3d7a3b52341b1db6e8) which outputs a correctly formatted string. the 'node' and 'widget' widgets update their options dynamically in a similar way to the advPlot dropdown - the node needs to be connected to an adv xyPlot node, which is in turn connected to a KSampler to show the available options (for range the widgets have been filtered to show only number widgets)

Let me know if it works how you think it should, or if there's anything you think should be added/changed. I haven't tested it super extensively so it may need some polishing still.

rjgoif commented 2 months ago

Hey this is a pretty good implementation!

My only suggestion would be to expand on its functionality to either be increment based (like it is now) or range based (which it can be with a little bit of math). Sort of like how the range(int) and range(float) nodes work from the EasyUse package.

But your node does 98% of the work for the user, so if you left it as is, it would still eliminate the need for that huge mess of nodes I built to accomplish the same thing. Cheers!

TinyTerra commented 2 months ago

1f8239b4ed594f10d3c5e51e048f6a8106220bc9 not sure if the range based is exactly the same as in EasyUse, so if you think it needs to be tweaked some more, let me know :)

added range_mode widget with step_int, step_float, num_steps_int, num_steps_float added stop widget added include_stop widget tweaked the dynamic widgets to adjust the step of 'start', 'step' and 'stop' depending on int/float tweaked the dynamic widgets to only show step_int/float, num_steps_int/float based on the 'widget' widget (may need to adjust which widgets it sets to which (int/float))