Created by: portnov
Was discussed in #2020 (closed). Has relation to #1951 (though most probably I will make a separate PR for use of this one).
This introduces a notion of "implicit data conversion policy": a class that is responsible for conversion of data from one socket type to another. There are the following implicit conversion policy classes defined:
-
NoImplicitConversionPolicy
: base one, prohibits any implicit conversion. -
DefaultImplicitConversionPolicy
: implements the same logic we had before: do some implicit conversions. ForStringsSocket
socket class, just passes data as they were (this is actually the same logic we had before; this is done because we have some number of nodes that consume any type of data into StringsSocket inputs - all the list processing nodes, they do not need any data conversion). -
LenientImplicitConversionPolicy
: do not check anything, pass any data as they are.
To all sv_get()
methods, added a new implicit_conversions
argument (defaulting to DefaultImplicitConversionPolicy
).
If specific node wants to describe specific data conversion rules for specific socket, it should define a policy class and pass it to sv_get()
.
As a side effect, this will have better error reporting, for example:
2018-01-08 21:30:30,289 [ERROR] sverchok.core.update_system: Node Viewer Draw.001 had exception: Implicit conversion from socket type MatrixSocket to socket type StringsSocket is not supported for socket edg_pol of node Viewer Draw.001. Please use explicit conversion nodes.
Please review and test.