#include <nodesystem_derivation.h>
A node system derivation handler defines a set of methods to customize the attribute derivation behavior of node systems. Usually you don't have to bother about this because the default handler is sufficient. However some node templates have to specialize the default behavior for the node systems which they instantiate, for example to define a custom constant value computation.
To change the handler of a node system a node template has to call MutableRoot::SetDerivationHandler().
Public Member Functions | |
MAXON_METHOD Result< Opt< Data > > | DeriveAttributeValue (const Block< const Port > &nesting, const DerivedAttribute &attr) const |
MAXON_METHOD Result< Bool > | FilterDerivationConnection (const Port &src, const Port &dst) const |
MAXON_METHOD Result< Bool > | OverrideDerivedValue (const Port &port, VALUEMODE &outMode, Data &outValue) const |
Private Member Functions | |
MAXON_INTERFACE (NodeSystemDerivationHandlerInterface, MAXON_REFERENCE_CONST, "net.maxon.node.interface.nodesystemderivationhandler") | |
|
private |
MAXON_METHOD Result<Opt<Data> > DeriveAttributeValue | ( | const Block< const Port > & | nesting, |
const DerivedAttribute & | attr | ||
) | const |
Computes the value of the derived attribute attr at the port specified by nesting. This method is called during validation of derived attributes. The default implementation just calls attr.DeriveAttributeValue(), but implementations may override this default behavior.
[in] | nesting | The last element of nesting if the port for which the attribute value shall be computed, the previous elements are its enclosing ports up to the top-level port. |
[in] | attr | The derived attribute whose value shall be computed. |
MAXON_METHOD Result<Bool> FilterDerivationConnection | ( | const Port & | src, |
const Port & | dst | ||
) | const |
Checks if connections from src to #dst shall be reported by PortFunctions::GetConnections when the GET_CONNECTIONS_MODE::DERIVATION_FILTER flag is set. This method is called by PortFunctions::GetConnections whenever the source port of a connection has GNODE_FLAGS::DERIVATION_FILTER_SOURCE set, the target port has GNODE_FLAGS::DERIVATION_FILTER_TARGET set and both ports belong to instantiations of the same template. Only if this method returns true the connection will be reported by PortFunctions::GetConnections. This allows to hide connections which aren't needed, for example because they transport constant values.
[in] | src | The source port of a connection. |
[in] | dst | The target port of a connection. |
MAXON_METHOD Result<Bool> OverrideDerivedValue | ( | const Port & | port, |
VALUEMODE & | outMode, | ||
Data & | outValue | ||
) | const |
Allows to override the ConstantValue and its mode on #port. This method is called during validation of the ConstantValue and related attributes, and it allows to override the ConstantValue and the VALUEMODE of any port (input or output) after regular derivation of these attributes has been done. You can implement this method for example to compute constant values for ports when their inputs are known. Default behavior returns false and doesn't affect the value and mode.
[in] | port | The port for which NodeSystemDerivationHandlerInterface can update the value. |
[in,out] | outMode | The original mode, update the value to force another mode. |
[in,out] | outValue | The original port's value, update to a new value has needed. |