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

History node #93

Open
positlabs opened this issue Jun 15, 2015 · 6 comments
Open

History node #93

positlabs opened this issue Jun 15, 2015 · 6 comments

Comments

@positlabs
Copy link

It would be cool to have a history node that could save and restore states. What do you think?

@brianchirls
Copy link
Owner

What kind of states? Can you walk me through a scenario?

@positlabs
Copy link
Author

I'm still not super familiar with how nodes work internally, so maybe this is a crazy idea. Mostly, I wanted to pitch it to see if it would work.

Here's a simple graph with a history node.

source -> effect -> history -> target

The history node would save the state/s of the node before it when .save() is called on it. Calling .restore() would restore the state to the input node. I think this would involve going back up the chain and restoring states to all of the node's ancestors.

It's possible a node isn't the right approach. Maybe this would be a method on the seriously instance. Non-linear node graphs introduce some complexity, for sure.

@brianchirls
Copy link
Owner

So you mean save a snapshot of the image frame? The freeze effect already does this, but it only holds the one frame. I suppose it could be extended to hold a stack of frames. But you'd want to allocate all that memory in advance and now how big your buffer's gonna be. Allocating new frame buffers is pretty slow/janky. And you run into trouble if you change the size of the node output later on.

As far as saving state of all the non-image input settings, I feel like it's outside of the scope of the library right now. Unless you have a really convincing use case. But I would like to get better at exporting the entire graph state, and I do have some ideas about API improvements that might make this sort of thing easier.

@positlabs
Copy link
Author

I'm trying to implement an undo feature. Definitely wouldn't be something I'd run every frame, so I doubt memory would be an issue.

I have no problem saving a frame, but I'm wondering how I can push that frame back into the graph. Maybe switch the input for a frame, pause, and switch back? I'm using accumulator, so it's all additive. The current frame isn't totally invalidated by the next.

@brianchirls
Copy link
Owner

Well, for many effects you could pass the output through a bunch of freeze nodes, and then freeze them all one at a time for each level of undo. Pass the freeze nodes into a select node and pick which one you want to display.

But that probably won't work for accumulator, since that effect has its own internal state, and the output depends on that state. So you can't really re-create without clearing it and playing back the input all the way back from the beginning.

However, this does sound like something you could do if Seriously allowed cyclical graphs. It explicitly rejects cycles now, but I could allow for it. The cycled input would always have to be one frame behind to avoid halting infinite loops.

@positlabs
Copy link
Author

Ohhh yes I would love to do some work with cyclical graphs!

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