paceholder / nodeeditor

Qt Node Editor. Dataflow programming framework
BSD 3-Clause "New" or "Revised" License
3.03k stars 814 forks source link

Question: Deferred-mode execution #296

Closed Poupine closed 2 years ago

Poupine commented 2 years ago

Hi there,

Rather than an issue, I have a question on the way graph execution is handled. The documentation indicates that graph execution is triggered anytime a new input is provided but I was wondering if there was a way to make the graph execution (or specific nodes) based on an external trigger. Say I have a node in my graph which takes hours to compute, I'd want to make sure my graph is correctly built before starting the execution and not every time I connect/disconnect/change some parameter.

Thanks in advance for your help :)

paceholder commented 2 years ago

Hi @Poupine ,

yes, that is possible. Each NodeDataModel derivative (your specific node models) is able to get new input data, compute something, and store it in its internal state.

The data is only then propagated when you explicitly call Q_EMIT dataUpdated(outPortIndex); in your code. You can trigger that function upon clicking some button on your node. Just browse through examples and you'll see when this signal is emitted.

Hope that helps.

Best,

Dmitry

Poupine commented 2 years ago

Hey @paceholder

Thanks a lot for the swift reply. I played with some examples today and now have a better understanding of the whole process I think. It's a really cool framework! I was looking at implementing something similar myself and I was super happy to find this repo :)

Cheers!

paceholder commented 2 years ago

I hope the question was answered. Closing it.