Macro Definition Documentation
◆
MAXON_CORENODE_REGISTER_CONVERSION
#define MAXON_CORENODE_REGISTER_CONVERSION
|
(
|
|
TO
,
|
|
|
|
FROM,
|
|
|
|
flags
|
|
)
|
|
|
MAXON_CORENODE_REGISTER_CONVERSION registers a conversion core node. The core node compiler uses such nodes to implicitly convert values where required. Also you can ask CoreNodesLib::GetConversion() for a ConversionSequence of several conversion core nodes which is capable of converting from a source type to a destination type.
If the conversion is implemented by a constructor of
TO
which takes a #FROM argument the MAXON_CORENODE_REGISTER_CONVERSION macro alone is sufficient to implement and register the conversion node. Otherwise you have to specialize the ConversionNode template before you use the MAXON_CORENODE_REGISTER_CONVERSION macro:
template <> class ConversionNode<Float, TimeValue> : public OperatorNode<ConversionNode<Float, TimeValue>, Float(TimeValue)>
{
public:
static ResultOk<void> Process(Float& out, const TimeValue& value)
{
out = value.GetSeconds();
return OK;
}
};