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

xyPlot and ranges #102

Open
rjgoif opened this issue May 1, 2024 · 9 comments
Open

xyPlot and ranges #102

rjgoif opened this issue May 1, 2024 · 9 comments

Comments

@rjgoif
Copy link

rjgoif commented May 1, 2024

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
Copy link
Owner

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
Copy link
Author

rjgoif commented May 2, 2024

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
Copy link
Author

rjgoif commented May 2, 2024

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

image

@TinyTerra
Copy link
Owner

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
Copy link
Author

rjgoif commented May 2, 2024

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
Copy link
Owner

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

@TinyTerra
Copy link
Owner

I've added an initial version of 'advPlot range' (b62fe51) 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
Copy link
Author

rjgoif commented May 6, 2024

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
Copy link
Owner

1f8239b 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))

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

2 participants