★ wanayoo — archive 1999 https://github.com/paceholder/nodeeditor/issues/258Nouvelle recherche | Portail wanayoo
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

TypeConverter doesn't leave room for computationally expensive conversions #258

Open
loganmcbroom opened this issue Feb 8, 2020 · 0 comments

Comments

@loganmcbroom
Copy link

@loganmcbroom loganmcbroom commented Feb 8, 2020 •

The ability to emit dataUpdated and propagate when data is ready allows easily passing blocking computations to another thread. The automatic type conversion between nodes doesn't allow this.

I'm fixing this by replacing TypeConverter with a class with virtual void operator()( SharedNodeData )=0 and virtual std::shared_ptrTypeConverter createNew()=0, as well as a finished() signal. The remainder of the library holds std::shared_ptrTypeConverter rather than TypeConverter, which requires a few small changes. Connection has propagateData split into setInData and propagateData. SetInData calls propagateData if no converter exists, and otherwise simply sends the input to the converter. Inheriting converters can choose to pass computation to another thread, connecting a futureWatcher finished signal e.g. to the TypeConverter finished signal, which is connected to Connection::propagateData. Finally, the createNew method is overloaded by inheritors simply as a factory for the type converter registry, since it only stores base class pointers.

I will submit these changes if it seems like a good solution, but it currently would require existing converters to be rewritten to inherit and emit, so it is maybe better to leave as is. I'm not sure how many others will have lengthy blocking conversions.

Edit: I'm not sure how to get <> to appear, so some types are incorrectly written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.