NodeSystemClassInterface Implementation

Table of Contents

About

A node system class defines a set of methods to customize the behaviour 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.

Note
The instance of maxon::nodes::NodeSystemClassInterface must be registered in maxon::nodes::NodeSpaceInterface::Init(). See NodeSpaceInterface Implementation.

Methods

These methods allow to filter nodes that can be used in the node system.

static maxon::Id g_nodeSystemClassExampleID = maxon::Id("net.maxonexample.class.examplenodeclass");
class ExampleNodeSystemClassImpl : public maxon::Component<ExampleNodeSystemClassImpl, maxon::nodes::NodeSystemClassInterface>
{
MAXON_COMPONENT(FINAL, maxon::nodes::BaseCoreNodesNodeSystemClass().GetClass());
public:
MAXON_METHOD maxon::Result<maxon::Bool> SupportsImpl(const maxon::nodes::NodeTemplate& templ) const
{
const maxon::Id& id = templ.GetId();
if (id == maxon::Id("net.maxon.node.arithmetic") || id == maxon::Id("net.maxon.node.scale"))
{
return true;
}
return super.SupportsImpl(templ);
}
MAXON_METHOD maxon::Result<maxon::Bool> SupportsVariant(const maxon::nodes::NodeTemplate& templ, const maxon::Block<const maxon::Id>& variant) const
{
return *variant.GetLast() != maxon::Id("net.maxon.parametrictype.col<4,float>");
}
MAXON_METHOD maxon::Result<maxon::Id> SubstituteVariant(const maxon::nodes::NodeTemplate& templ, const maxon::Block<const maxon::Id>& variant, const maxon::Block<const maxon::Id>& options) const
{
if (*variant.GetLast() == maxon::Id("net.maxon.parametrictype.col<4,float>"))
{
return maxon::Id("net.maxon.parametrictype.col<3,float>");
}
return { };
}
};
MAXON_COMPONENT_CLASS_REGISTER(ExampleNodeSystemClassImpl, g_nodeSystemClassExampleID);
Definition: block.h:423
T * GetLast() const
Definition: block.h:665
Definition: objectbase.h:2651
static const Class< typename INTERFACE::Hxx1::ReferenceClass > & GetClass()
Definition: objectbase.h:2733
Definition: apibaseid.h:253
Definition: resultbase.h:766
#define MAXON_COMPONENT(KIND,...)
Definition: objectbase.h:2212
#define MAXON_COMPONENT_CLASS_REGISTER(C,...)
Definition: objectbase.h:2409
#define MAXON_METHOD
Definition: interfacebase.h:1001

Further methods are:

// This example creates a new NodesGraphModelRef.
maxon::AssetRepositoryRef repository = maxon::AssetInterface::GetBuiltinRepository();
maxon::nodes::MutableRoot root = maxon::nodes::CoreNodesNodeSystemClass().CreateNodeSystem(repository) iferr_return;
const auto nodesGraphModelClass = maxon::nodes::NodesGraphModelClass();
maxon::nodes::NodesGraphModelRef nodesGraphModel = nodesGraphModelClass.Create() iferr_return;
nodesGraphModel.Init(sys, repository, filter, true) iferr_return;
static MAXON_METHOD const AssetRepositoryRef & GetBuiltinRepository()
Definition: nodesystem.h:2282
Result< NodeSystem > EndModification(Opt< ChangeList & > list={}, NodeSystem::FINALIZE_FLAGS finalize=NodeSystem::FINALIZE_FLAGS::CLEANUP)
Definition: nodesystem.h:818
@ NONE
Don't do any finalizations at all.
@ INCLUDE_INNER
Includes inner nodes in the view.
@ INCLUDE_HIDDEN
Includes hidden nodes in the view.
static const NO_VALUE_TYPE NO_VALUE
Definition: optional.h:17
#define iferr_return
Definition: resultbase.h:1465