#include <nodesystem_class.h>
A node system class defines a set of methods to customize the behavior of node systems and node templates. Whenever a NodeTemplate is instantiated to a NodeSystem, this process goes through a NodeSystemClass. Also only NodeSystems which use the same class can be used together.
NodeSystemClassInterface inherits from NodeSystemDerivationHandlerInterface: Unless you change the NodeSystemDerivationHandler explicitly (see MutableRoot::SetDerivationHandler()) the node system class is used to define the attribute derivation behaviour via its implementation of NodeSystemDerivationHandlerInterface.
|
MAXON_FUNCTION const Id & | GetId () const |
|
MAXON_FUNCTION Bool | IsSubclassOf (const NodeSystemClass &other) const |
|
MAXON_METHOD Result< MutableRoot > | CreateNodeSystem (const AssetRepositoryRef &repo) const |
|
MAXON_METHOD Result< void > | FinalizeModification (MutableRoot &root, TimeStamp stampOnBegin, NodeSystem::FINALIZE_FLAGS finalize, ChangeList *changelist) const |
|
MAXON_METHOD const GraphAttribute & | GetGraphAttribute (const InternedId &attr) const |
|
MAXON_METHOD GraphAttribute::FLAGS | GetGraphAttributeFlags (const InternedId &attr) const |
|
MAXON_METHOD Result< Bool > | GetDerivedAttributes (const ValueReceiver< const InternedId & > &receiver) const |
|
MAXON_METHOD Result< CONVERSION_FLAGS > | GetConversionFlags (const DataType &dest, const DataType &src) const |
|
MAXON_METHOD Result< Data > | Convert (const DataType &dest, const ConstDataPtr &value) const |
|
MAXON_METHOD Result< Bool > | SupportsImpl (const NodeTemplate &templ) const |
|
MAXON_METHOD Result< Bool > | SupportsVariant (const NodeTemplate &templ, const Block< const Id > &variant) const |
|
MAXON_METHOD Result< Id > | SubstituteVariant (const NodeTemplate &templ, const Block< const Id > &variant, const Block< const Id > &options) const |
|
MAXON_METHOD Result< NodeSystem > | InstantiateImpl (const InstantiationTrace &parent, const NodeTemplate &templ, const TemplateArguments &args) const |
|
MAXON_METHOD Result< GraphModelInterface::MODIFIED > | GetSpecialFlags (const Port &port, const InternedId &attr, GraphAttribute::FLAGS attrFlags, const ConstDataPtr &newValue, const ConstDataPtr &oldValue) const |
|
MAXON_METHOD Bool | HasGlobalContext () const |
|
◆ MAXON_INTERFACE()
◆ GetId()
Returns a unique identifier for this node system class (namely the identifier of the object class,
{GetClass().GetId()}).
- Returns
- Unique identifier for node system class.
◆ IsSubclassOf()
Bool IsSubclassOf |
( |
const NodeSystemClass & |
other | ) |
const |
Checks if this class is a subclass of #other. This is implemented by the corresponding function of the underlying object class.
- Parameters
-
[in] | other | Another node system class. |
- Returns
- True if this class is a subclass of #other, false otherwise.
◆ CreateNodeSystem()
Creates a new compound node system. Compound node systems allow to set up a node system consisting of several other nodes.
Whenever the node system needs to do an asset lookup during the following modifications, the given repository is used.
- Parameters
-
[in] | repo | The repository to use for asset lookup during the following modifications. |
- Returns
- The MutableRoot of a new empty compound node system.
◆ FinalizeModification()
Runs finalization steps at the end of a modification. This method must not be called directly, instead it is called implicitly during MutableRoot::EndModification(). When overriding the method make sure to call the super implementation.
- Parameters
-
[in] | stampOnBegin | The time stamp of the node system at the time BeginModification() was called. |
[in] | finalize | Flags to control the finalization. |
[in] | changelist | Change list to log changes made during finalization. |
◆ GetGraphAttribute()
Returns the GraphAttribute which node systems of this class use for the attribute identified by attr. The method may return a null reference if the class doesn't provide a GraphAttribute for attr. This doesn't mean that the attribute is unsupported, it just means that there is no need for special handling of the attribute (which would require a GraphAttribute). The default implementation asks the Attributes registry.
- Parameters
-
[in] | attr | The identifier of the attribute. |
- Returns
- The corresponding GraphAttribute, or a null reference if the node system class has no GraphAttribute for attr.
- See also
- GetGraphAttributeFlags
◆ GetGraphAttributeFlags()
Returns the GraphAttribute::FLAGS to use for the attribute identified by attr. This allows the node system class to override the default flags of the attribute, for example to mark an attribute as meta attribute.
You must not override this method directly, override GetGraphAttributeFlagsImpl instead.
- Parameters
-
[in] | attr | The identifier of the attribute. |
- Returns
- The flags which this node system class uses for the attribute.
- See also
- GetGraphAttribute @MAXON_ANNOTATION{default=GraphAttributeInterface::FLAGS::DIRECT}
◆ GetDerivedAttributes()
Yields all required derived attributes of this node system class to receiver.
- Parameters
-
[in] | receiver | A receiver for required derived attributes. |
◆ GetConversionFlags()
Returns the conversion flags of a conversion from src to #dest as implemented by Convert. If there is no such conversion, CONVERSION_FLAGS::INCONVERTIBLE is returned.
- Parameters
-
[in] | dest | The destination type. |
[in] | src | The source type. |
- Returns
- The conversion flags for the conversion from src to #dest.
◆ Convert()
Converts value to type dest. This is used e.g. by the validation mechanism of the EffectivePortValue attribute whenever this needs to convert incoming data to a different expected type. The default implementation of DefaultNodeSystemClass uses DataType::Convert, but this may be overridden if the implementation provides additional means for conversion.
- Parameters
-
[in] | dest | The type to convert to. |
[in] | value | The value to convert. |
- Returns
- The converted value.
◆ SupportsImpl()
Checks if this node system class supports the instantiation of the given node template. If true is returned, this does not necessarily mean that all possible instantiations of the template are supported, but at least some are supported. Usually this call is just forwarded to NodeTemplateInterface::SupportsImpl, but the node system class may override this default behaviour.
- Parameters
-
[in] | templ | The node template to check. |
- Returns
- True if the node template can be instantiated for this class, false otherwise.
◆ SupportsVariant()
Checks if this node system class supports the given #variant for a node template #templ created by NodesLib::CreateVariantTemplate(). #variant is a path into the TreeMap which was given as argument to NodesLib::CreateVariantTemplate(). The default implementation of DefaultNodeSystemClass returns true.
- Parameters
-
[in] | templ | The variant node template to check. |
[in] | variant | The path into the TreeMap of variants. |
- Returns
- True if this node system supports the given variant, false otherwise.
◆ SubstituteVariant()
Subtitutes an unsupported variant of a node template #templ created by NodesLib::CreateVariantTemplate() by a supported one. #variant is a path into the TreeMap which was given as argument to NodesLib::CreateVariantTemplate(). The path points to the variant of the template which was chosen by the template arguments, but which is not supported as reported by SupportsVariant(). If a supported alternative shall be used as a substitution, the method returns its identifier. If no substution is possible, the method returns an empty identifier.
- Parameters
-
[in] | templ | The variant node template to check. |
[in] | variant | The (unsupported) path into the TreeMap of variants. |
[in] | options | The supported alternatives for the last path element of #variant. This is not a path, but a list of the supported siblings of the unsupported variant in the TreeMap of the variant node template. |
- Returns
- An alternative to use for the unsupported #variant, or an empty identifier if there is no viable alternative.
◆ InstantiateImpl()
Instantiates the template #templ using the given arguments for this node system class. Usually this call is just forwarded to NodeTemplateInterface::InstantiateImpl, but the node system class may override this behaviour to return a specialization of the node template.
If this node system class supports the instantiation of #templ in general but not for the given arguments, a NodeSystem will be returned nevertheless but with error attributes indicating the instantiation error. If #templ isn't supported at all, error attributes can be set too, or an error can be returned.
- Parameters
-
[in] | parent | The parent instantiation context. You can reach all enclosing instantiation contexts through #parent, this helps to prevent infinite recursions. |
[in] | templ | The node template to instantiate. |
[in] | args | Arguments to parametrize the instantiation. |
- Returns
- A new node sytem which is the instantiation of this template for the given arguments. @MAXON_ANNOTATION{refclass=false}
◆ GetSpecialFlags()
Returns the set of special graph modification stamps which shall be set for the change from oldValue to newValue.
- Parameters
-
[in] | port | The port where the attribute value has changed. |
[in] | attr | The attribute whose value has changed. |
[in] | attrFlags | The flags of the attribute. |
[in] | newValue | The newly derived attribute value for port. |
[in] | oldValue | The previously derived attribute value for port. |
- Returns
- Combination of special flags, these determine the graph modification stamps which shall be updated.
◆ HasGlobalContext()
Returns true if node systems of this node system class shall have the GlobalContext port. GlobalContext ports are implicitly propagated from children to their parents.
- Returns
- True if GlobalContext port shall be provided, false otherwise.
◆ GetGraphAttributeFlagsImpl()
Returns the GraphAttribute::FLAGS to use for the attribute identified by attr. This allows the node system class to override the default flags of the attribute, for example to mark an attribute as meta attribute.
Implementations may override this method, this will be used by the public GetGraphAttributeFlags method.
- Parameters
-
[in] | attr | The identifier of the attribute. |
- Returns
- The flags which this node system class uses for the attribute.
- See also
- GetGraphAttribute @MAXON_ANNOTATION{default=GraphAttributeInterface::FLAGS::DIRECT}