Open Search
    Modifying Nodes with Interfaces

    Describes how to modify nodes with the help of purpose-bound interfaces.

    Import Adapter Interface

    Despite its name, the ImportAdapterInterface allows both for modifying nodes on serialization and deserialization processes. It provides two methods to be overridden: the method BeforeWrite(), which is being called before a node is written to a file, and the method AfterRead(), which is being called after a node has been read from file. With this interface it's possible define version translation interfaces between node graphs that have been created with different revisions of a plugin.

    MAXON_INTERNED_ID_LOCAL("net.maxonexample.handbook.adapter.version", MyAdapterVersion);
    class MyAdapterImpl : public maxon::Component<MyAdapterImpl, maxon::nodes::ImportAdapterInterface>
    {
    public:
    static constexpr maxon::Int VERSION = 1;
    {
    if (node.GetBaseTemplate().first == maxon::Id("net.maxonexample.handbook.noderenderer.usernode"))
    {
    // We have found a Value node. Add a version tag.
    node.GetAttributes().Insert(MyAdapterVersion, maxon::Data(VERSION)) iferr_return;
    }
    else if (node.GetPath().GetKind() == maxon::NODE_KIND::NODE)
    {
    // Recurse into nested nodes.
    node.GetChildren(BeforeWrite) iferr_return;
    }
    return true;
    }
    {
    if (node.GetBaseTemplate().first == maxon::Id("net.maxonexample.handbook.noderenderer.usernode"))
    {
    // We have found a Value node. See if the version tag matches the current version.
    const maxon::Data* d = node.GetAttributes().FindValue(MyAdapterVersion);
    {
    // Version does not match. Do something about it
    }
    }
    else if (node.GetPath().GetKind() == maxon::NODE_KIND::NODE)
    {
    // Recurse into nested nodes.
    node.GetChildren(AfterRead) iferr_return;
    }
    return true;
    }
    };
    VERSION
    The meta data is tied to the version so that it isn't copied to a new version, for example the AssetV...
    Definition: assets.h:3
    Definition: objectbase.h:2651
    Definition: datatypebase.h:1800
    Definition: datatypebase.h:1199
    Definition: apibaseid.h:253
    Definition: resultbase.h:766
    Definition: nodes_import.h:21
    Int64 Int
    signed 32/64 bit int, size depends on the platform
    Definition: apibase.h:188
    #define MAXON_COMPONENT(KIND,...)
    Definition: objectbase.h:2212
    #define MAXON_INTERNED_ID_LOCAL(IID, NAME)
    Definition: module.h:80
    #define MAXON_METHOD
    Definition: interfacebase.h:1001
    @ NODE
    Indicates that the g-node is a true node.
    #define iferr_scope
    Definition: resultbase.h:1384
    #define iferr_return
    Definition: resultbase.h:1519
    Definition: node.h:10

    The adapter implementation has to be registered with the following macro:

    MAXON_COMPONENT_OBJECT_REGISTER(MyAdapterImpl, maxon::nodes::ImportAdapters, "net.maxonexample.handbook.node.myadapter");
    #define MAXON_COMPONENT_OBJECT_REGISTER(C,...)
    Definition: objectbase.h:2473

    UI Conversion Interface

    This interface allows for providing a custom classic UI for a given port type. This classic UI is then displayed in the Node Editor window. The interface is registered using the specific node identifier of the port that is being targeted. This identifier can be found in the description of a parameter under "Group Type Id"; for example when inspecting the type in the the Resource Editor.

    Material Exchange Interface

    See ExchangeMapper Material Export Manual